Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8104871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:59:49+00:00 2026-06-05T23:59:49+00:00

I have these simple classes Class A(models.Model): … Class Meta(models.Model): a = models.OnetoOneField(A, primary_key=True)

  • 0

I have these simple classes

Class A(models.Model):
    ...

Class Meta(models.Model):
    a = models.OnetoOneField(A, primary_key=True)
    width = models.IntegerField(default=100)

but when I do

a = A()
meta = Meta()
a.save()
meta.a = a
meta.save()
print a.meta.width

i get

'A' object has no attribute 'meta'

Why is this? Am I using OneToOne wrong? if so how can i get the correct print statement?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:59:50+00:00Added an answer on June 5, 2026 at 11:59 pm

    Define a related_name to call the reverse accessor.

    a = models.OneToOneField(A, related_name='foobar')
    # ...
    a.foobar 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two simple files that define a C++ class with a tryME
I'm looking for a simple modelformset example - I have a model class Category(BaseModel):
I have a fairly simple question about these 2 templating engines. I'm trying to
These are probably are pretty simple YES|NO type questions. I have some NSDictionaries containing
Is there a simple way to have isometric projection? I mean the true isometric
today a weird problem occurred to me: I have a model class in Django
I'm trying to add an object created from Entity Data Model classes. I have
I have a rather simple data model, but I have a centric entity called
So, say I have a simple enum and a class that uses it: enum
anyone came up with simple solutions? question: Given the two model classes with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.