Archive week beginning on monday
A modified version of the archive week generic view to make weeks start on mondays.
- standard
- archive
- week
- monday
- iso
A modified version of the archive week generic view to make weeks start on mondays.
Directive for inserting images using photolouge in django. Usage: Just make a .py with this code and import it in some apps models.py Or make a custom formatter with django-template-utils.
A tag that parses args ang kwargs like the url tag. {% get_with_args_and_kwargs somevar,"sometext",kwarg1=someothervar %}
Code example queryset = Event.objects.all().select_related('user', 'category') queryset = comments_extra_count(queryset)
Usage: from django.db import models from imagevariations.fields import ImageVariationsField, Thumbnail class Image(models.Model): name = models.CharField(max_length=20) image = ImageVariationsField(upload_to='testimages', variations=(Thumbnail,) ) How to use in templates: Use the lowercase name of the image variation class. {{ object.image.variations.thumbnail.url }} By default all image variations will use the same storage backend as the field but can be replaced per variation by setting self.storage on the variation class.
Usage: from yourapp.fields import CheckBoxManyToMany from django.db import models class Weekday(models.Model): name = models.CharField() def __unicode__(self): return self.name class EventWithWeekday(models.Model): weekdays = CheckBoxManyToMany(Weekday)
s = Scaffold(SomeForm) print s.as_dl()
Example for provided django-tagging url snippet: {% paginator 4 image_tag_paged tag=tag page %} links then equals {% url image_tag_paged tag=tag,page=n %}
A way to make form_for_model more customizable.
A serializer that handles dicts with querysets and model instances, nice to use if you have a paginator context. paginate_by = 8 paginator = ObjectPaginator(queryset, paginate_by) page = request.GET.get('page', 1) try: page = int(page) object_list = paginator.get_page(page - 1) except (InvalidPage, ValueError): if page == 1 and allow_empty: object_list = [] else: raise Http404 result = { 'object_list' : object_list, 'is_paginated': paginator.pages > 1, 'results_per_page': paginate_by, 'has_next': paginator.has_next_page(page - 1), 'has_previous': paginator.has_previous_page(page - 1), 'page': page, 'next': page + 1, 'previous': page - 1, 'pages': paginator.pages, 'hits' : paginator.hits, } serialize(result, ensure_ascii=False)
Easy way to move data via XML dump in PhpMyAdmin
fivethreeo has posted 11 snippets.