model form validation always failing
dear all i have a model Career class Career(models.Model): full_name = models.CharField(max_length=200) email = models.EmailField() nationality = CountryField() resume = models.FileField(upload_to='resumes') def __unicode__(self): return self.full_name and i have the model form: class CareerForm(ModelForm): class Meta: model = Career inside my template im using : {{ form.as_p }} to display the form i can see the fileds but when i try to submit , the rusume validation is always failing (This field is required.) although i upload the file, and i was able to add data usign the admin interface without any problems any ideas about this issue 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: model form validation always failing
thanks for the reply thomas if tried that but it is still giving the validation message On May 19, 1:18 pm, Thomas Guettler wrote: > Maybe you form misses this: enctype="multipart/form-data" > > watad schrieb: > > > dear all > ... > > i can see the fileds but when i try to submit , the rusume validation > > is always failing (This field is required.) > > although i upload the file, and i was able to add data usign the admin > > interface without any problems > > -- > Thomas Guettler,http://www.thomas-guettler.de/ > E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ 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 validation always failing
this is my form after thomas reply: {{ form.as_p }} and this is my view after your reply : def careerspage(request): if request.method == 'POST': form = CareerForm(request.POST,request.FILES) if form.is_valid(): form.save() return HttpResponseRedirect('/thanks') else: form = CareerForm() return render_to_response('careers.html', {'form':form}) the validation for the resume upload still failing when i submit im reading the link u have posted to check whats wrong another help will be appriciated :) On May 19, 4:27 pm, Karen Tracey wrote: > On Tue, May 19, 2009 at 5:23 AM, watad wrote: > > i have a model Career > > > class Career(models.Model): > > full_name = models.CharField(max_length=200) > > email = models.EmailField() > > nationality = CountryField() > > resume = models.FileField(upload_to='resumes') > > def __unicode__(self): > > return self.full_name > > > and i have the model form: > > class CareerForm(ModelForm): > > class Meta: > > model = Career > > > inside my template im using : > > > {{ form.as_p }} to display the form > > > i can see the fileds but when i try to submit , the rusume validation > > is always failing (This field is required.) > > although i upload the file, and i was able to add data usign the admin > > interface without any problems > > > any ideas about this issue > > The template (or at least the part that includes the form definition) you > use for the form would have been helpful to post, as that would have shown > whether you had the enctype="multipart/form-data" mentioned by Thomas. > > The other part you haven't shown is how you create the form from the post > data in the view. My guess would be you are not passing request.FILES in > when you instantiate the form. See: > > http://docs.djangoproject.com/en/dev/topics/http/file-uploads/ > > Karen- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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 validation always failing
hi karen , actually im runing this code , after submit i can see all the data inside the model ,only the filefield resume is empty , of course when i test this i add (blank=True, null=True) to my resume field , so why do u think the other fileds is geeting the data submitted by the form and the resume field does not? thanks for your replys On May 20, 9:13 pm, Karen Tracey wrote: > On Wed, May 20, 2009 at 2:39 AM, watad wrote: > > > this is my form after thomas reply: > > > > {{ form.as_p }} > > > > > > > and this is my view after your reply : > > > def careerspage(request): > > if request.method == 'POST': > > form = CareerForm(request.POST,request.FILES) > > if form.is_valid(): > > form.save() > > return HttpResponseRedirect('/thanks') > > else: > > form = CareerForm() > > return render_to_response('careers.html', {'form':form}) > > > the validation for the resume upload still failing when i submit > > im reading the link u have posted to check whats wrong another help > > will be appriciated :) > > If I cut-and-paste that view, that form (fixing up the oddly broken line) > and your models from your earlier note into a test project and test out that > view, I get a page with a form. When I actually submit a file using that > form, I get redirected to '/thanks/', which gives me a "Page not found" > since I didn't set up any mapping for thanks. So, somehow you are not > actually running the code you have posted, or using the template you think > you are. At this point you need to do the standard debugging things -- > start putting prints in to test the value of variables, etc. What you have > posted here does work. > > Karen- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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 validation always failing
the form is working fine now , actually my form was inside another form , that was the problem On May 22, 6:55 pm, watad wrote: > hi karen , actually im runing this code , after submit i can see all > the data inside the model ,only the filefield resume is empty , of > course when i test this i add (blank=True, null=True) to my resume > field , so why do u think the other fileds is geeting the data > submitted by the form and the resume field does not? > thanks for your replys > > On May 20, 9:13 pm, Karen Tracey wrote: > > > > > On Wed, May 20, 2009 at 2:39 AM, watad wrote: > > > > this is my form after thomas reply: > > > > > > {{ form.as_p }} > > > > > > > > > > and this is my view after your reply : > > > > def careerspage(request): > > > if request.method == 'POST': > > > form = CareerForm(request.POST,request.FILES) > > > if form.is_valid(): > > > form.save() > > > return HttpResponseRedirect('/thanks') > > > else: > > > form = CareerForm() > > > return render_to_response('careers.html', {'form':form}) > > > > the validation for the resume upload still failing when i submit > > > im reading the link u have posted to check whats wrong another help > > > will be appriciated :) > > > If I cut-and-paste that view, that form (fixing up the oddly broken line) > > and your models from your earlier note into a test project and test out that > > view, I get a page with a form. When I actually submit a file using that > > form, I get redirected to '/thanks/', which gives me a "Page not found" > > since I didn't set up any mapping for thanks. So, somehow you are not > > actually running the code you have posted, or using the template you think > > you are. At this point you need to do the standard debugging things -- > > start putting prints in to test the value of variables, etc. What you have > > posted here does work. > > > Karen- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
djapian not working with apach2
hi all, im using djapian for my search , it seems to work fine when i run it in django development server but when i configure my sites to use apach2 im always getting this error when i try to search : "Caught OSError while rendering: [Errno 13] Permission denied: '/ index'" i am sure it is not a folder permission issue because when i run my sites using ./manage.py runserver i get the results of my search. im using mod_wsgi my locasites.conf : # --- ServerName mysite.name ServerAlias mysitealias WSGIScriptAlias / "/path/to/my/apache/file.wsgi" Allow from all Alias /site_media/ "/path/to/mysite/media/" Order allow,deny Options Indexes FollowSymLinks Allow from all IndexOptions FancyIndexing Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/ contrib/admin/media/" Order allow,deny Options Indexes FollowSymLinks Allow from all IndexOptions FancyIndexing this is repeated for all the sites. can anyone help with issue regards -- 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: djapian not working with apach2
thanks Skylar i have used chmod 777 -R for /index , but it didnt work maybe because as u said the owner of the web process is different than the user im using anyway i used the absolute path as Graham suggested down and it is working fine thank you for your quick response On Jun 21, 9:59 pm, Skylar Saveland wrote: > I would guess that you are trying to access /index with the webserver > user but that is owned by another user and the user that owns the web > process has not the sufficient permissions to do the attempted > operation. Set the permissions on the directory accordingly, perhaps > ownership as well. You could just nuke the permissions with a chmod > 777 /index (or so) if security is not crucial. Otherwise you need to > give permissions to the dir to your webserver user in a less nukular > way. > > You could also run the wsgi process(es) as the user of your choice > using > perhapshttp://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDae... > hope that helps. > > On Jun 21, 10:03 am, watad wrote: > > > > > hi all, > > > im using djapian for my search , it seems to work fine when i run it > > in django development server > > but when i configure my sites to use apach2 im always getting this > > error when i try to search : > > > "Caught OSError while rendering: [Errno 13] Permission denied: '/ > > index'" > > i am sure it is not a folder permission issue because when i run my > > sites using ./manage.py runserver i get the results of my search. > > > im using mod_wsgi > > > my locasites.conf : > > > # --- > > > > > ServerName mysite.name > > ServerAlias mysitealias > > > WSGIScriptAlias / "/path/to/my/apache/file.wsgi" > > > > Allow from all > > > > > Alias /site_media/ "/path/to/mysite/media/" > > > > Order allow,deny > > Options Indexes FollowSymLinks > > Allow from all > > IndexOptions FancyIndexing > > > > > Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/ > > contrib/admin/media/" > > > admin/media/"> > > Order allow,deny > > Options Indexes FollowSymLinks > > Allow from all > > IndexOptions FancyIndexing > > > > > > > > this is repeated for all the sites. > > > can anyone help with issue > > regards -- 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: djapian not working with apach2
thanks a lot Graham!!! :) i used absolute path and it is working fine On Jun 22, 3:01 am, Graham Dumpleton wrote: > On Jun 22, 12:03 am, watad wrote: > > > > > > > hi all, > > > im using djapian for my search , it seems to work fine when i run it > > in django development server > > but when i configure my sites to use apach2 im always getting this > > error when i try to search : > > > "Caught OSError while rendering: [Errno 13] Permission denied: '/ > > index'" > > i am sure it is not a folder permission issue because when i run my > > sites using ./manage.py runserver i get the results of my search. > > > im using mod_wsgi > > > my locasites.conf : > > > # --- > > > > > ServerName mysite.name > > ServerAlias mysitealias > > > WSGIScriptAlias / "/path/to/my/apache/file.wsgi" > > > > Allow from all > > > > > Alias /site_media/ "/path/to/mysite/media/" > > > > Order allow,deny > > Options Indexes FollowSymLinks > > Allow from all > > IndexOptions FancyIndexing > > > > > Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/ > > contrib/admin/media/" > > > admin/media/"> > > Order allow,deny > > Options Indexes FollowSymLinks > > Allow from all > > IndexOptions FancyIndexing > > > > > > > > this is repeated for all the sites. > > > can anyone help with issue > > Don't use relative path names in your code, you must use absolute path > names. > > As the current working directory under Apache is usually '/', relative > path names will resolve relative to that and not your site directory > as with runserver. Thus, if you have simple 'index' in your code as > relative path name, that will resolve to '/index' and because Apache > user cannot write to '/' directory you will get an OSError like you > are seeing. > > Graham -- 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django-autofixture giving import error (no module named keyczar)
hi all did anyone used django-autofixture , i followed the instructions on this link : http://pypi.python.org/pypi/django-autofixture/0.2.2 i installed django-autofixture added the 'autofixture' to my INSTALLED_APPS for example my app name is company , my model name is product i use this command : django-admin.py loadtestdata company.product:3 it is failing for all models with the same error: Traceback (most recent call last): File "./manage.py", line 11, in execute_manager(settings) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ __init__.py", line 438, in execute_manager utility.execute() File "/usr/local/lib/python2.6/dist-packages/django/core/management/ __init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ base.py", line 218, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.6/dist-packages/django/db/ transaction.py", line 299, in _commit_on_success res = func(*args, **kw) File "/usr/local/lib/python2.6/dist-packages/autofixture/management/ commands/loadtestdata.py", line 192, in handle autofixture.autodiscover() File "/usr/local/lib/python2.6/dist-packages/autofixture/ __init__.py", line 168, in autodiscover import_module("%s.tests" % app) File "/usr/local/lib/python2.6/dist-packages/django/utils/ importlib.py", line 35, in import_module __import__(name) File "/usr/local/lib/python2.6/dist-packages/django_extensions/tests/ __init__.py", line 3, in from django_extensions.tests.encrypted_fields import EncryptedFieldsTestCase File "/usr/local/lib/python2.6/dist-packages/django_extensions/tests/ encrypted_fields.py", line 2, in from keyczar import keyczar ImportError: No module named keyczar anyone faced the same issue any help ??? -- 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django using apache2 and mod_wsgi
dear all i am using django with apache2 and mod_wsgi with djapian as my search engine i have noticed two major issues so far : 1) the first issue is when i use djapian im stuck in a deadlock when i call any Xapian method or function (this is explained in this ticket http://trac.xapian.org/ticket/185) i used the solution posted there for mod_wsgi i added WSGIApplicationGroup %{GLOBAL} then djapian search started to work again but i noticed that my sites css and contents was corrupted and the content of my sites was mixed, i removed WSGIApplicationGroup % {GLOBAL} and the sites was rendering normally again.(of course I am restarting apache continually) 2) i am also getting problems with different browsers , meaning when i use firefox, sites render normally but with ie 7 or 8 they are not rendering properly , i thought at the beginning it is css browsers compatibility issue but when i run my sites using django development server (using runserver command)i get my sites working fine for both ie and firefox has anyone faced similar issues please help , any suggestion is appreciated 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-us...@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.
django using apache2 and mod_wsgi
dear all i am using django with apache2 and mod_wsgi with djapian as my search engine i have noticed two major issues so far : 1) the first issue is when i use djapian im stuck in a deadlock when i call any Xapian method or function (this is explained in this ticket http://trac.xapian.org/ticket/185) i used the solution posted there for mod_wsgi i added WSGIApplicationGroup %{GLOBAL} then djapian search started to work again but i noticed that my sites css and contents was corrupted and the content of my sites was mixed, i removed WSGIApplicationGroup % {GLOBAL} and the sites was rendering normally again.(of course I am restarting apache continually) 2) i am also getting problems with different browsers , meaning when i use firefox, sites render normally but with ie 7 or 8 they are not rendering properly , i thought at the beginning it is css browsers compatibility issue but when i run my sites using django development server (using runserver command)i get my sites working fine for both ie and firefox has anyone faced similar issues please help , any suggestion is appreciated 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-us...@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.
problem using mod_wsgi with djapian
dear all i am using django with apache2 and mod_wsgi with djapian as my search engine i have noticed a major issue: when i use djapian im stuck in a deadlock when i call any Xapian method or function (this is explained in this ticket http://trac.xapian.org/ticket/185) i used the solution posted there for mod_wsgi i added WSGIApplicationGroup %{GLOBAL} then djapian search started to work again but i noticed that my sites css and contents was corrupted and the content of my sites was mixed, i removed WSGIApplicationGroup % {GLOBAL} and the sites was rendering normally again.(of course I am restarting apache continually) any suggestion will be appriciated 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-us...@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.
problem using mod_wsgi with djapian
dear all i am using django with apache2 and mod_wsgi with djapian as my search engine i have noticed a major issue: when i use djapian im stuck in a deadlock when i call any Xapian method or function (this is explained in this ticket http://trac.xapian.org/ticket/185) i used the solution posted there for mod_wsgi i added WSGIApplicationGroup %{GLOBAL} then djapian search started to work again but i noticed that my sites css and contents was corrupted and the content of my sites was mixed, i removed WSGIApplicationGroup % {GLOBAL} and the sites was rendering normally again.(of course I am restarting apache continually) any suggestion will be appriciated 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-us...@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.