django

Should I use a fieldset for this?

I have a queryset. I'm trying to display a feedback form for each of items in the queryset. What's a good way to approach this? Attach the model to a fieldset and then iterate through the forms in a fieldset, displaying the model information? Or loop through both the queryset and fieldsets separately in the template? ...

Ping FeedBurner in Django App

I have a django site, and some of the feeds are published through FeedBurner. I would like to ping FeedBurner whenever I save an instance of a particular model. FeedBurner's website says to use the XML-RPC ping mechanism, but I can't find a lot of documentation on how to implement it. What's the easiest way to do the XML-RPC ping in dja...

What does formatResult and formatItem options do in JQuery Autocomplete?

Am a bit confused here, what does the formatResult and formatItem do in the JQuery Autocomplete plugin? I have a function that is returning a comma separated string (from Django), but my autocomplete function is unable to split the string into individual entries/rows, how can i achieve this using autocomplete functions? e.g the return...

How to Modify Choices of ModelMultipleChoiceField

Let's say I have some contrived models: class Author(Model): name = CharField() class Book(Model): title = CharField() author = ForeignKey(Author) And let's say I want to use a ModelForm for Book: class BookForm(ModelForm): class Meta: model = Book Simple so far. But let's also say that I have a ton of ...

Getting started with Django-Instant Django

I've been trying to get Django running and when going through the intro to projects it seems that I keep having trouble when I get to the 'sync database' section. When using InstantDjango this doesn't seem to be as much of a problem. My question is, can one just do Django development with the InstantDjango program or do you really need ...

Anybody who have used Django and JQuery Autocomplete?

Is there anybody out there who have used Django and JQuery Autocomplete? Am stuck on this and i will highly appreciate to see how someone else has done this! especially without using the AutocompleteWidget! Gath ...

"ImportError: No module named dummy" on fresh Django project

I've got the following installed through MacPorts on MacOS X 10.5.6: py25-sqlite3 @2.5.4_0 (active) python25 @2.5.4_1+darwin_9+macosx (active) sqlite3 @3.6.12_0 (active) python25 is correctly set as my system's default Python. I downloaded a fresh copy of Django 1.1 beta (I have the same problem with 1.0 and trunk, though) and instal...

Customize/remove Django select box blank option

I'm using Django 1.0.2. I've written a ModelForm backed by a Model. This model has a ForeignKey where blank=False. When Django generates HTML for this form it creates a select box with one option for each row in the table referenced by the ForeignKey. It also creates an option at the top of the list that has no value and displays as ...

Why is my send_mail() command not working in Django?

I put the following in my settings.py file. The email address there is a test one. I found the email settings from Webfaction's site: EMAIL_HOST = 'smtp.webfaction.com' EMAIL_HOST_USER = 'hekevintran_test' EMAIL_HOST_PASSWORD = 'testpass' EMAIL_PORT = 465 EMAIL_USE_TLS = True This is what my file looks like: from django.core.mail ...

Fetching ManyToMany objects from multiple objects through intermediate tables

Is there an easy way to fetch the ManyToMany objects from a query that returns more than one object? The way I am doing it now doesn't feel as sexy as I would like it to. Here is how I am doing it now in my view: contacts = Contact.objects.all() # Use Custom Manager Method to Fetch Each Contacts Phone Numbers contacts = PhoneNumber.obje...

Django Filters - or?

How would I do an "or" in a django filter. Basically, I want to be able to list the items that either a user has added (they are listed as the creator) or the item has been approved so I basically need to select item.creator = owner or item.moderated = False How would I do this in django (preferably with a filter/queryset) ...

How to pass an array in Django to a template and use it with JavaScript

I want to pass an Array to a template and afterwards use it via JavaScript. In my views.py I have: arry1= ['Str',500,20] return render_to_response('test.html', {'array1': arry1}) var array1 = {{ array1 }}; but when I visit the website it puts out: var array1 = [_39;Str_39;,500,20]; (without the _ sign (otherwise stackoverflow change...

Can InstantDjango be Used Rather than the Normal Installation

Is it possible to do development just using Instant Django? Do I need to have the normal version working or can I just use this instant version? Has anyone used it? ...

Django: Adding additional properties to Model Class Object

This is using Google App Engine. I am not sure if this is applicable to just normal Django development or if Google App Engine will play a part. If it does, would you let me know so I can update the description of this problem. class MessageModel(db.Model): to_user_id = db.IntegerProperty() to_user = db.StringProperty(multiline=...

Unable to make a domain redirection in Django from site.com to www.site.com

I get the following message when I browse to site.com 500 - Internal Server Error I get my 404 error message when I browse to www.site.com which indicates my site is alive. How can you make a domain redirection without .htaccess by Django from site.com to www.site.com? My urls.py from django.conf.urls.defaults import * ...

A Question About Nested Collections in Django and Query Efficiency

I see a lot of answers like this one: Printing a list of persons with more than one home each home with more than one I have tried that answer with similar models and it seems like a terribly inefficient way of doing this. Each iteration seems to make a separate query sometimes resulting in thousands of queries to a database. I realize...

Django RSS Feed Wrong Domain

I have an RSS feed that I'm setting up on my new site using Django. Currently I have an RSS feed being served per user, rather than just one big nasty, global RSS feed. The only problem is that the links that are returned by the RSS feed have the completely wrong domain name in the links. The end path is perfectly correct, and the get_ab...

How can I easily mark records as deleted in Django models instead of actually deleting them?

Instead of deleting records in my Django application, I want to just mark them as "deleted" and have them hidden from my active queries. My main reason to do this is to give the user an undelete option in case they accidentally delete a record (these records may also be needed for certain backend audit tracking.) There are a lot of for...

email whitelist/blacklist in python/django

Hello, I am writing a django app that keeps track of which email addresses are allowed to post content to a user's account. The user can whitelist and blacklist addresses as they like. Any addresses that aren't specified can either be handled per message or just default to whitelist or blacklist (again user specified). Here are the dj...

Django models - how to filter out duplicate values by PK after the fact?

I build a list of Django model objects by making several queries. Then I want to remove any duplicates, (all of these objects are of the same type with an auto_increment int PK), but I can't use set() because they aren't hashable. Is there a quick and easy way to do this? I'm considering using a dict instead of a list with the id as th...