Looking at the trace, the filter executed without a user is this one:

File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save_base
   470.                         manager.filter(pk=pk_val).extra(select={'a': 
1}).values('a').order_by())):

Overwriting save_base feels like I'm diving into a rabbit hole that is way 
to deep.

Help or tips are much appreciated.

Gerard.

Gerard wrote:
> Hi all,
> 
> I'm totally in the dark atm. I save an object in the following way:
> 
>      if form.is_valid():
>          order = form.save(commit=False)
>          order.owner = request.user
>          order.save() # << breaks
> 
> I get the following error:
> 
> AttributeError at /order/2/edit
> 'ValuesQuerySet' object has no attribute 'field_names'
> 
> Trace: http://paste.pocoo.org/show/147298/
> 
> I can see that during the .save() a .filter() is executed, but I have now 
> clue why. My filter() (on a subclassed manager):
> 
>      def filter(self,  **kwargs):
>          owner = kwargs.get('owner')
>          if owner is None:
>              print 'Woops, no owner given for filter'
>              return super(UserFilteredManager, self).get_empty_query_set()
>          else:
>              return super(UserFilteredManager, self).filter(**kwargs)
> 
> Is the filter() execution by the .save() method correct/needed? And where 
> can I tell it to give an owner parameter or to use my 'true_filter()'
> 
> Please advice.
> 
> Thanx a lot.
> 
> Regards,
> 
> Gerard.
> 
> 


-- 
self.url = www.gerardjp.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