#24613: Documentation Note for defer might need an example.
--------------------------------------+--------------------
     Reporter:  Naddiseo              |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Documentation         |    Version:  1.8
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 The paragraph in the note section of the `defer` documentation is not
 immediately obvious to what it's implying. My understanding is that it's
 suggesting that one can use two django models to load data from a single
 database table, is that the only implication, or is there another?

 I think adding an example would help to clarify what exactly is meant by
 the paragraph.

 This is what I think it means:

 {{{#!python

 class MyCommonlyUsedModel(models.Model):
     class Meta:
         managed = False
         db_table = 'app_largetable'
     f1 = models.Field(...)
     f2 = models.Field(...)

 class MyUsuallyDeferredFieldsModel(models.Model):
     class Meta:
         managed = False
         db_table = 'app_largetable'
     deferred_f3 = models.Field(...)
     deferred_f4 = models.Field(...)

 # A model that allows the migrations framework to also manage the table
 # Not sure if this actually works, but would allow for a more DRY approach
 class MyManagedModel(MyCommonlyUsedModel, MyUsuallyDeferredFieldsModel):
     class Meta:
         managed = True
         tb_table = 'app_largetable'

 }}}


 If the above example is acceptable as an example - and is actually what
 the note is about - I don't mind creating a PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/24613>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.02f924a51446d2cc90cb19afdef6a7a0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to