problem with model.formset_factory

2009-02-03 Thread thanhduclee

hi all!
 I am really new to Django, and at the moment I have project which is
something like giving feedback to mates for specific task like
tutorial/assignement..
And I have a problem with the formset_factory. Any time when I try to
save the form it appears the error:

(Hidden field id) Map_marking with this None already exists.

which map_marking is my model

And this is my code in views:

 map_marking_formset = modelformset_factory(map_marking, max_num =
count,fields = ('peer_answer','feedback','mark'))
if request.method == 'POST':
formset = map_marking_formset(request.POST, request.FILES,
queryset = map_marking.objects.filter(studentid = user.username,
itemid = get_current_item()))
if formset.is_valid():
formset.save()
else:
formset = map_marking_formset()

The code looks obvious for me, I dunt know why the error come from.
Deeply appreciate for any helps or hints to kills the error

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



Re: Wierd FileField behavior

2009-02-03 Thread thanhduclee

Cool, you saved my life

On Feb 3, 10:50 pm, Ramiro Morales  wrote:
> On Tue, Feb 3, 2009 at 9:40 AM, Erwin Elling  wrote:
>
> >> I went back to 9781 (which was still on my system for a previous
> >> project) and the problem seems not to exist here. Haven't had the time
> >> to dig into this any further, but maybe this helps someone else.
>
> > Sorry, made a mistake; On 9781 the problem is still there.
> > On 9084 (also quite randomly chosen) it seems to be allright.
>
> Revision 9766 introduced some changes related to file fields, can
> you try to refine your tests and see if it is the one that broke
> things in your case and report back please?
>
> --
>  Ramiro Morales

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