This is a copy of [snippet 654](http://djangosnippets.org/snippets/654/), modified to allow dynamic MEDIA_URL, as you might need that for SSL in combination with [snippet 1754](http://djangosnippets.org/snippets/1754/).
This is a template filter to enable the use of the MEDIA_URL setting in content from the
flatpages database table. It searches for {{ MEDIA_URL }} and replaces it with the current MEDIA_URL added by a context processor.
Note: To set up, drop the above code into a file called media_url.py in your templatetags directory in one of your INSTALLED_APPS, and add the filter to your flatpages template like so:
{% load media_url %}
{{ flatpage.content|media_url:MEDIA_URL }}
The important code really is just setting up the base site to use jquery and then using the javascript function to show the calendar on a widget with the .vDateField class set. The DateField modeltype automatically gets the css class .vDateField when using ModelForms.
**Number format:** number/year
**Purpose:** When the user adds a new bill, the "number" field will be automatically filled with the appropriate number.
* The snippet automatically increments the bill number based in the highest number available. This is because in the use case, the user could start by *any* number, and we couldn't use the PK number (p.e. if the user first object number is 324/10, using the PK will convert it to 1/10)
**NOTE:** bill_type is a Boolean value to mark if the bill is outgoing or ingoing. Since we only need to mark the outgoing ones, we filter through this field.
This code defines a decorator that inform users of your site when the Google AppEngine data store is in read-only mode during maintenance periods.
Use it as a decorator on your views that require write access to the data store.
@requires_datastore_write
def update(request):
...
Create a `maintenance.html` Django template (or change the name in the code) with the message that the user will see, something like:
This application is currently in maintenance mode and some operations are temporarily unavailable.
Thanks for trying back later. Sorry for the inconvenience.
Workaround to stop formset_factory form being submitted completely blank. This will only allow form.is_valid() to return True if the first form has been filled in and validates.
Using this method you can combine form for standart django.contrib.auth.models.User model and for your project profile model. As now, ProfileForm can be used as usual, and it will also contain UserForm fields.
This widget can be imported in your forms.py file and used like so:
formfield = forms.ModelChoiceField(widget=SelectDropdownWidget, queryset=Model.objects.all())
The javascript is provided by [filament group's Scott and his jQueryUI Selectmenu](http://www.filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/). In addition to the javascript you will need [jQuery (the latest release is fine) and jQuery UI](http://jqueryui.com/). The convenient thing is that this widget will style to match whichever jQuery UI you've 'rolled' or selected, making it highly customizable!
Hopefully this helps others who wanted a nice widget with jQuery and were sad to find there were no nice default options, enjoy! :)
This widget can be imported in your forms.py file and used like so:
formfield = forms.ModelMultipleChoiceField(widget=MultiSelectWidget, queryset=Model.objects.all())
The javascript is provided by [Michael's Multiselect](http://github.com/michael/multiselect/tree/next). In addition to the javascript you will need [jQuery (the latest release is fine) and jQuery UI](http://jqueryui.com/). The convenient thing is that this widget will style to match whichever jQuery UI you've 'rolled' or selected, making it highly customizable!
Hopefully this helps others who wanted a nice widget with jQuery and were sad to find there were no nice default options, enjoy! :)
This is a XML-RPC server, that uses arguments in URLs and every dispatcher instance is prepared in memory during webserver run. It's good, for example, for securing XML-RPC server with hashed strings and there are a lot of similar use cases.
Usage:
from xmlrpclib import ServerProxy
server = ServerProxy('http://example.com/xmlr-rpc/%s/' % something, allow_none=True)
server.do_something(*args)
This module provides a middleware that implements a mechanism to
highlight a link pointing to the current URL.
Every link on the rendered page matching the current URL will be highlighted with a 'current_page' CSS class.
The name of the CSS class can be changed by setting `CURRENT_PAGE_CLASS` in the project settings.
Originally done by Martin Pieuchot and Bruno Renié, thanks @davidbgk and @samueladam for improvements & optimizations.
This is a simple calendar widget in Django 1.2 for Jalali Calendar usages. It actually sends a Gregorian value to server, so if you need further manipulations, you can use [GNU Jalali Calendar](http://home.gna.org/jalali-calendar/). You should also have [JalaliJSCalendar](http://farhadi.ir/works/jalalijscalendar) set up in your project.
Also posted on: [Django Jalali Calendar Widget](http://texscribbles.blogspot.com/2010/06/django-jalali-calendar-widget.html)