django

How to make Django slugify work properly with Unicode strings?

What can I do to prevent slugify filter from stripping out non-ASCII alphanumeric characters? (I'm using Django 1.0.2) cnprog.com has Chinese characters in question URLs, so I looked in their code. They are not using slugify in templates, instead they're calling this method in Question model to get permalinks def get_absolute_url(self)...

django request in template

Hi! I've enabled the django request processor TEMPLATE_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", ) Still i don't have to request variable available in templates. I've...

Django admin - inline inlines (or, three model editing at once)

Hi, I've got a set of models that look like this: class Page(models.Model): title = models.CharField(max_length=255) class LinkSection(models.Model): page = models.ForeignKey(Page) title = models.CharField(max_length=255) class Link(models.Model): linksection = models.ForeignKey(LinkSection) text = models.CharFiel...

How to use email instead of username for user authentication?

The authentication model provided along with Django is based on username. What to do to change the authentication based on email instead of username? To be more specific: With username authentication, to login user we do the following: user = authenticate(name,password) ....... login(request,user) What to write for the above sta...

Django working under IIS7

Hi all, has someone a detailed description (if any) of a working installation of Django on Windows under IIS7? Already looked at PyISAPIe, etc. (and relative sites, groups, forums) but all description are somewhat inaccurate and until now I've been unsuccesful. The apparently fastest solution(PyISAPIe) seems to have some bugs as from the...

how can I change the default language loaded in a project using pinax (django)

I'm working with the basic_project of Pinax and I need to change the default language of the application from english to french or to spanish I'd tried changing the variable LANGUAGE_CODE = 'es', but it remains in english, even the admin, so Im guessing this change does not have any effect at all. where can I continue looking for m...

Does anyone know about workflow frameworks/libraries in Python?

I'm searching for a workflow library/framework for Python. I'm astonished that there I cannot find anything which is simple and not attached to Zope/Plone. Does anyone know of an open-source, simple workflow library/framework. It's preferred to support Django, but not required. ...

how can I change(update) an existing avatar to a new one using Django modelform?

Hi, I encounter a problem. In my user models there is an atrrbution: user.avatar = ImageField ('avatar', upload_to=AVATAR_TEMP_DIR, blank=True, null=True) then i use a modelform as an create user form. And the avatar is uploaded corrcet. Which upload to AVATAR_TEMP_DIR, then I move the avatar into AVATAR_ORIGINAL_PATH and make user.avata...

Caching data from other websites in Django

Suppose I have a simple view which needs to parse data from an external website. Right now it looks something like this: def index(request): source = urllib2.urlopen(EXTERNAL_WEBSITE_URL) bs = BeautifulSoup.BeautifulSoup(source.read()) finalList = [] # do whatever with bs to populate the list return render_to_response('...

Django admin style application for Java

I'm looking for a web framework or an application in Java that does what Django admin does - provides a friendly user interface for editing data in a relational database. I know it's possible to run Django on Jython and that way achieve a somewhat Java-based solution, but I'd prefer something pure-Java to keep the higher-ups happy. ...

Django DB, finding Categories whose Items are all in a subset

I have a two models: class Category(models.Model): pass class Item(models.Model): cat = models.ForeignKey(Category) I am trying to return all Categories for which all of that category's items belong to a given subset of item ids (fixed thanks). For example, all categories for which all of the items associated with that catego...

How to use Dojo in my Django application?

How do I use Dojo in my Django application? Please show me comprehensive examples on how to do this. Any links to sample code for this combination will be appreciated NB: I also don't mind examples using Dojango. ...

django model structure for many to many relasionship based on third model

I currently have three models: class Request(models.Model): requester=models.CharField() dateRequested = models.DateField(auto_now=True) title= models.CharField(max_length=255) description = models.TextField() class RequestType(models.Model): requestType=models.CharField('Request Type', max_length=256) class Reques...

Does mod_wsgi (daemon) sites hand off content to apache to serve to the client?

I have Django deployed with mod_wsgi in daemon mode for apache2.2. So after Django churns out the content, does it hand off everything to apache from there to have it served in its optimised glory or is Django still somehow taxed in this serving step? ...

how to use django reverse a generic view?

Here is the question how do I use reverse for the generic view object_detail? If I use it like the following, the error message will be: NoReverseMatch at /comment/add/ Reverse for '' with arguments '()' and keyword arguments '{}' not found. in views.py: urlresolvers.reverse('django.views.generic.list_detail.object_detail') ...

Problem in Model inheritance when some elements are deleted

I use a snippet in http://www.djangosnippets.org/snippets/1034/ for my Model inheritance. It works fine at the first. However, after I delete some elements in database, the code works wrong. As I debug, I found that the problem is reside in the method: as_leaf_class. In the following code: if (model == Meal): return self return mode...

Paypal NVP API with Django

I am looking into using the paypal NVP API to allow users to pay on my website for a recurring subscription. I have a few questions about the requirements. Will my site have to meet the "PCI Compliance" stuff. I guess I will have to get an SSL certificate and is there anything else that is required or that I need to know about? ...

Optimal timestamp-based query in Django

What is the optimal query to obtain all the records for one specific day? In my Weather model, 'timestamp' is a standard DateTimeField. I'm currently using start = datetime.datetime(2009, 1, 31) end = start + datetime.timedelta(hours=23, minutes=59, seconds=59) Weather.objects.filter(timestamp__range=(start, end)) but wonder if there...

Django Template - New Variable Declaration

Let me preface by I am just starting Python so if this is really a simple question ^_^ I have a html file with the following content: {%for d in results%} <div class="twt"> <img src="{{ d.profile_image_url }}" width="48px" height="48px" /> <span> {{ d.text }} </span> <span class="date">{{ d.created_at }}</span> </div> {...

Unique constraint with 'ignore case'

How to specify custom constraint for Django model? Like that create table t ( login varchar(10), unique ( upper(login) ) ); ...