Don’t we all get confused by unicode encoding sometimes? Especially you wouldn’t expect this kind of error to happen in django admin. The problem is actually not in the admin section, the culprit is __unicode__ method in your model. when you have a unicode function like this:
It is actually returning a ASCII string(which… Read More »
I have a custom user model as below:
subscribe_newsletters = models.BooleanField(default=True)
old_id = models.IntegerField(null=True, blank=True)
old_source = models.CharField(max_length=25, null=True, blank=True)
And using the builtin UserAdmin
While editing the user record works fine, but when I add a user, I get the following error
relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...
After some digging around and found this https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#custom-users-and-the-built-in-auth-forms The culprit is a function clean_uesrname inside UserCreationForm inside django.contrib.auth.forms.py A few tickets… Read More »
After a month’s effort we’ve finally released the first phase of the new NZ weddings website. Check it out http://newzealandweddings.co.nz The new site is written in django framework, a lot of functionalities such as the editorial section was ‘borrowed’ from the existing infrastructure which powers the Stoppress and the Idealog websites.
I think it’s necessary to create a video to demonstrate how quickly web application development can be. Enjoy!
TinyMCE https://code.google.com/p/django-tinymce/ Want to add WYSIWYG editor to your TextFields? This app will sort you right out, basically this app will provide a HTMLField for you to use instead of just plain TextField and it will automatically render a rich text editor for you. It does require some basic configuration, here is a sample config in… Read More »
https://github.com/django-mptt/django-mptt MPTT stands for Modified Preorder Tree Traversal, which really means for working with parent child relationships, this app will do some work under hood to make travelling the relationship much quicker and easier, such as some API methods like get_ancestors() etc. Some good usage example would be, category hierarchy, family tree etc.
South A data migration tool, what it really means is if you change the data model and want to keep the data in there, you will need this app. At first I thought it’s tedious for early stage development when data isn’t important (why not just syncdb??), but once I realised it’s actually quicker to… Read More »
First download and install mysql for Mac OSX Install virtualenv, create a virtualenv and activate it Pip install mysql-python, and you will see an error “EnvironmentError: mysql_config not found” Find the mysql_config by running “sudo find / -name ‘mysql_config’” Go to your /path to virtualenv/build/mysql-python Edit site.cfg Uncomment this line “#mysql_config = /usr/local/bin/mysql_config” and change… Read More »
We have been working on a python/django project which is SOA oriented, all sites(systems) are internal and communications are done via http restful api requests. Our setup share the same set of memcache servers to cache data individually on each sub site(system). Often when site A wants data from site B, site A makes a… Read More »
I came across this python performance tips article this afternoon and found it very interesting. Will definitely start using those tips in my next project.