Le jeudi 22 septembre 2011 11:56:09, galgal a écrit :
But I need to do checks in Admin, not my view. I can't find a method
to validate in Admin.
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/rRHhnv1GGfEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
Sorry,
in models.py:
class Poll(models.Model):
question = models.CharField(max_length=200)
def __unicode__(self):
return self.question
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
correct = models.BooleanField()
def __unicode__(self):
return self.choice
in admin.py
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 4
class PollAdmin(admin.ModelAdmin):
inlines = [ChoiceInline]
admin.site.register(Poll, PollAdmin)
--
BILLION Sébastien
Un geek averti en vaut 10
http://www.sebastienbillion.com/ <http://www.sebastienbillion.com/>
--
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+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.