Re: use same database across various applications in a django project?

2012-07-13 Thread Сергей Фурсов
Why do you define this model in app1 and in app2? Define it only in app1 and import it in app2 where you need (models, views, etc) 2012/7/13 Burhan > Hi, > > Thanks for the relpy, i set db_name under as meta information, now i am > getting this error > >

Re: "Cannot convert <QueryDict:" after limiting foreign key

2012-07-11 Thread Сергей Фурсов
I think that you can replace if request.method == 'POST': form = WebrequestsForm(request.POST) with: if request.method == 'POST': form = WebrequestsForm(data=request.POST, own_id=own_id) as I said in first answer 2012/7/11 mapapage > I have a legacy db

Re: "Cannot convert <QueryDict:" after limiting foreign key

2012-07-11 Thread Сергей Фурсов
Ok, I tried your code, just added in models.py fake owners model to correct foreign key class Owners(models.Model): num = models.IntegerField() def __unicode__(self): return unicode(self.num) and create views.py with three lines of code: def page(request): form =

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Сергей Фурсов
oops) 2012/7/11 Сергей Фурсов <geyse...@gmail.com> > Some notes about your models: > 1. why do you create id field manually? Django will do it for you ;) > 2. why do you explicitly set db_table and db_column? Do you have some > legacy database? If not, django will do it for you

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Сергей Фурсов
='web_requests2', blank=True) 2012/7/11 Сергей Фурсов <geyse...@gmail.com> > Ok, I tried your code, just added in models.py fake owners model to > correct foreign key > > class Owners(models.Model): > num = models.IntegerField() > > def __unicode__(self): >

Re: CSRF verification failed. Request aborted.

2012-07-11 Thread Сергей Фурсов
= WebrequestsForm(own_id=1) return render_to_response('page.html', {'form': form}) and it works! May be problem in your views.py? 2012/7/10 Сергей Фурсов <geyse...@gmail.com> > as described in error message your view function have to use > RequestContext<http://docs.djangoproject

Re: "Cannot convert <QueryDict:" after limiting foreign key

2012-07-11 Thread Сергей Фурсов
can you provide your models.py, views.py and forms.py code relative to this problem, I'll try to help, but I need more info 2012/7/11 mapapage > I do it like this: form = WebrequestsForm(own_id=own_id, initial = {...}) >> > but I think that the prob is not there. Somehow it

Re: "Cannot convert <QueryDict:" after limiting foreign key

2012-07-11 Thread Сергей Фурсов
I can suppose that you call your modelForm's initialization like form = MyForm(request.POST, own_instance.id) but it should looks like form = MyForm(data=request.POST, own_id= own_instance.id), because there distinction between positional and keyword arguments 2012/7/11 Marilena Papageorgiou

Re: cleaned_data in forms.py?

2012-07-10 Thread Сергей Фурсов
You can try to override get_form_kwargs method def get_form_kwargs(self, step): if step == '1' cleaned_data = self.get_cleaned_data_for_step('0') or {} return {'sender': cleaned_data.get('sender', None)} else: return {} and in ContactForm2 override __init__ method

Re: cleaned_data in forms.py?

2012-07-10 Thread Сергей Фурсов
Why not use Form Wizard from django.contrib.formtools. Look at https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#conditionally-view-skip-specific-steps Simply change show_message_form_condition method to something like def show_message_form_condition(wizard):

Re: CSRF verification failed. Request aborted.

2012-07-10 Thread Сергей Фурсов
as described in error message your view function have to use RequestContext for the template, instead of Context. your view should looks like def about(request): if request.method == 'POST':