Re: Optional foreign key with django?

2010-09-09 Thread maroxe
This solved my problem On 9 sep, 12:18, Carlton Gibson wrote: > On 9 Sep 2010, at 12:04, bagheera wrote: > > >> On Sep 8, 11:14 pm, maroxe wrote: > >>> Hi, In my models I want to have an optional field to a foreign key. I > >>> tried this: > > >

Returning an inclusion tagLLKKJJ

2010-09-09 Thread maroxe
Hi, I am suffering whereever i try to do something in django that is not common(in django, not in python in general) For example, i don't know how to return an inclusion tag. This. obviously, won't work: @register.inclusion_tag('template.tpl') def myinclusiontag(parameter): return {'var': par

How does django convert string to modules

2010-09-08 Thread maroxe
Hi, I am trying to understand an other magic thing about django: it can convert strings to modules. In settings.py, INSTALLED_APPS is declared like that: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', ) All it contains is strings. Bu

django magic: context passed to template

2010-09-08 Thread maroxe
Hi, There is something i don't get in django template system. I have a FileField in my model called myfile. If i pass an instance of my model to a template, i can access file.size (this is an example). Form where this variable 'size' come from?? it's not part of the FileField class as far as i know

Optional foreign key with django?

2010-09-08 Thread maroxe
Hi, In my models I want to have an optional field to a foreign key. I tried this: field = models.ForeignKey(MyModel, null=True, blank=True, default=None) But i am getting this error: model.mymodel_id may not be NULL i am using sqlite edit: if it can help, here is the exception location:

django not taking in consideration model fields declared in __init__

2010-09-07 Thread maroxe
Hi, When using Model class like this: class MyModel(models.Model): def __init__(self, *args, **kwargs): self.myfield = models.Field() super(MyModel, self).__init__(*args, **kwargs) It doesn't take into consideration myfield(in the admin form, when saving the object... ) But if

Re: Forms.is_valid() Always return False

2010-07-11 Thread maroxe
The problem occurs only when using AuthenticationForm! On Jul 11, 4:14 pm, maroxe wrote: > Hi all, > I have a problem with django 1.2: >  is_valid returns always False, and form.errors is empty. > I use AuthentificationForm provided by django. > I have created a bou

Forms.is_valid() Always return False

2010-07-11 Thread maroxe
Hi all, I have a problem with django 1.2: is_valid returns always False, and form.errors is empty. I use AuthentificationForm provided by django. I have created a bound form: form = AuthentificationForm(request.POST) and this request.POST: I believe it's a probleme related to django new securit