Skip to content
Advertisement

Tag: django

How to sort collections based on current user locale on a Django site

I need to sort a collection of objects by a utf-8 string property (built via ActiveRecord). Currently the code is sorting by ASCII order via the order_by method, however this needs to be changed to locale.strcoll. Unfortunately using the built in locale functionality requires changing the culture for the entire application, not just the current request. I’ve looked at the

Django DateTimeField auto_now_add not working

In one of the model i have set one timestamp field as follows: While in shell i am able to create a obj and save it, however in my application it is raising a exception that created_datetime field cannot be null. Confused where things went wrong!! How to reslove it. Answer You can do something like this

Generating PDFs from SVG input

I am trying to generate a PDF from a SVG input file with Python in a Django application. I have already found 2 working solutions: cairo+rsvg and imagemagick but they both have one problem: They have some strange dependencies that I do not want to install on a server, for example DBUS and GTK. So I am asking for another

how to open url in new tab from django?

i have to open the result page using render_to_response on a new tab Answer Django is server-side, opening in a new tab is client-side. So use an <A> with a target=”_blank” http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=target%3Dblank But of course spawning new windows/tabs is annoying for the user, so try not to do that after all.

Why doesn’t Pydev find Django?

I have Django installed. I also have django-admin.py in my python-2.7 folder. I can import django using my Python shell (DreamPie). But I can’t create a new Django project in Pydev. When trying to create a new Pydev Django Project (choosing python2.7 as the interpreter) I receive the following error message: I went to the link in the message and

Advertisement