Actually the best way to handle this is to use built-in http://docs.haystacksearch.org/dev/searchqueryset_api.html#load-all
I just missed it while checking documentation and wrote this crappy snippet!
A FilterSpec that can be used to filter by taggit tags in the admin.
To use, simply import this module (for example in `models.py`), and add the name of your TaggableManager field in the
list_filter attribute of your ModelAdmin class.
**Your model:**
class TicketItem(models.Model):
hours = models.DecimalField(decimal_places=2, max_digits=6)
day = models.DateField()
order = models.ForeignKey(Order)
tickets = models.ManyToManyField(Ticket)
Now you want to auto save m2m fields in your forms.TicketItemCreateForm:
1. inherit from m2mForm-Class
2. define m2m_field(s)
**Example:**
class TicketItemCreateForm(m2mForm):
m2m_field = 'tickets'
class Meta:
model = models.TicketItem
Renders enclosing contents as it is. Useful to avoid tags conflict with certain javascript libraries (eg. jquery-tmpl.js, mustache.js)
Example usage:
`<script class="content-tmpl" type="text/x-jquery-tmpl">`
`{% alien %}`
`{{ tmpl(results) "#results .item-tmpl" }}`
`{% endalien %}`
`</script>`
This snippet is an improved version of the [ifusergroup](http://djangosnippets.org/snippets/1576/) tag that allows spaces in any of the group names. It also fixes a small bug where if a group didn't exist none of the subsequent groups would be checked.
Here's the python code to produce an admin related widget with the edit and delete link also.
* [RelatedFieldWidgetWrapper](http://djangosnippets.org/snippets/2562)
* [related-widget-wrapper.html](http://djangosnippets.org/snippets/2563)
* [related-widget-wrapper.js](http://djangosnippets.org/snippets/2564)
* [RelatedWidgetWrapperAdmin](http://djangosnippets.org/snippets/2565)
Here's the python code to produce an admin related widget with the edit and delete link also.
* [RelatedFieldWidgetWrapper](http://djangosnippets.org/snippets/2562)
* [related-widget-wrapper.html](http://djangosnippets.org/snippets/2563)
* [related-widget-wrapper.js](http://djangosnippets.org/snippets/2564)
* [RelatedWidgetWrapperAdmin](http://djangosnippets.org/snippets/2565)
Use this to send emails to your users, takes one template and renders it as html or text as needed.
Credits to
"""
Jutda Helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
lib.py - Common functions (eg multipart e-mail)
"""
MIT licence
I only removed the specific project parts and made it general to use.
The original project repository https://github.com/rossp/django-helpdesk/
Based on [http://djangosnippets.org/snippets/1697/](http://djangosnippets.org/snippets/1697/)
but improved with multiline fields, and unicode chars.
Also it generates an xls file, not a csv one.
Requires, pyExcelerator
*Usage:*
Add the code to your project, e.g. a file called actions.py in the project root.
Register the action in your apps admin.py:
from myproject.actions import export_as_xls
class MyAdmin(admin.ModelAdmin):
actions = [export_as_xls]
To enable "clean url" mode, install [django-pagination](http://code.google.com/p/django-pagination/),
then just add to settings.py
PAGINATION_CLEAN_URL = True
and replace '.../pagination/templatetags/pagination_tags.py' with follow, and so
add to 'pagination/templates/pagination/' folder
pagination_clean_url.html
file, with following code
**Note:**
in urls.py
should be like this:
url(r'^/foo/bar/\d*/?$', foobar_list_handle),