Changes between Version 9 and Version 10 of new_meta_api


Ignore:
Timestamp:
Jul 11, 2014, 6:29:15 AM (10 years ago)
Author:
pirosb3
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • new_meta_api

    v9 v10  
    140140options are possible here, although some will have no effect (such as include_proxy combined with data or m2m by itself).
    141141get_fields is internally cached for speed and a recursive function that collects fields from each parent of the model.
    142 An example of every (sane) combination of flags will be available in the model_meta test suite that I will ship with the new API
     142An example of every (sane) combination of flags will be available in the model_meta test suite that I will ship with the new API.
    143143
     144{{{
     145    >>> User._meta.get_new_fields() # Only data by default
     146    (<django.db.models.fields.AutoField: id>,
     147     <django.db.models.fields.CharField: password>,
     148     <django.db.models.fields.DateTimeField: last_login>,
     149     <django.db.models.fields.BooleanField: is_superuser>,
     150     <django.db.models.fields.CharField: username>,
     151     <django.db.models.fields.CharField: first_name>,
     152     <django.db.models.fields.CharField: last_name>,
     153     <django.db.models.fields.EmailField: email>,
     154     <django.db.models.fields.BooleanField: is_staff>,
     155     <django.db.models.fields.BooleanField: is_active>,
     156     <django.db.models.fields.DateTimeField: date_joined>)
     157
     158    >>> User._meta.get_new_fields(data=False, related_objects=True) # only related_objects
     159    (<RelatedObject: admin:logentry related to user>,)
     160
     161    >>> User._meta.get_new_fields(data=False, related_objects=True
     162                                  include_hidden=True) # only related_objects including hidden
     163    (<RelatedObject: auth:user_groups related to user>,
     164     <RelatedObject: auth:user_user_permissions related to user>,
     165     <RelatedObject: admin:logentry related to user>)
     166}}}
Back to Top