Wednesday, January 25, 2017

Extended user model to add Profile class want to slugify first_name last_name in profile class

Hi

I have extended Django's default user model to add a Profile model; bio etc.

I want to slugify the users first_name last_name in profile class, so I can search for all X entities written by a specific user in the url form:

/blog/authors/bob-smith

When I try to add the slug field to my profile model that works fine. When I modify my admin to include the slug field, I cannot get the prepopulated_form to work:

class ProfileInline(admin.StackedInline):
  model = Profile
  can_delete = False
  verbose_name_plural = 'profile'
  fk_name = 'user'
  prepopulated_fields = {"slug": ('profile__first_name', 'profile__last_name')}

The profile is a onetoone to my user model.

Any ideas?

Thank you

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/0ac97cad-30e9-4475-a9b3-9c917a48df24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment