Login

Tag "properties"

Snippet List

Field List Tag

Tag for iterating through the fields of an object from a template. The tag is passed two string arguments, the name of the model to use (which is then looked up in the context dictionary), and the format string. The format string should include two string place holders. The tag will output each field name and value according to the format string supplied.

  • properties
  • field
  • iterate
Read More

Make tags easier with properties

Jonathan Buchanan's [Django tagging](http://code.google.com/p/django-tagging/) application is the best thing since sliced bread, and makes adding generic tagging to any model trivially easy. But you can make it just a tiny bit easier to use by setting up a property on your model for handling the tags. Once you've set this up, you can access and set tags in a fairly natural way: >>> obj = MyModel.objects.get(pk=1) >>> obj.tags = 'foo bar' >>> obj.tags [<Tag: foo>, <Tag: bar>] And remember that `obj.tags` will return a `QuerySet`, so you can do filtering on it.

  • tags
  • properties
Read More

2 snippets posted so far.