Click here to check if anything new just came in.
February 02 2010
django-google-analytics - Project Hosting on Google Code
A simple django application that eases Google Analytics integration with your Django projects by sapeginNovember 17 2009
ExtendibleAdmin class
A generic base class for extending ModelAdmin views. This can be used likewise:
def myview(self, request, object_id):
obj = self._getobj(request, object_id)
< do something >
def get_urls(self):
urls = super(MyAdmin, self).get_urls()
my_urls = patterns('',
url(r'^(.+)/myview/$',
self._wrap(self.myview),
name=self._view_name('myview')),
)
return my_urls + urls
Remove named field from fieldsets
This snipped removes a specific field from the fieldsets. This is very useful to leave a field 'out' in the admin, likewise:
def get_fieldsets(self, request, obj=None):
fieldsets = super(BlaModelAdmin, self).get_fieldsets(request, obj)
if not request.user.has_perm('change_blah'):
remove_from_fieldsets(fieldsets, 'blah')
July 24 2009
Setting up a new remote git repository
To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.May 05 2009
Python Calendar wrapper template tag
This tag gives you an iterable Python Calendar object in your template namespace. It is used in the django-calendar project.
Use it as follows in your template:
{% get_calendar for <month_number_or_variable> <year_or_variable> as calendar %}
<table>
<tr>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th ...
April 16 2009
Soft hyphenation () template filter using PyHyphen
This template filter is meant to insert soft hyphens (­ entities) in text whever it can. For this is relies on a recent checkout of the PyHyphen interface to the hyphen-2.3 C library, which is also used by Mozilla and OpenOffice.org.
It takes two optional parameters: the language ...
December 23 2008
Django Guestbook application
The other day I've written a pluggable guestbook application for Django. It is fully functioning and loosely based on the Django comments contrib. Currently, I am using it on a small website (hansenpaul120.nl, Dutch) but more websites are soon to follow.
Current features:
- Fully translatable (currently, only English and Dutch are available)
- Fully integrated with the admin
- Some barebone templates are supplied
More features will be added as soon as I am going to use this in more sites, or when you do so. Some of these features may include:
- (Better) documentation.
- Integration with Django syndication
- Integration with Django email confirmation
- Integration with Django User authentication
Installation should be pretty straight-forward for anyone who's installed a Django app before:
- Get the source from GitHub by either cloning or downloading the archive.
- Link the guestbook app into your project's tree:
ln -s django-guestbook/guestbook guestbook
- Add the app to your
INSTALLED_APPSinsettings.py:
INSTALLED_APPS = (
...
'django.contrib.admin',
'guestbook',
) - Add the guestbook app to your
urls.py:
urlpatterns = patterns('',
...
(r'^guestbook/', include('guestbook.urls')),
) - Update the database structure:
./manage.py syncdb
- You're done! Go and test your app by running:
./manage.py runserver
Feel free to provide feedback on the current state of the project, and perhaps on what features you might like. In any case, expect a more complete HOWTO here.
The app's source code can be found here on GitHub and the source for the hansenpaul120.nl website is here. The latter might be a good place to see how the guestbook application can be used.
October 12 2008
Default to current/all sites in admin
This code sets the default sites for a sites ManyToMany property of a model to Site.objects.all().
This could easily be changed to Site.objects.get_current() to use the current site as default.
Surely, we should be able to use default=[Site.objects.get_current() in the model but apparently ...
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
