django

question related to reverse function and kwargs

To reverse lookup an url by means of name or View_name we will use reverse function in the views like below reverse("calendarviewurl2", kwargs={"year":theyear,"month":themonth}) and reverse function signature is as follows http://code.djangoproject.com/browser/django/trunk/django/core/urlresolvers.py def reverse(self, lookup_view, ...

Django: form values not updating when model updates

I am creating a form that uses MultipleChoiceField. The values for this field are derived from another model. This method works fine, however, I am noticing (on the production server) that when I add a new item to the model in question (NoticeType), the form does not dynamically update. I have to restart the server for the new item to...

Good opensource django project for learning...

Hi, can anyone please suggest me good open source django project to learn django development. ...

Django: Create fixtures without specifying a primary key?

One of the things that bugs me about Django fixtures is that you've got to specify every model's primary key. Is there any way to create fixtures without having to specify a primary key for each row? ...

Django: How to set initial values for a field in an inline model formset?

I have what I think should be a simple problem. I have an inline model formset, and I'd like to make a select field have a default selected value of the currently logged in user. In the view, I'm using Django's Authentication middleware, so getting the user is a simple matter of accessing request.user. What I haven't been able to fi...

grok vs. django comparison

What are the smashing (pun intended) features of grok that makes it better than django? how do I know when my project needs grok+zope, or it can just be developed with django ? ...

Print a template variable on an overwritten admin form in Django

I have a Doctor-model which has a field called first_created. It is just a DateField that is auto_add_now, hence it is not displayed when editing a doctor in the admin interface. I want to display this field on the admin interface, at the top of the site as say, a static or something. It is supposed to ease the process of typing in dat...

basic unique ModelForm field for Google App Engine

I do not care about concurrency issues. It is relatively easy to build unique form field: from django import forms class UniqueUserEmailField(forms.CharField): def clean(self, value): self.check_uniqueness(super(UniqueUserEmailField, self).clean(value)) def check_uniqueness(self, value): same_user = users.User.a...

Styling certain admin change list rows

Is there a straightforward, common way to apply custom styling on admin change list element depending on its properties? update To be more precise: let's say I have a simple model object. Foo field1 field2 field3 @property property1() @property property2() ModelAdmin.list_display is defined as a subset of th...

Fixture loading works with loaddata but fails silently in unit test in Django

I can load the fixture file in my django application by using loaddata: manage.py loaddata palamut The fixture palamut.yaml is in the directory palamut/fixtures/ I have a unit test module service_tests.py in palamut/tests/. Its content is here: import unittest from palamut.models import * from palamut.service import * from palamut....

Django session intermittently disappears just after login

In my django app, I handle login in the following manner. Users go to a gateway page (index.html) - if they are not currently logged in, there will be a login/password form along with the other material. On successful login (or if they otherwise go to that page while logged in), the page is rendered slightly differently (sans login for...

Django app incorporation process.

Can some one please highlight what should be the process of incorporating reusable django app in a project without using setup.py. Can we simply move app into project directory and start using it? ...

How can I run django application using Aptana Studio

Can anyone please help setting and running django project using Aptana Studio? ...

match an alternative url - regular expresion django urls

Hi, I want march a django-URL with just 2 alternatives /module/in/ or /module/out/ Actually Im using url(r'^(?P<status>\w+[in|out])/$', 'by_status', name='module_by-status'), But matches with other patterns like /module/i/, /module/n/, /module/ou/; etc. Any hint is apreciated :) ...

Can I write components in Haskell to be used on a Django site?

I have an idea for a web service, but am very new to web programming. Django looks great and like something I can pick up quickly. I have a lot of experience in Haskell (and very little in python) and would like to be able to start writing some of the backend non-web-related things in my favorite language. But of course I don't want to d...

Django Model in one to one relationship and displaying it from the admin

For the following models: class Price: cad = models.DecimalField(max_digits=8, decimal_places=2) usd = models.DecimalField(max_digits=8, decimal_places=2) class Product: name = models.CharField(max_length=255) price = models.ForeignKey(Price) For each product, it's related to one and only one Price object which will c...

Is it possible to make URLs conditional with django?

I'm using the middleware to detect the subdomain and place a corresponding object in the request scope. Would it be possible to take it further and declare that the subdomain implements these urls but not those? Something like? if request.subdomain.is_blue: include(these.urls) ...

how to design model for my case with django?

Here are two roles: Trainer and Trainee. Trainer may have multiple trainees. While each trainee may have only one trainer or have no trainer. Here is my model: class TrainerShip(models.Model): trainer = models.ForeignKey('Trainer') trainee = models.ForeignKey(User) request_date = models.DateTimeField(auto_now_add=True) ...

Mashing and sorting 3 models in one data set

I've got three models that show some sort of activity on a website I'm making. Song, Vote and Comment. They all share a common column when which shows when a record was created. I want to show a list of activity based on all three models. In short I want to munge them together, sort by when, and scrape off the first 10 records. How I d...

RESTful APIs in Django for GETTING information from a server

Any idea of a RESTful APIs in Django for GETTING information from a server? What I want to do is fetch the errors from the server into a database. For example: The Live server has examplewebsite.com, any thing goes wrong with that website should POST the error, where the Django app GET the errors and insert them into the database. ...