Le jeudi 22 septembre 2011 12:13:20, galgal a écrit :
I have my model done, the only thing is - how to validate if 1 or more checkboxes are checked. It should be done in admin - choices are displayed via Inline.
--
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/-/ZbU-_CGCZsEJ.
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 one more time!

add this to your admin.py

class PollAdmin(admin.ModelAdmin):
   inline =[ChoiceInline]
  #check bafore save
  def save_model(self, request, obj, form, change):
       for choice in obj.choice_set.all():
           if choice.correct == True:
               print "ok"
       obj.save()

--
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.

Reply via email to