django

Django: Unbuffered mysql query

How can I NOT have the full result set from mysql copied into memory in django? I'm itterating over a BIG table which is blowing up my ram when the query copies. It seems that mysql uses SSCursor for this purpose, and I can do all that with the mysql low level interface, but is there a Django way to do it? ...

Django syncdb on SQL initial data using PostgreSQL yields "column ... does not exist"

Platform: Python 2.5, Django development root, PostgreSQL 8.4, Windows Vista Ultimate SP2. Procedure: Django Documentation, Release 1.0, link text, Section 34.2, Providing initial SQL data. CODE: models.py: class aisc_customary(models.Model): MTYPE = models.CharField(max_length=4, editable=False, ...

Is there any module that allows Django/Python to work with gnupg?

I was wondering if there's any django module, or in such case any python module, that will allow me to create my own application to manage the creation, administration, etc of GnuPG keys, as well as the ability to sign and encrypt documents through this application? If there's no such module, how can I do that? Thank you. ...

Django, custom tag... how?

Hi guys, i would like to make a django custom tag for display 10 entry title from the category where the user is reading a article... but how ill do?, i need to send the category from the actual entry... Any idea? Thanks ...

Django FormPreview - What is it for?

While looking across the Django documentation, I came across the FormPreview. The description says this: Django comes with an optional “form preview” application that helps automate the following workflow: “Display an HTML form, force a preview, then do something with the submission.” What is meant by "force a preview"? Wha...

django dateTimeWidget not showing up

Hi,django newbie here. I have an attempt of a registration page. It consists of text fields (name, username, password, etc) and a DateField (birthday). I'm trying to use a forms.DateTimeInput widget for the DateField, but when the page is rendered, nothing happens. Am i doing something wrong? Does this have something im overlooking? It...

Running Django from IDLE

I wish to test my django project form IDLE shell in windows. I run following commands from django.template import Template, Context t = Template('test template') but I get following error. Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> t = Template('test template') File "C:\Program Files\Python26\...

Django dynamic content in VPS environment - when do I need a queue?

I've got some Django content that I plan to host on a vps, web facing. It dynamically generates images that are cached to disk (regeneration is not often needed except (1)user changes content within image or (2) the layout is updated globally so all images need regeneration) right now when a user requests a view, it checks to see if what...

Django : debugging templatetags

How on earth do people debug Django templatetags? I created one, based on a working example, my new tag looks the same to me as the existing one. But I just get a 'my_lib' is not a valid tag library: Could not load template library from django.templatetags.my_lib, No module named my_lib I know that this is probably because of someth...

Django transaction management

I have a django project in which database values need to be updated fairly often on their own. There's a cronjob that runs to update these values in the database, but some of the operations require atomic transactions. Does anybody know how to make a model method be a complete transaction in django without going through views? Ideally, ...

How can I get the domain name of my site within a Django template?

How do I get the domain name of my current site from within a Django template? I've tried looking in the tag and filters but nothing there. ...

Ordering in the ManyRelatedManager object

I have a general question regarding the ordering in the ManyRelatedManager object. For example, There are two classes in my model: one is called Book for books and another is Author for authors. A many-to-many field is defined in class Book authors = models.ManyToManyField(Author) In database, the many-to-many relationship is de...

Django Dropdown Auto submit

Hee guys. I have a form with a dropdown for all companies. Now i want to display all the people that work for that company when the user changes the value in the company dropdown box without hitting the submit button on the form. Anybody have a good example for that? tks ...

Django Search dont bring word's with accent's

Hi guys, i have a simple search in my project, but my project is in Spanish , we have a lot of word with accents, and my search dont bring this word with accents.... there's any django /python function for this? view.py def search(request): categorias = Categoria.objects.filter(parent__isnull=True) # menu query = request.GET.ge...

overriding module caption names in django admin

By default, the admin models are grouped by the app, and the app name is in the caption (accounts, auth, etc.). How to override the name in the caption without writing the admin templates? ...

Making Django forms.DateField show use local date format

I'm trying to find an easy way to build forms which show dates in the Australian format (dd/mm/yyyy). This was the only way I could find to do it. It seems like there should be a better solution. Things to note: Created a new widget which renders date value in dd/mm/yyyy format Created new date field to prepend the locate date for...

Django: use archive_index with date_field from a related model

Hello (please excuse me for my ugly english :p), Imagine these two simple models : from django.contrib.contenttypes import generic from django.db import models class SomeModel(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField(_('object id')) content_object = generic.Generi...

How to markup form fields with <div class='field_type'> in Django

I wasn't able to find a way to identify the type of a field in a django template. My solution was to create a simple filter to access the field and widget class names. I've included the code below in case it's helpful for someone else. Is there a better approach? ## agency/tagutils/templatetags/fieldtags.py ##########################...

Use middleware or a custom template tag for infrequently changing snippet

I've got a small snippet that I want in my sidebar. The snippet will be visible on each page, and while cheap to fetch (about 50ms on my super-slow netbook!), will change so infrequently that I'd quite like to cache it (partly because I've yet to use Django's cache framework, and I'd like to learn). I'm not sure what the best way to go ...

Django: queryset filter for *all* values from a ManyToManyField

Hi (sorry for my bad english :p) Imagine these models : class Fruit(models.Model): # ... class Basket(models.Model): fruits = models.ManyToManyField(Fruit) Now I would like to retrieve Basket instances related to all fruits. The problem is that the code bellow returns Basket instances related to any fruits : baskets = Baske...