Code

#19304 closed Uncategorized (invalid)

the mistake of the QuerySet Caching

Reported by: rex@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords: QuerySet Caching, Models get
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

hi Django Team,

may be I get some problem by following to django docs, in programe the Models logic,
the docs notice that get method get() https://docs.djangoproject.com/en/dev/ref/models/querysets/#get do not use a cache (see Caching and QuerySets). Rather, they query the database each time they're called. but when in fact I check the source /usr/local/lib/python2.7/dist-packages/django/db/models/manager.py line 130

def get(self, *args, kwargs):

return self.get_query_set().get(*args, kwargs)

the method is use the cache of the querySet , and I need some help to know How do I use a query get() DO NOT Use a Cache, thanks many, btw sorry about my English.

Rex

Attachments (0)

Change History (1)

comment:1 Changed 20 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

No, get_query_set() is only creating a new QuerySet instance.

Please don't use the ticket system for usage question (see TicketClosingReasons/UseSupportChannels).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.