Hello,
I have to confess that I did not understand your suggestion. How this will
help me to reverse the logic of my system? I mean, instead of User with or
without a profile (the Person class, in my case), I want a Person with or
without a User.
Thanks anyway
Em quarta-feira, 27 de maio de 2015 12:54:59 UTC-3, Carlos Ribas escreveu:
>
> Hello All,
>
> I am currently extending the existing User model to store additional
> information. So, basically I have:
>
> # models.py
> class Person(models.Model):
> user = models.OneToOneField(User, verbose_name=_('User'))
> zipcode = models.CharField(_('Zip Code'), max_length=9, blank=True,
> null=True)
> street = models.CharField(_('Address'), max_length=255, blank=True,
> null=True)
> ...
>
> #admin.py
> class PersonAdmin(admin.StackedInline):
> model = Person
> ...
>
> class UserAdmin(UserAdmin):
> inlines = (PersonAdmin, )
> ...
>
> admin.site.unregister(User)
> admin.site.register(User, UserAdmin)
>
>
> The problem is that my system should be able to register a new person, but
> this person may not need an account on the system (I just need to have
> his/her information). Right now, I can not create a person without an
> account. Besides that, first_name and last_name fields are not in the
> person class.
>
> I am wondering what is the best solution for my case. Probably, I will
> need to move the first_name and last_name fields to the Person class, and
> to do that, I will have to create custom users, is that right?
>
> If that is the case, may I just copy and paste the lines shown here (
> https://github.com/django/django/blob/master/django/contrib/auth/models.py)
> and remove the lines about first_name and last_name?
>
> Well, any help will be appreciated.
>
>
--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f8930d9e-dc5d-4b7f-870b-404be70c82c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.