Re: Customized ChoiceField doesn't save properly with newforms-admin

2008-03-27 Thread Julien
Thanks for the pointer! I finally ended up defining my own field, which allowed me more flexibility: class CodeCategoryChoiceField(ChoiceField): def clean(self, value): return CodeCategory.objects.get(pk=value) Thanks! Julien On Mar 27, 8:53 pm, peschler <[EMAIL PROTECTED]> wrote:

Re: User created in postgresql is not found when Adding Data to the API.

2008-03-27 Thread Chirolo
Hi again. Thank you Thomas for your help. I think that I passed the role and authentication problem, but now I have another problem. Here is what I have done wrong. When I created my database named 'iFriendsDB' in postgresql I created it as super user. and then within the iFriendsDB created the us

css problem

2008-03-27 Thread Greg Lindstrom
Hello List! Things clicked tonight! I visited with Jacob at PyCon and decided that it was time to really learn Django. I have gone through most of the Django book (online) and the Head First XHTML with CSS books. Tonight, everything came together and I've written my first web pages using Django

Re: How are you storing binary data in db

2008-03-27 Thread Dan Ellis
On Mar 27, 9:05 pm, Mike H <[EMAIL PROTECTED]> wrote: > Reading large > chunks of file data from a db just wastes db resources A recipe is unlikely to be a large chunk of file data. Pictures of food, sure, don't store those in the DB. Storing the text in the DB also means you can make use of its

Re: math in django

2008-03-27 Thread Dan Ellis
It's not possible to use aggregate functions in any Django release, but IIRC it is something that has been added in the queryset-refactor branch. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: math in django

2008-03-27 Thread James Bennett
On Thu, Mar 27, 2008 at 9:19 PM, Dan Ellis <[EMAIL PROTECTED]> wrote: > It's not possible to use aggregate functions in any Django release, > but IIRC it is something that has been added in the queryset-refactor > branch. Be careful how you say that: you're free to write any piece of SQL you l

Using ModelForm...not populating my choices

2008-03-27 Thread Greg
Hello, My experience field by default gets displayed as a drop down..everything works fine when it is displayed this way. However I want the field to be displayed in my template as Radio Buttons. So I added the line ' experience = forms.CharField(widget=forms.RadioSelect) ' to my ModelClass. How

IntegrityError: duplicate key violates unique constraint

2008-03-27 Thread makebelieve
I recently made a new production database for a site using the following methods: 1. Ran syncdb to create all tables needed for the project 2. Used data transfer in PG Navicat to bring in old data I need Now when I try to create a new object in the admin interface I keep getting: IntegrityErr

Re: css problem

2008-03-27 Thread Brian Armstrong
Greg, check out settings.py. CSS counts as media -- it's a static file you want to serve up to the outside. The exact details of how this works depend on how the server you're on is set up, but essentially you have two options. You go into settings.py and fill in values for media_root and medi

Re: Using ModelForm...not populating my choices

2008-03-27 Thread Brian Armstrong
On Thu, Mar 27, 2008 at 9:27 PM, Greg <[EMAIL PROTECTED]> wrote: > > Hello, > My experience field by default gets displayed as a drop > down..everything works fine when it is displayed this way. However I > want the field to be displayed in my template as Radio Buttons. So I > added the lin

Re: css problem

2008-03-27 Thread [EMAIL PROTECTED]
http://www.djangoproject.com/documentation/static_files/ On Mar 27, 9:28 pm, "Brian Armstrong" <[EMAIL PROTECTED]> wrote: > Greg, check out settings.py. CSS counts as media -- it's a static > file you want to serve up to the outside. The exact details of how > this works depend on how the serv

Re: Using ModelForm...not populating my choices

2008-03-27 Thread Greg
Brian, I tried this but still doesn't work: // class SurveyForm(ModelForm): experience = forms.ChoiceField(widget=forms.RadioSelect) class Meta: model = Survey // Nothing gets displayed in the template On Mar 27, 9:32 pm, "Brian Armstrong" <[EMAIL PROTECTED]> wrote: > On Thu,

Re: Using ModelForm...not populating my choices

2008-03-27 Thread James Bennett
On Thu, Mar 27, 2008 at 9:49 PM, Greg <[EMAIL PROTECTED]> wrote: > class SurveyForm(ModelForm): > experience = forms.ChoiceField(widget=forms.RadioSelect) A ChoiceField requires you to pass in a set of choices for it to use. -- "Bureaucrat Conrad, you are technically correct -- the best k

Re: Counting over a ManyToManyField of a ManyToManyField, a question of style.

2008-03-27 Thread Rodrigo Culagovski
On Mar 27, 3:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Well, books can be redefined as: > > def books(self): > progs = self.programs.all() > return sum([prog.publications.all().filter(type=u'Book').count() > for prog in progs]) > > and likewise for the other methods. Nice.

Re: Counting over a ManyToManyField of a ManyToManyField, a question of style.

2008-03-27 Thread [EMAIL PROTECTED]
Yes, instead of returning all the records and counting them in python you would be using your databases COUNT() funciton. On Mar 27, 10:33 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > On Mar 27, 3:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Well, books can be redefined as

Re: How are you storing binary data in db

2008-03-27 Thread Rishabh Manocha
I think he meant recipes in that are there any recipes to accomplish this (storing binary data to the DB). Unless I'm getting this completely wrong, he was not talking about cooking recipes :). I would be interested in a solution for this too. There are cases where apps running as the apache/web

Re: extra arguments in generic views

2008-03-27 Thread Erik Vorhes
That's probably a discussion for the django-developers list, http://groups.google.com/group/django-developers . Unless those changes happen, you're likely best off creating multiple dictionaries or extending them in the individual url dict. On Thu, Mar 27, 2008 at 12:49 PM, Michael <[EMAIL PROTEC

Re: how to convert {{candidate.vote_set.filter(vote='TU').count()}} in template syntax

2008-03-27 Thread laspal
Thanks a lot. Its works On Mar 27, 8:33 pm, Peter Rowell <[EMAIL PROTECTED]> wrote: > Specifically, you might look athttp://www.djangosnippets.org/snippets/9/. > > This allows you to do something like: > > {% expr candidate.vote_set.filter(vote='TU').count() as count %} > > and now {{coun

<    1   2