Code

Opened 7 years ago

Last modified 2 years ago

#5372 new New feature

[newforms-admin] - caching of sql query for inlines

Reported by: anonymous Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Normal Keywords: nfa-someday newforms, admin, inlines
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description


Attachments (3)

newforms-admin-query-caching.diff (1.0 KB) - added by anonymous 7 years ago.
caching-of-sql-queries.diff (694 bytes) - added by Petr Marhoun <petr.marhoun@…> 7 years ago.
formset_refactor_3.diff (47.2 KB) - added by brosner 6 years ago.
fixes the real problem. formsets are declarative like forms. 85% done, but attaching to get feedback.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by anonymous

comment:1 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by Petr Marhoun <petr.marhoun@…>

I have these models:

from django.db import models

class Category(models.Model):
    name = models.CharField(max_length=255)

class Library(models.Model):
    name = models.CharField(max_length=255)
    
class Book(models.Model):
    name = models.CharField(max_length=255)
    category = models.ForeignKey(Category)
    library = models.ForeignKey(Library)
    

And I register them:

class BookInline(admin.TabularInline):
    model = Book
    extra = 10
    fields = 'name', 'category',

class LibraryOptions(admin.ModelAdmin):
    inlines = BookInline,

admin.site.register(Library, LibraryOptions)

I have ten rows for books in library add form. Each row needs its own sql query to get list of categories. I think that the query should be cached.

It is caching in one request, not between requests. New forms and new formsets are created in each request.

Changed 7 years ago by Petr Marhoun <petr.marhoun@…>

comment:3 Changed 7 years ago by Petr Marhoun <petr.marhoun@…>

New patch added - the old one doesn't work after [6080].

comment:4 Changed 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:5 Changed 7 years ago by tekNico

  • Needs documentation set
  • Needs tests set
  • Triage Stage changed from Ready for checkin to Design decision needed

The discussion about this one did not reach a consensus:

http://groups.google.com/group/django-developers/browse_thread/thread/7aaa8a5297e3c4d5

therefore I'm taking its triage stage back.

comment:6 Changed 6 years ago by brosner

  • Keywords nfa-someday added
  • Triage Stage changed from Design decision needed to Accepted

This ticket isn't critical to merge of newforms-admin. Tagging with nfa-someday. This functionality can be accomplished by the user, but I personally feel it needs to be in Django.

Changed 6 years ago by brosner

fixes the real problem. formsets are declarative like forms. 85% done, but attaching to get feedback.

comment:7 Changed 3 years ago by gabrielhurley

  • Severity set to Normal
  • Type set to New feature

comment:8 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:9 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.