Posts Tagged ‘django’

Fix for JPEG upload problem in Django in virtualenv

December 2nd, 2009

I have been busy modifying Django‘s models for a project to include a field for uploading an image and was testing the model using Django’s Admin interface when I suddenly got this error:

Upload a valid image. The file you uploaded was either not an image or a corrupted image.

Read more…

Author: Cyril Pauya Categories: programming Tags: , , , , ,

Django in Production

October 20th, 2009

Here are some quick tips when moving your Django site into production.
Read more…

Author: Cyril Pauya Categories: Software, programming Tags: ,

Use multiple Django versions for development

September 23rd, 2009

To use multiple Django versions for development, you will need virtualenv. Virtualenv is a sandbox that allows you to use different versions of Python in your development machine.  It is a tool to create isolated Python environments.

I have been using Django 1.1 beta on my projects.  Just recently, I needed to use Django 1.0 for a new project.  Of course there were major differences from Django 1.0 versus Django 1.1 which could cause headaches.

Read more…

Author: Cyril Pauya Categories: programming Tags: , , ,

Django Editor

August 27th, 2009

Here is an update to my previous Django Editor blog.

These are the available django editors installed in my Ubuntu operating system so far:

Read more…

Author: Cyril Pauya Categories: Software Tags: , , ,

Bug in myListBoard.Com tags

July 30th, 2009

I found a bug in the tagging feature of  The bug manifests as you create a new list using a tag that has been used for more than 6 or more times in your other lists.

Request Method: GET
Request URL: http://localhost:8000/users/cy/
Exception Type: TemplateSyntaxError
Exception Value: Caught an exception while rendering: invalid literal for int() with base 10: ”
Exception Location: /usr/local/lib/python2.6/dist-packages/django/template/ in render_node, line 81
Python Executable: /usr/bin/python

Here is the code in my template that causes the error:

<a class="tagcloud" style="font-size: {{ tag.font_size|add:"12" href="/users/{{ userviewed }}/lists/tagged/{{ }}/">{{ }}</a>

The culprit in the above code is the statement: {{ tag.font_size|add:"12" }}, the font_size property of the tag object doesn’t seem to return a value that could be safely converted to a number.

I have been using to implement tagging in

I think the problem is with the steps option on the tagging_tags tags of the django-tagging application which defaults to the value of 7. When a list is created using a tag that has been used 6 times, there might some math in the django-tagging application that I didn’t bother to look into.

So being a lazy coder, I instead replaced the culprit code with this:
{{ tag.count|add:"12" }}.

That solved the problem and the tags still grows as the number of usage grows too. After uploading my changes, the site seems to work okay even with many uses of the same tag on a list.

I might be missing something with the use of the font_size property but hey is already in production, so any quick solution is acceptable at this time. :)

Author: Cyril Pauya Categories: projects Tags: , ,