Skip to content

Instantly share code, notes, and snippets.

@pydanny
Created March 17, 2011 01:32
Show Gist options
  • Select an option

  • Save pydanny/873695 to your computer and use it in GitHub Desktop.

Select an option

Save pydanny/873695 to your computer and use it in GitHub Desktop.
>>> f = Feature.objects.get(id=1)
>>> f
<Feature: cms : 508 compliant?>
>>> f.grid
<Grid: CMS>
>>> f.title
u'508 compliant?'
>>> f.description
u'See http://webaim.org/standards/508/checklist'
>>> f.package
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'Feature' object has no attribute 'package'
<django.db.models.fields.related.ManyRelatedManager object at 0x102f9d490>
>>> f.grid.packages.all()
[<Package: Django CMS>, <Package: Django page CMS>, <Package: LFC - Lightning Fast CMS>, <Package: Merengue>, <Package: Mezzanine>, <Package: Philo>, <Package: PyLucid CMS>, <Package: django-gitcms>, <Package: django-simplepages>, <Package: djpcms>, <Package: ella>, <Package: feinCMS>, <Package: gnocchi-cms>]
>>>
>>> dir(f)
['DoesNotExist', 'Meta', 'MultipleObjectsReturned', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__metaclass__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', '_base_manager', '_collect_sub_objects', '_default_manager', '_deferred', '_get_FIELD_display', '_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', '_get_pk_val', '_get_unique_checks', '_grid_cache', '_meta', '_perform_date_checks', '_perform_unique_checks', '_set_pk_val', '_state', 'clean', 'clean_fields', 'created', 'date_error_message', 'delete', 'description', 'element_set', 'full_clean', 'get_next_by_created', 'get_next_by_modified', 'get_previous_by_created', 'get_previous_by_modified', 'grid', 'grid_id', 'id', 'modified', 'objects', 'pk', 'prepare_database_save', 'save', 'save_base', 'serializable_value', 'title', 'unique_error_message', 'validate_unique']
>>> f.grid.packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment