Django, Sphinx, and full-text search

This makes some interesting things possible. And it makes sense just looking at it. That’s even better.

Announcing django-sphinx 2.0.0 Full-text Search | David Cramer’s Blog

One of my tasks lately has been updating the django-sphinx
library to work with Sphinx 0.98, as it includes GIS components which
we have been wanting to possibly utilize [...]

Django blogging apps…

that are more or less ready to use. The list is at the following link.

Empty Thoughts: Django Blogging Apps
People ask about blogging apps for the Django platform all the time. I
have not investigated each and every one of these, but so far I still
feel pretty confident that not one of these is fully [...]

Bash and Django – working together

A note… definitely something to come back to.
Talk Funnel » Blog Archive » Django bash shell shortcuts

SmileyChris had a post up recently on setting up bash aliases for Django. He uses the classic alias command which works for one-line shortcuts. I got inspired to put mine up too, but if you want to [...]

Snippet to update Django tables to utf8

So you get the dreaded illegal mix of collations:
Pythoneer » Convert MySQL table to utf8
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
What do you do? Not too bad fortunately. And if you’re working with Django, it’s a little bit easier. Launch the shell with python manage.py shell. Then in the shell do something like [...]

Full-text search for Django

Just making a note…
Extending Django’s database API to include full-text search (Mercurytide)

A Django HttpRequest QueryDict is not your normal Python dict – i.e. getting ids from a friend request-form

Doesn’t work:
ids=request.GET['ids[]‘]
Does work:
ids=request.GET.getlist(‘ids[]‘)
A typical Facebook friend invite sends the ids to be invited to your site as an array in ‘ids[]‘. Normally, you can pull values out with just request.GET['key']. But since the value of this particular key is an array and not just a string, you can’t (at least I wasn’t able to) just [...]

Concat Django Querysets

Here is a good discussion on concatenating Django Querysets. Very helpful! It also introduced me to itertools. This leads to some other talk about itertools. Very interesting!
The jist though is like this:
How do you concatenate two querysets? – Django users | Google Groups
import itertoolsq1 = Model1.objects.all()q2 = Model2.objects.all()for thing in [...]

Django snippets to check http_referer

Django snippets: Referer-checking view decorators

Here are a couple of Django decorators for limiting access to a view based on the request’s HTTP_REFERER. Both raise a Django PermissionDenied exception if the referer test fails (or a referer simply isn’t provided).

The first, referer_matches_hostname, takes a hostname
(and port, if specified) and matches it against the referer’s. [...]

Working with field level permissions with Django

This might be useful but, buyer beware.
Django snippets: FieldLevelPermissionsAdmin
Have you ever needed to customize permissions, for example, allow only some fields for editing by some group of users, display some fields as read-only, and some to hide completely? FieldLevelPermissionsAdmin class does this for newforms-admin branch. Not tested well yet (>100 LOC!).

Neat little Facebook snippet for Django

You can use this to set up a Facebook User within you Django app. This of course uses the middleware which is optional as described here.
Django snippets: Little middleware that create a facebook user

Install **PyFacebook** package.

After make all steps in tutorial above, put this code in your [...]

Django, generic views, and setting the media url via a template context processor

So far I haven’t really used Django for “web sites”. It’s really been used as a data backend. Well the time has come for some web stuff. It’s set up to use a dev, staging, and production server. All is well and good. But each has a different media server. In Django, how do you [...]

Reduce Django facebook server load

So say you have a Facebook app and it runs on Django. Standard practice is to load the middleware. Middleware by default adds a bit of overhead. It’s needed for some bits but completely unnecessary for anything that doesn’t need it. This is one way to take it out if you feel the need for [...]

PyAMF flying high

More python/Flex goodness in the works in the future perhaps? I really like Python… learning all the time with my web2py friends. I’d love to be able to combine this with Flex. Looks like it’s getting easier and easier. Now to combine this with Orbited…
Ted On Flex: The AMF Revolution
The growth [...]

Export Django database to xml

Looking at this helps me understand more of what is going on internally with Django’s models. Using web2py is a bit more intuitive for getting some of this info so it’s probably not too hard to port the concept over… for a future exercise.
/home/siddhi: Export django database to an xml file
Export django database [...]