I have a queryset with .extra call where I do something like this,

self.get_query_set().extra
.......
tables=['news_topic as permission_table']
..........

Pre qs-rf, the values in tables were not being escaped and so this was
working, with qs-rf the value in tables is escaped, so my code fails.

http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none

tells me,
[1]First, see if you can get by without including the extra table and
use the one already in the query. [2]If that isn’t possible, put your
extra() call at the front of the queryset construction so that your
table is the first use of that table. [3]Finally, if all else fails,
look at the query produced and rewrite your where addition to use the
alias given to your extra table. The alias will be the same each time
you construct the queryset in the same way, so you can rely upon the
alias name to not change.

1. I need this table an extra time.
2. I do not understand this.

My code is somethings like this,

class LinkManager(models.Model):
  def get_query_set():
     super(LinkManager, self).get_query_set().extra(....)

  def get_query_set_with_user(self, user):
      return self.get_query_set().extra(....)

The erros comes in get_query_set_with_user, and I have extra call in
get_query_set(), so I guess I can not do this.

3. I guess I can do this, but it seems sort of fragile. Would it not
be better to have an option to alias?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to