Re: Model Form Field Ordering
The is no public/documented API for reorder fields, but you can do some trick with SortedDict: class MyModelForm(forms.ModelForm): mySpecialField = forms.ChoiceField(label='Special', choices=(('a','aa'))) class Meta: model = MyModelType MyModelForm.base_fields.keyOrder = ["mySpecialField"] + MyModelForm.base_fields.keyOrder[:-1] On Thu, Feb 5, 2009 at 9:14 AM, Brianwrote: > > I have a ModelForm subclass where I define a special field. How do I > make that special field appear first in the rendered form (using a > form.as_* method)? > > Here is an example: > > class MyModelForm(forms.ModelForm): >mySpecialField = forms.ChoiceField(label='Special', choices=(('a', > 'aa'))) >class Meta: >model = MyModelType > > The problem is mySpecialField is rendering last, but I wish it to > appear first. > > Thank you for your assistance. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Two forms.Form one page: second form will not show any errors
Form 1 Template (rendered from view): http://dpaste.com/116827/ Form 2 Template (included in Form 1): http://dpaste.com/116826/ View Code: http://dpaste.com/116828/ Form 2 Code: http://dpaste.com/116829/ Once again, the problem is that Form 2 won't display any errors while Form 1 will display errors fine. Thanks, On Feb 4, 11:14 pm, Karen Traceywrote: > On Thu, Feb 5, 2009 at 2:03 AM, Gordon wrote: > > > Hello, > > I have seperate django forms wrapper in one html form tag in my > > template. > > > When i render, both forms display fully. When I post, errors display > > for the first form but not for the second. I am using a tag by tag > > approach to the the template. > > > Interesting thing is I did a test to see if form2 was bound: > > {% if form2.is_bound %} This is bound {% endif %} and it is > > It should be displaying errors (I am leaving the fields blank and they > > are required) > > > is it any thing to do with form1 being a ModelForm and form2 is a > > Form? This is my first django app so maybe i missed something when I > > declared the Form class. > > > any suggestions? > > Specifics of your view code and the template you are using to render the > forms might help someone spot what is going wrong. If they're likely to be > badly wrapped in email, someplace like dpaste.com would be better than > putting them inline in your message. > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Required help for Basic Data insertion to the database from a form
sorry for not tell u in problem detail in detail. i'm new to this kind of stuff. i havn't done this before. I will try to figure out a way to explain u. I tried all the stuff that u have said with example. anyway thanks. comming to my problem... as far this code works fine. there is no error in this. I able to display the form text fields in the form when i use the url. In views.py file, how can i access the separate field values that have been submitted from html form file, and submission is done by the object.save() function is used to save the table. when i press submit button, just simple go to index page. nothing is entered into the table record. On Feb 5, 11:44 am, Karen Traceywrote: > On Thu, Feb 5, 2009 at 1:23 AM, Neeru wrote: > > > thxs, > > > I have the Problem in accessing the values from the form. > > What Problem? You haven't described any problem, you just dumped a bunch of > code in an email and said "hi all, please fix this (quick!) for me". You > need to describe what is not working. You enter the url to retrieve the > form and you fill it in and press submit and what happens? Do you get > an error message? Does your computer catch on fire? What have you done so > far to diagnose what might be going wrong? (You have tried to solve it > yourself first, right?) This is all very basic stuff you need to be > including in your request for help. > > There are many working examples of forms/views/templates out there -- have > you tried getting one of those up and running on your system to verify > you've got the basic setup working? Then you could modify whatever simple > example you chose to start with and adapt it to fit what you want to do > (which doesn't appear to be anything too advanced). Or, if you have trouble > getting a simple example working, you could post here with specifics of > what's not working as you expect and perhaps get some guidance. But just > posting a bunch of code and asking the list to fix it without describing > how, exactly, it isn't working is asking a bit much. > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Two forms.Form one page: second form will not show any errors
On Thu, Feb 5, 2009 at 2:03 AM, Gordonwrote: > > Hello, > I have seperate django forms wrapper in one html form tag in my > template. > > When i render, both forms display fully. When I post, errors display > for the first form but not for the second. I am using a tag by tag > approach to the the template. > > Interesting thing is I did a test to see if form2 was bound: > {% if form2.is_bound %} This is bound {% endif %} and it is > It should be displaying errors (I am leaving the fields blank and they > are required) > > > is it any thing to do with form1 being a ModelForm and form2 is a > Form? This is my first django app so maybe i missed something when I > declared the Form class. > > any suggestions? > Specifics of your view code and the template you are using to render the forms might help someone spot what is going wrong. If they're likely to be badly wrapped in email, someplace like dpaste.com would be better than putting them inline in your message. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Two forms.Form one page: second form will not show any errors
Hello, I have seperate django forms wrapper in one html form tag in my template. When i render, both forms display fully. When I post, errors display for the first form but not for the second. I am using a tag by tag approach to the the template. Interesting thing is I did a test to see if form2 was bound: {% if form2.is_bound %} This is bound {% endif %} and it is It should be displaying errors (I am leaving the fields blank and they are required) is it any thing to do with form1 being a ModelForm and form2 is a Form? This is my first django app so maybe i missed something when I declared the Form class. any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: models created from database table
On Thu, Feb 5, 2009 at 1:19 AM, Waruna de Silvawrote: > Thanks > > What is the best possible way to handle that type of a problem > > I don't know, it is not something I've ever needed. If you Google "composite primary keys" and Django you'll get hits that point to the ticket where the feature is requested and various conversations on the development list, etc. Perhaps you can find some useful hints in those sources. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Required help for Basic Data insertion to the database from a form
thxs, I have the Problem in accessing the values from the form. On Feb 5, 11:13 am, Karen Traceywrote: > On Thu, Feb 5, 2009 at 12:55 AM, Neeru wrote: > > > hi all, > > > As i'm new to the Django framework, > > i want to know the how can i insert the form data into the database. > > Plz let me know the solution and necessary changes that have to be > > done > > > program is like > > > - > > in models.py file code is as following: > > > class loan(models.Model): > > staffid = models.ForeignKey(employee) > > date = models.DateField() > > lamount = models.IntegerField(max_length=5) > > lsource = models.IntegerField(max_length=5) > > deductionrank = models.IntegerField(max_length=5) > > directpaymentto = models.CharField(max_length=30) > > totalloan = models.IntegerField(max_length=5) > > iamount = models.IntegerField(max_length=5) > > noofinstallments = models.IntegerField(max_length=5) > > finstallment = models.IntegerField(max_length=5) > > linstallment = models.IntegerField(max_length=5) > > > def __str__(self): > > return '%s' % (self.name) > > max_length implies you are using something post Django 0.96, so you probably > want a __unicode__ method, not a __str__ method. It'd help also if you > chose a field (or set of fields) to return that actually exists in the > model. > > > > > > > -- > > > In forms.py file > > > class loanform(forms.Form): > > staffid = forms.CharField(max_length=30) > > date = forms.DateField() > > lamount = forms.IntegerField() > > lsource = forms.IntegerField() > > deductionrank = forms.IntegerField() > > directpaymentto = forms.CharField(max_length=30) > > totalloan = forms.IntegerField() > > iamount = forms.IntegerField() > > noofinstallments = forms.IntegerField() > > finstallment = forms.IntegerField() > > linstallment = forms.IntegerField() > > I suggest you look into > ModelForms:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > > > > > > --- > > > In views.py file > > > def loanform(request): > > if request.method == 'POST': > > tr = loanform(request.POST) > > if tr.is_valid(): > > tr.save() > > return HttpResponseRedirect('/index') > > else: > > tr = loanform() > > return render_to_response('loan.html', {'form': tr}) > > > > > > in loan.html file > > > > > > > Test And Training record > > > > > > Test And Training record > > > > > > > {{ form.as_table }} > > > > > > > > > > > > > > > --- > > > in urls.py file > > > (r'^loan', 'jewel.app.views.loanform'), > > > --- > > > plz let me know as soon as possible > > thanks > > You've not said what goes wrong with what you've got. You might get better > responses if you put more effort into describing what your problem is, > exactly. > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Model Form Field Ordering
On Thu, Feb 5, 2009 at 1:14 AM, Brianwrote: > > I have a ModelForm subclass where I define a special field. How do I > make that special field appear first in the rendered form (using a > form.as_* method)? > > Here is an example: > > class MyModelForm(forms.ModelForm): >mySpecialField = forms.ChoiceField(label='Special', choices=(('a', > 'aa'))) >class Meta: >model = MyModelType > > The problem is mySpecialField is rendering last, but I wish it to > appear first. > > Thank you for your assistance. I don't know of any hook/knob to adjust the order of fields. You may need to write a custom form renderer rather than relying on the generic form.as_*. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: models created from database table
Thanks What is the best possible way to handle that type of a problem On Thu, Feb 5, 2009 at 11:45 AM, Karen Traceywrote: > On Thu, Feb 5, 2009 at 12:58 AM, Waruna de Silva wrote: > >> Thanks Ramior for info >> >> In Models is it possible to name to Fields as primary keys >> >> as exmaple, there are two fields >> gid = models.IntegerField() >> business_id = models.ForeignKey(Business) >> >> how to make both of them as primary keys , following isn't work >> gid = models.IntegerField(primary_key=True) >> business_id = models.ForeignKey(Business, primary_key=True) >> > > > No, you cannot do this at present. Composite primary keys may be supported > at some point, but they are not now. > > Karen > > > >> >> >> >> On Tue, Feb 3, 2009 at 5:05 PM, Ramiro Morales wrote: >> >>> >>> On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva >>> wrote: >>> > Hi, >>> > >>> > In Django is it possible to created models automatically from >>> > existing database. >>> >>> Yes, see >>> >>> >>> http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases >>> >>> -- >>> Ramiro Morales >>> >>> >>> >> >> >> > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: models created from database table
On Thu, Feb 5, 2009 at 12:58 AM, Waruna de Silvawrote: > Thanks Ramior for info > > In Models is it possible to name to Fields as primary keys > > as exmaple, there are two fields > gid = models.IntegerField() > business_id = models.ForeignKey(Business) > > how to make both of them as primary keys , following isn't work > gid = models.IntegerField(primary_key=True) > business_id = models.ForeignKey(Business, primary_key=True) > No, you cannot do this at present. Composite primary keys may be supported at some point, but they are not now. Karen > > > > On Tue, Feb 3, 2009 at 5:05 PM, Ramiro Morales wrote: > >> >> On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva >> wrote: >> > Hi, >> > >> > In Django is it possible to created models automatically from >> > existing database. >> >> Yes, see >> >> >> http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases >> >> -- >> Ramiro Morales >> >> >> > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Changing default app url in development server
Thank you all for the replies. I will try the middleware solution and tell you how it's going. :) It's nice to see that our group is big enough to get ~15 replies in 2 days. Thanks, Arshavski Alexander. On Feb 5, 5:14 am, Graham Dumpletonwrote: > On Feb 5, 1:25 am, Adam Stein wrote: > > > I do something similiar where I have an extra item in the url. To get > > Apache and the Django server to match, I just add the extra part in > > urls.py that I'm matching. So instead of something like: > > > (r'^admin/(.*)', admin.site.root) > > > in Alex's case, it would be: > > > (r'^peergw/admin/(.*)', admin.site.root) > > > The same would go for any other match, just add the 'peergw' in front. > > > That way, the exact same URL can be used in both places. > > Which will then not work if you move to mod_wsgi or other WSGI hosting > systems where SCRIPT_NAME is correctly set to be the mount point of > the application. The django.root option is a mod_python specific hack > to work around inadequacies in mod_python. It would not be wise to > rely on mod_python broken behaviour of urls.py working how it does for > you if django.root not set. > > Graham > > > > > On Wed, 2009-02-04 at 15:11 +0100, Ales Zoulek wrote: > > > As I undrestood it is that it's infact *used* on Apache. > > > That's why the django project is on "/peergw" - Apache, but "/" - dev > > > server. > > > > And Alex wants to simulate this behaviour on dev server side. > > > > Or am I wrong? > > > > A. > > > > On Wed, Feb 4, 2009 at 3:02 PM, Karen Tracey wrote: > > > > On Wed, Feb 4, 2009 at 4:46 AM, Ales Zoulek > > > > wrote: > > > > >> That's not as easy as it seams, quick fix/hack would be middleware > > > >> that strips out /pergw from the url. That middleware would be used > > > >> only for dev server, not for apache. > > > > > What about simply using the django.root PythonOption when running under > > > > Apache: > > > > >http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#basi... > > > > > Its entire reason for being is, I believe, to handle situations like > > > > this. > > > > > Karen > > > > >> A. > > > > >> On Wed, Feb 4, 2009 at 9:39 AM, knight wrote: > > > > >> > My production version is running on different computer with apache > > > >> > installed on http:///peergw > > > >> > and development version on my computer is running on http:// > > >> > with port>. > > > >> > I want them both to run on http:///peergw. > > > >> > The port has no difference. > > > > >> > Thanks, Alex A. > > > > >> > On Feb 4, 9:58 am, Ian Lewis wrote: > > > >> >> What are you trying to do? If your development appserver is > > > >> >> conflicting > > > >> >> with > > > >> >> a locally installed apache then why not just use a different port? > > > > >> >> python manage.py runserver 8001 > > > > >> >> 2009/2/4 knight > > > > >> >> > Hi, > > > > >> >> > My question is: > > > > >> >> > Is there a way to change my default app url in development server > > > >> >> > fromhttp://localhost:8000tohttp://localhost:8000/peergw. > > > > >> >> > If it's a problem, maybe someone have a good reference for > > > >> >> > configuring > > > >> >> > apache server on MAC. > > > > >> >> > Regards, > > > >> >> > Arshavski Alexander. > > > > >> >> -- > > > >> >> === > > > >> >> 株式会社ビープラウド イアン・ルイス > > > >> >> 〒150-0012 > > > >> >> 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > > > >> >> email: ianmle...@beproud.jp > > > >> >> TEL:03-5795-2707 > > > >> >> FAX:03-5795-2708http://www.beproud.jp/ > > > >> >> === > > > > >> -- > > > >> -- > > > >> Ales Zoulek > > > >> +420 604 332 515 > > > >> Jabber: a...@jabber.cz > > > >> ICQ: 82647256 > > > >> -- > > > -- > > Adam Stein @ Xerox Corporation Email: a...@eng.mc.xerox.com > > > Disclaimer: Any/All views expressed > > here have been proven to be my own. [http://www.csh.rit.edu/~adam/] > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Model Form Field Ordering
I have a ModelForm subclass where I define a special field. How do I make that special field appear first in the rendered form (using a form.as_* method)? Here is an example: class MyModelForm(forms.ModelForm): mySpecialField = forms.ChoiceField(label='Special', choices=(('a', 'aa'))) class Meta: model = MyModelType The problem is mySpecialField is rendering last, but I wish it to appear first. Thank you for your assistance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Required help for Basic Data insertion to the database from a form
On Thu, Feb 5, 2009 at 12:55 AM, Neeruwrote: > > hi all, > > As i'm new to the Django framework, > i want to know the how can i insert the form data into the database. > Plz let me know the solution and necessary changes that have to be > done > > program is like > > > - > in models.py file code is as following: > > class loan(models.Model): >staffid = models.ForeignKey(employee) >date = models.DateField() >lamount = models.IntegerField(max_length=5) >lsource = models.IntegerField(max_length=5) >deductionrank = models.IntegerField(max_length=5) >directpaymentto = models.CharField(max_length=30) >totalloan = models.IntegerField(max_length=5) >iamount = models.IntegerField(max_length=5) >noofinstallments = models.IntegerField(max_length=5) >finstallment = models.IntegerField(max_length=5) >linstallment = models.IntegerField(max_length=5) > >def __str__(self): >return '%s' % (self.name) > max_length implies you are using something post Django 0.96, so you probably want a __unicode__ method, not a __str__ method. It'd help also if you chose a field (or set of fields) to return that actually exists in the model. > > > -- > > In forms.py file > > class loanform(forms.Form): >staffid = forms.CharField(max_length=30) >date = forms.DateField() >lamount = forms.IntegerField() >lsource = forms.IntegerField() >deductionrank = forms.IntegerField() >directpaymentto = forms.CharField(max_length=30) >totalloan = forms.IntegerField() >iamount = forms.IntegerField() >noofinstallments = forms.IntegerField() >finstallment = forms.IntegerField() >linstallment = forms.IntegerField() > I suggest you look into ModelForms: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > > --- > > In views.py file > > def loanform(request): >if request.method == 'POST': >tr = loanform(request.POST) >if tr.is_valid(): >tr.save() >return HttpResponseRedirect('/index') >else: >tr = loanform() >return render_to_response('loan.html', {'form': tr}) > > > > > in loan.html file > > > >Test And Training record > > > Test And Training record > > > > >{{ form.as_table }} > > > > > > > > --- > > in urls.py file > > (r'^loan', 'jewel.app.views.loanform'), > > > --- > > plz let me know as soon as possible > thanks > You've not said what goes wrong with what you've got. You might get better responses if you put more effort into describing what your problem is, exactly. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to integrate captcha in Django
On Thu, Feb 5, 2009 at 12:54 AM, gganeshwrote: > > hi Django floks > i'm newbie to Django ,i have a task like > People have to register with their email in the index page , to enter > into my site and, to protect my site from unwanted usage, i need to > integrate captcha .i will be glad to find a help from you > thanks in advance > Have you tried Google on: captcha django ? There appear to be several projects/snippets/etc. out there. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Overriding admin template: index.html
My problem is that I want to pass additional variables to index.html. So I thought I can do it if I add these variables to view that renders index.html. Regards, Alex A. On Feb 4, 10:55 am, Kenneth Gonsalveswrote: > On Wednesday 04 Feb 2009 2:05:37 pm knight wrote: > > > Thanks for the fast reply. > > I read this but I still cannot find the view that renders index.html. > > well, according to this link, you do not need the view in order to override > index.html of admin. > > -- > regards > KGhttp://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: models created from database table
Thanks Ramior for info In Models is it possible to name to Fields as primary keys as exmaple, there are two fields gid = models.IntegerField() business_id = models.ForeignKey(Business) how to make both of them as primary keys , following isn't work gid = models.IntegerField(primary_key=True) business_id = models.ForeignKey(Business, primary_key=True) regards, Waruna On Tue, Feb 3, 2009 at 5:05 PM, Ramiro Moraleswrote: > > On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva > wrote: > > Hi, > > > > In Django is it possible to created models automatically from > > existing database. > > Yes, see > > > http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases > > -- > Ramiro Morales > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Required help for Basic Data insertion to the database from a form
hi all, As i'm new to the Django framework, i want to know the how can i insert the form data into the database. Plz let me know the solution and necessary changes that have to be done program is like - in models.py file code is as following: class loan(models.Model): staffid = models.ForeignKey(employee) date = models.DateField() lamount = models.IntegerField(max_length=5) lsource = models.IntegerField(max_length=5) deductionrank = models.IntegerField(max_length=5) directpaymentto = models.CharField(max_length=30) totalloan = models.IntegerField(max_length=5) iamount = models.IntegerField(max_length=5) noofinstallments = models.IntegerField(max_length=5) finstallment = models.IntegerField(max_length=5) linstallment = models.IntegerField(max_length=5) def __str__(self): return '%s' % (self.name) -- In forms.py file class loanform(forms.Form): staffid = forms.CharField(max_length=30) date = forms.DateField() lamount = forms.IntegerField() lsource = forms.IntegerField() deductionrank = forms.IntegerField() directpaymentto = forms.CharField(max_length=30) totalloan = forms.IntegerField() iamount = forms.IntegerField() noofinstallments = forms.IntegerField() finstallment = forms.IntegerField() linstallment = forms.IntegerField() --- In views.py file def loanform(request): if request.method == 'POST': tr = loanform(request.POST) if tr.is_valid(): tr.save() return HttpResponseRedirect('/index') else: tr = loanform() return render_to_response('loan.html', {'form': tr}) in loan.html file Test And Training record Test And Training record {{ form.as_table }} --- in urls.py file (r'^loan', 'jewel.app.views.loanform'), --- plz let me know as soon as possible thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to integrate captcha in Django
hi Django floks i'm newbie to Django ,i have a task like People have to register with their email in the index page , to enter into my site and, to protect my site from unwanted usage, i need to integrate captcha .i will be glad to find a help from you thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Serialization
Brian, I can get data on the maps with no problem. It is just making it change when the user selects something. If you are trying to get data on a map, I have a handy way for you to do it. This is only for your template. You will have to find a way to geocode everything ahead of time. GeoDjango can do this or something like GeoPy can also. There are also snippets on Django snippets that have different ways doing it. Sorry if you already know how to do this and I just misunderstood. This worked for me because I already had the lat and long for what I was doing. # In your template do this. The gmap will load in the div with the id of map. # You can style the div to be different sizes. You can also get a smaller map # control from google. http://maps.google.com/maps? file=api&v=2&key=GOOGLE KEY GOES HERE!"