Re: [Django] #9861: Requests make feature: Using a subset of fields on the Model

2008-12-15 Thread Django
#9861: Requests make feature:  Using a subset of fields on the Model
---+
  Reporter:  freeren   | Owner:  nobody 
  
Status:  closed| Milestone: 
  
 Component:  Database layer (models, ORM)  |   Version:  SVN
  
Resolution:  wontfix   |  Keywords:  Using a 
subset of fields on the Model
 Stage:  Unreviewed| Has_patch:  0  
  
Needs_docs:  0 |   Needs_tests:  0  
  
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => wontfix
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 This isn't a common enough requirement to justify all the extra code it
 would require. The solution is to just create a separate model that
 contains the fields you need and set the `Meta.db_table` attribute to
 point to the other model's database table. You'll also need the support
 from #3163 (unless you avoid running syncdb for that app), but that should
 be in before Django 1.1 is released.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #9861: Requests make feature: Using a subset of fields on the Model

2008-12-15 Thread Django
#9861: Requests make feature:  Using a subset of fields on the Model
---+
 Reporter:  freeren|   Owner:  nobody
   Status:  new|   Milestone:
Component:  Database layer (models, ORM)   | Version:  SVN   
 Keywords:  Using a subset of fields on the Model  |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 The classes inheritance are useful when you want to put some common
 information into a number of other models.


 {{{
 class FlatPage(models.Model):
 url = models.CharField(_('URL'), max_length=100, db_index=True)
 title = models.CharField(_('title'), max_length=200)
 content = models.TextField(_('content'), blank=True)
 enable_comments = models.BooleanField(_('enable comments'))
 template_name = models.CharField(_('template name'), max_length=70,
 blank=True,
 help_text=_("Example: 'flatpages/contact_page.html'.
 If this isn't provided, the system will use 'flatpages/default.html'."))
 registration_required = models.BooleanField(_('registration
 required'), help_text=_("If this is checked, only logged-in users will be
 able to view the page."))
 sites = models.ManyToManyField(Site)


 class SubFlatPage(models.Model):
 url = models.CharField(_('URL'), max_length=100, db_index=True)
 title = models.CharField(_('title'), max_length=200)
 content = models.TextField(_('content'), blank=True)
 sites = models.ManyToManyField(Site)
 other = models.CharField(_('other'), max_length=200)
 }}}


 Using a subset of fields on the model (abstract=True OR abstract=False )
 like :
 [http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a
 -subset-of-fields-on-the-form]


 # Use the fields attribute of the Model's inner Meta class. This
 attribute, if given, should be a list of field names to include in the
 SubModel.


 # Use the exclude attribute of the Model's inner Meta class. This
 attribute, if given, should be a list of field names to exclude from the
 SubModel.


 # Can append a little other fields.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---