I have just written a model to extend the user model a bit
and now I'd
like to
add a slug field for the username, however, I can't get the
slug field
to
prepopulate from the user foreign key.
A simplified version of the model would be this:
from django.db import models
from django.contrib.auth.models import User
class Login(models.Model):
user = models.ForeignKey(User, unique=True)
slug =
models.SlugField(prepopulate_from=('user__username',),
unique=True)
I have also tried prepopulating with 'username' but that
didn't work
either,
is it at all possible to prepopulate from a foreign key?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|