Difficulty with validation of multiple modelforms on 1 page

2012-05-07 Thread Roald
lidate one form based on the (cleaned) data of another form? Or how you would refactor that? Thanks in advance! Kind regards, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://gro

Re: Request Context problem

2012-02-20 Thread Roald
On 20 feb, 00:03, Reinout van Rees wrote: > On 19-02-12 14:16, dummyman dummyman wrote: > > The solution is simple: just add a {{ csrf_token }} somewhere in your > form. That ought to do it. A typo there, Reinout ;-). You meant: {% csrf_token %} Cheers, Roald -- You received

Re: nested forms from model with manytomany

2011-09-15 Thread Roald de Vries
? Hi Visgean, I think you want inline formsets: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/ #inline-formsets Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-user

Re: Is a model method the answer?

2011-05-26 Thread Roald
urrent value of bool_field, have a look at https://docs.djangoproject.com/en/dev/topics/db/queries/#filters-can-reference-fields-on-the-model. class A(models.Model): ... def save(self, *args, **kwargs): super(A, self).save(*args, **kwargs) self.b_set.update(bool_field=Tru

reverse works with runserver, but not with wsgi

2011-05-26 Thread Roald
pe: NoReverseMatch at /order/ Exception Value: Reverse for 'ideal_in' with arguments '()' and keyword arguments '{}' not found. Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Setting a default value for a select widget in a modelformset

2010-09-05 Thread Roald de Vries
ng-initial-data-with-a-formset Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@google

Re: passing file from command line startup

2010-08-11 Thread Roald de Vries
; import sys >>> file = sys.stdin Option 2: read command line arguments >>> import sys >>> file = open(sys.argv[1]) Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Adding request context to standard login/logout views?

2010-08-11 Thread Roald de Vries
add the request context You mean http://docs.djangoproject.com/en/dev/ref/settings/ #std:setting-TEMPLATE_CONTEXT_PROCESSORS? Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: overwrite the save method

2010-08-11 Thread Roald de Vries
On Aug 11, 2010, at 7:25 PM, refreegrata wrote: My code -- class Format(models.Model): name = models.CharField(max_length=5, unique=True) myBoolean = models.BooleanField(default=False) class FormFormat(forms.ModelForm): boolean1 = forms.BooleanField(requi

Re: add attributes to a field without widgets

2010-08-11 Thread Roald de Vries
ng the widget attrs on form object creation: def __init__(self, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) # If you want an other widget: # self.fields['name'].widget = forms.TextInput(attrs={something...}) self.fields['name'].w

Re: Search Field on All Pages

2010-08-08 Thread Roald de Vries
follow the django DRY principles. Personally, I like all of my forms to be classes. If you want that, you should create a context processor. http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors Cheers, Roald -- You received this message because you are sub

database object initialization versus python object initalization

2010-08-06 Thread Roald de Vries
therefore be saved in the database. If I create a personupdate using PersonUpdate.objects.create or ~.get_or_create, I don't mind saving the object, but I don't want to call 'self.save()' in PersonUpdate.__init__. How should I handle this? Cheers, Roald -- You received this mes

Re: model inheritance, abtract=True

2010-08-05 Thread Roald de Vries
On Aug 5, 2010, at 3:15 PM, Roald de Vries wrote: On Aug 5, 2010, at 3:00 PM, Emily Rodgers wrote: On Aug 5, 1:50 pm, Roald de Vries wrote: Dear all, I have the following error, and don't know what it means: Error: One or more models did not validate: update.personupdate: &#x

Re: model inheritance, abtract=True

2010-08-05 Thread Roald de Vries
On Aug 5, 2010, at 3:00 PM, Emily Rodgers wrote: On Aug 5, 1:50 pm, Roald de Vries wrote: Dear all, I have the following error, and don't know what it means: Error: One or more models did not validate: update.personupdate: 'address' has a relation with model Addr

model inheritance, abtract=True

2010-08-05 Thread Roald de Vries
but I think the problems started when I separated my Person class into an abstract base class PersonProfile and a derived class Person, and added the class PersonUpdate, deriving from PersonProfile too. Can anybody help? Thanks in advance, cheers, Roald -- You received this message because you

Re: Best way to present N items in table row for list

2010-07-29 Thread Roald de Vries
=[] while cnt First: list is a very unlucky name for a parameter, since it's the type of [] Second: list comprehension rules! def groupListByRow(list): return [lst[start:start+5] for start in range(0, len(lst), 5)] Cheers, Roald -- You received this message because yo

Re: Django INNER JOIN

2010-07-28 Thread Roald de Vries
Because you're querying the Projects, you can not use Favourite fields as keywords. So you'll (more or less) have to stick with the other option. Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: Django INNER JOIN

2010-07-28 Thread Roald de Vries
On Jul 28, 2010, at 5:19 PM, kostia wrote: Thank you very much Roald, What is faster: projects = Project.objects.filter(favourites__user = request.user) or select_related('project') ? I think it doesn't matter much, but if one is faster, it should be the first one.

Re: Django INNER JOIN

2010-07-28 Thread Roald de Vries
7;project')" if performance is an issue for you. Cheers, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, s

Re: Django IDE

2010-07-18 Thread Roald de Vries
des, VIM doesn't leave you with a crippled little finger (from all the 's) - VIM has more commands than Emacs I would say Emacs makes you more productive on shorter term, VIM makes you more productive on longer term. Cheers, Roald -- You received this message because you are subscrib

Re: code repetition in views

2010-04-18 Thread Roald de Vries
var2 = 'var2', ) # ... and so on I will probably post a more extensive code snippet to django-dev and django-snippets in a few weeks. Kind regards, Roald -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: How can i populate app engine(production environment) database with local sdk database

2010-04-05 Thread Roald de Vries
On Mar 31, 2010, at 9:12 AM, Eximius wrote: Please help me out On Mar 29, 11:04 pm, Eximius wrote: Hi all, I have created a django application using app engine sdk, and have stored data in database using forms. But the problem i am getting when i deploy it, the data I stored is not ther

Re: Strange difference between runserver and shell

2010-03-12 Thread Roald de Vries
On Mar 11, 2010, at 11:56 AM, pyt...@roalddevries.nl wrote: I have the following model: 1 class MyOrderItem(models.Model): 2 orderitem = models.ForeignKey(OrderItem, null=True, blank=True) 3 # other fields 4 5 def save(self, *args, **kwargs): 6