> items = Contest.objects.all()
> random_item = random.choice(items)
>
> if request.method =='POST':
>     data = {'contest': random_item,
>             'ownername': 'SUMMERSON',
>             }
>     form=PhotoForm(request.POST, initial=data)
>     if form.is_valid():
>         photo = form.save()  # Instances go in lowercase, otherwise you are 
> doing it to the class
> else:
>     form = PhotoForm()
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhLDx6Dih_N%3DLWBZPJiumNYvWAmm6Qt4psUTpCrYP1ykUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to