Am Mittwoch, 14. Februar 2018 14:45:49 UTC+1 schrieb Adler Neves:
>
> You can have an OneToOneField in the profile referencing Django's User
> model with `related_name='profile'`,
Well, i know this and the related entry is accessible even without
explicitly defining the related_name. You can change defaults defining the
related_name, tho.
But still trying to add a UserInline to the ProfileAdmin wont work due to
the missing FK on the user model.
> About the admin interface changing the model, I guess you're somehow
> editing `models.py` files. Are you making the migrations, applying them to
> the database and reloading the server? If you're not persisting changes
> that way, how do you patch models in memory every startup and ensure
> database schema is compatible with your models?
>
Just for clarification, i dont do any mysterious magic: the property works
like this:
@property
def username(self):
return self.user.username
username.fget.short_description = "Username"
@username.setter
def username(self, username):
self.user.username = username
self.user.save()
So with everything else failing .. although i only want to be able to edit
this one field of the actual user, it looks like i have to show a useradmin
with a profile inline admin?
AFAIK this can only be done with a separate admin site, because there can
only be one Admin for any model thats why i wanted to have some other
solution.
Maybe someone knows a better solution?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c3165e95-7be7-42bb-824f-fc52aed080f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.