django

django unique for each date

Hello First of all let me show you my model: class ChannelStatus(models.Model): channel = models.ForeignKey(Channel,unique_for_date="date") date = models.DateField() platform = models.ManyToManyField(Platform) Right now, when I want to make an ChannelStatus entry, there cant be more than one entry which is t...

Alter Django admin change list title text

I am creating some custom views for the Django admin interface that use the standard change-list as an interim stage. This works fine, apart from the fact the change-list page H1 is 'Select object to change'. 'Change' is not the right verb for the action the user will be undertaking in my custom views. I have found the django.contrib.a...

List products by category in Django template

What's the best way to generate HTML which has a heading for each Category, and Products under that category in a Django template? I toyed with the idea of having a passing a dictionary, or an ordered list... ...

How do I populate the Django table django_site in a yaml fixture?

I'm trying to populate the django_site table in my test database with the following yaml content: - model: django.contrib.sites.site pk: 1 fields: domain: stackoverflow.com name: Stack Overflow - model: django.contrib.sites.site pk: 2 fields: domain: serverfault.com name: Server Fault I'm following the Django ...

Django without additional tables ?

Hi, is it possible to write Django apps, for example for internal/personal use with existing databases, without having the 'overhead' of Djangos own tables that are usually installed when starting a project ? I would like to use existing tables via models, but not have all the other stuff that is surely useful on normal webpages. The rea...

Django - Mac OSX Workflow - Questions on efficient development methodologies

Hi All, I am going to outline my workflow and I would like some suggestions on how to improve the efficiency of this. It seems right now a bit cumbersome and repetitive (something I hate), so I am looking for some improvements. Keep in mind I'm still new to django and how it works but I'm a pretty fluent coder (IMHO). So here goes......

How can Django projects be deployed with minimal installation work?

To deploy a site with Python/Django/MySQL I had to do these on the server (RedHat Linux): Install MySQLPython Install ModPython Install Django (using python setup.py install) Add some directives on httpd.conf file (or use .htaccess) But, when I deployed another site with PHP (using CodeIgniter) I had to do nothing. I faced some probl...

JQuery dynamic .load - works for 1 and not for the other??

UPDATE: Site is online http://qwickqual.com/memorial/create/ under "Memoria Media" -> Click on "Our Videos" and it loads the list of categories click on any sub category and it goes through the process below ---------------- end edit ---------------------------------- UPDATED DESCRIPTION OF ERROR: All code is based on <li> objects b...

Passing initial into Django's ModelFormSet

Hi All, I have a model formset that I need to pass the keyword initial in to (to have some initial values in the formset, such as date set to today). As far as I can tell, the queryset argument (which defaults to YourModel.objects.all()) overrides this ability for initial empty forms to be created. I specified the queryset as: YourModel...

Dynamic Dropdown list with actions

like 1 image says more than 1000 words. here is what I want to implement in a django webapp: http://bit.ly/1ocI0X Is a dynamic dropdown list with an action to add values to db and dynamicly added to self dropdownlist. Any hint would be appreciated. Tks. ...

Django - How to get only 2 object for a combination of fields with a queryset

If I have Model.objects.all() I want to get only one object for any content_object=foo, object_id=N. How can I do that? Say I am ordering by -datetime. If I can get only one object in the queryset for any content_type=foo, object_id=N ... it should be the latest.. How to specify that I only want 1 object for any combination of cont...

Many files upload in ImageField form - django problem

Hi! My problem is simple. I have template like this: <form enctype="multipart/form-data" action="{% url offers.views.add_offer %}" method="post"> <input type="file" name="image1" /> <input type="file" name="image2" /> <input type="submit" value="Add" /> </form> Model looks like that: class Image(models.Model): ...

Django-queryset get one object per field=foo

I have a basic FK to user, call it owner class Baz(models.Model): owner = models.ForeignKeyField(User) .... .... Now, with a queryset of Baz's, is there something that I can chain that will give me only one Baz per owner? ...

Django URL.py and the index

Hi guys, i want to know, what is the best way to write in the URL.py, im asking bcz im trying to get the index in this way "www.example.com" with (r'',index) but when i try r'' all pages in the website are going to the home pages. part of my code url.py : (r'^index',homepages), (r'',homepages), Thanks :) ...

Arbitrary number of positional arguments in django inclusion tag?

I'm trying to write a django inclusion tag that takes an arbitrary number of arguments: @register.inclusion_tag('so.html') def table_field(*args): fields = [] for arg in args: fields.append(arg) return { 'fields': fields, } However, when I call this from django's template engine: {% table_field form.hr form.bp form.o2_sat %} I get...

How can I filter a date of a DateTimeField in Django?

I am trying to filter a DateTimeField comparing with a date. I mean: MyObject.objects.filter(datetime_attr=datetime.date(2009,8,22)) I get an empty queryset list as an answer because (I think) I am not considering time, but I want "any time". Is there an easy way in Django for doing this? * I have the time in the datetime...

XULRunner , Python and Django : How to ?!

Hello , How to add Python and Django with XULRunner !? Found this tutorial useful , but somehow i was not able to add django ! Any idea ?! ...

Django Projects as Desktop applications : how to ?!

Hello , How to make Django projects packaged as desktop applications , i found some tutorials but is there any solution as DjangoKit , for Linux and Windows ?! List of related tutorials : Deploying a Django app on the desktop , Django application as a stand-alone desktop application , Regards. ...

Many to many lookups in Django

This is probably insultingly simple and worthy of a Nelson Muntz laugh, but I'm having a real braindead moment tryng to make many to many connections across various model relationships. I have the following models (simplified for your enjoyment!): class Document(models.Model): title = models.CharField(max_length=200) author = m...

Django i18n and python locales (and dates)

Hello everyone, I've been playing with Django's i18n system and it seems to be mostly working. However, dates in model code seem to be causing a problem. I use datetime.strftime to populate a few CHOICES tuples which are then used in forms. From what I understood, django will set the locale to the user's choice so that datetime.strft...