Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
OneToOneField in Django admin not editable

I've stripped my code all the way down and am left with these simple models:

models.py

class Member(models.Model):
    property = models.OneToOneField(Property, on_delete=models.CASCADE, blank=True, null=True)

class Property(models.Model):
    ....

And this very basic admin for Members:

admin.py

class PropertyAdmin(admin.ModelAdmin):
   pass
admin.site.register(Property, PropertyAdmin)

class MemberAdmin(admin.ModelAdmin):
    pass
admin.site.register(Member, MemberAdmin)

While logged into the admin as a superuser, as expected on the Member admin page I see a dropdown to choose a Property model. When there is already a Property model selected, the usual pencil icon to edit the selected Property model is faded out, so I cannot click on it. How can I activate this icon so that I can get the usual pop-up to edit the related Property from this Member page? I can't figure out what I am missing.

Thank you!

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You're not registering the Property model in admin.

@admin.site.register(Property)
class PropertyAdmin(admin.ModelAdmin):
    pass
over 4 years ago · Santiago Trujillo Report

0

Agreed with @Andrey Shipilov,

You can follow in this way also.

class PropertyAdmin(admin.ModelAdmin):
    pass
admin.site.register(Property, PropertyAdmin)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!