Re: Form Validation Error: 'No' value must be either True or False.
Solved. To anyone who may come across this very obscure issue for themselves, it's entirely an error specific to my setup. I had rsync'd the code onto the live server from /home/django/rfc/ into /home/django/rfc/rfc. As it's inside the pythonpath, the code is still valid and will be executed, especially when you have various stuff in the same dir names as your app etc. I grep'd through the django code and found that only BooleanField gave my specific error and I only didn't have BooleanField anymore. So I did a grep of my code on live and found my old models.py file buried underneath everything, which did have the fields as BooleanField. Wow. 2 whole days to find that. On 3 May 2013 13:49, Darren Mansell <darren.mans...@gmail.com> wrote: > > > > On 3 May 2013 13:06, Tom Evans <tevans...@googlemail.com> wrote: > >> On Fri, May 3, 2013 at 12:38 PM, Darren Mansell >> <darren.mans...@gmail.com> wrote: >> > >> > Another bit of info, just in case anyone is currently looking at this.. >> > >> > The error is coming from >> > >> /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py >> > >> > … >> > >> > So it's failing validation because it's seeing the field as a >> > BooleanField, when I quite obviously have set it as a CharField. >> > >> > I'm absolutely stuck. >> >> In your second mail, you say that the only failing case is "live >> server with Apache 2.2.22-1ubuntu1.3 / mod-wsgi 3.3-4build1". Are you >> sure you have fully updated and restarted this server to pick up your >> changes? >> >> Cheers >> >> Tom >> >> Hey Tom, thanks for the reply. > > Yeah the live server is Ubuntu 12.04 and the dev server is actually my > laptop running Ubuntu 13.10 which accounts for the version differences. > > I'm rsyncing files from one to the other and have checked the code gets > copied which it does. > > I'm now thinking that because I've got another copy of this project > running on the server, but with older code, it's failing with that. > > I'll clone the VM and run it fully separate. > > Thanks. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Form Validation Error: 'No' value must be either True or False.
On 3 May 2013 13:06, Tom Evans <tevans...@googlemail.com> wrote: > On Fri, May 3, 2013 at 12:38 PM, Darren Mansell > <darren.mans...@gmail.com> wrote: > > > > Another bit of info, just in case anyone is currently looking at this.. > > > > The error is coming from > > > /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py > > > > … > > > > So it's failing validation because it's seeing the field as a > > BooleanField, when I quite obviously have set it as a CharField. > > > > I'm absolutely stuck. > > In your second mail, you say that the only failing case is "live > server with Apache 2.2.22-1ubuntu1.3 / mod-wsgi 3.3-4build1". Are you > sure you have fully updated and restarted this server to pick up your > changes? > > Cheers > > Tom > > Hey Tom, thanks for the reply. Yeah the live server is Ubuntu 12.04 and the dev server is actually my laptop running Ubuntu 13.10 which accounts for the version differences. I'm rsyncing files from one to the other and have checked the code gets copied which it does. I'm now thinking that because I've got another copy of this project running on the server, but with older code, it's failing with that. I'll clone the VM and run it fully separate. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Form Validation Error: 'No' value must be either True or False.
Another bit of info, just in case anyone is currently looking at this.. The error is coming from /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py class BooleanField(Field): empty_strings_allowed = False default_error_messages = { *'invalid': _("'%s' value must be either True or False."),* } description = _("Boolean (Either True or False)") def __init__(self, *args, **kwargs): kwargs['blank'] = True if 'default' not in kwargs and not kwargs.get('null'): kwargs['default'] = False Field.__init__(self, *args, **kwargs) def get_internal_type(self): return "BooleanField" def to_python(self, value): if value in (True, False): # if value is 1 or 0 than it's equal to True or False, but we want # to return a true bool for semantic reasons. return bool(value) if value in ('t', 'True', '1'): return True if value in ('f', 'False', '0'): return False *msg = self.error_messages['invalid'] % value* raise exceptions.ValidationError(msg) So it's failing validation because it's seeing the field as a BooleanField, when I quite obviously have set it as a CharField. I'm absolutely stuck. On 3 May 2013 11:13, Darren Mansell <darren.mans...@gmail.com> wrote: > Bit more info (all pointing to the same database / db server): > > test server with Django dev server : works > test server with Apache 2.2.22-6ubuntu5 / mod-wsgi 3.4-0ubuntu3 : works > > live server with Django dev server : works > live server with Apache 2.2.22-1ubuntu1.3 / mod-wsgi 3.3-4build1 : doesn't > work > > > > > On 3 May 2013 10:35, Darren Mansell <darren.mans...@gmail.com> wrote: > >> Hi all. Really really confused by this one. Can someone show me where I'm >> being stupid please? >> >> Standard Django 1.5.1 app with MySQL. Trying to save to a VARCHAR(3) >> column with a forms.CharField form field and a models.CharField model field. >> >> When I try to save the form I get this validation error: >> >> [image: Inline images 1] >> >> >> This is the MySQL column definition: >> >> `customers_impacted` varchar(3) DEFAULT NULL, >> >> >> This is from forms.py (it's a ModelForm): >> >> YES_NO = ( >> ('No', 'No'), >> ('Yes', 'Yes'), >> ) >> customers_impacted = >> forms.CharField(widget=forms.Select(choices=YES_NO),max_length=3) >> >> >> This is from models.py: >> >> customers_impacted = models.CharField(max_length=3) >> >> >> The field was originally a BooleanField but I changed it to CharField and >> I can't see anywhere it could still be getting the Boolean / True / False >> info from. >> >> Strangely, it works fine using the development server, but this error >> happens when using Apache + mod_wsgi. I've rebooted the server, restarted >> everything, tried changing collation etc. >> >> Could anyone suggest anything? Any extra logging etc I can turn on >> somewhere to show where the validation is failing? >> >> Thanks. >> Darren (confused) >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out. <>
Re: Form Validation Error: 'No' value must be either True or False.
Bit more info (all pointing to the same database / db server): test server with Django dev server : works test server with Apache 2.2.22-6ubuntu5 / mod-wsgi 3.4-0ubuntu3 : works live server with Django dev server : works live server with Apache 2.2.22-1ubuntu1.3 / mod-wsgi 3.3-4build1 : doesn't work On 3 May 2013 10:35, Darren Mansell <darren.mans...@gmail.com> wrote: > Hi all. Really really confused by this one. Can someone show me where I'm > being stupid please? > > Standard Django 1.5.1 app with MySQL. Trying to save to a VARCHAR(3) > column with a forms.CharField form field and a models.CharField model field. > > When I try to save the form I get this validation error: > > [image: Inline images 1] > > > This is the MySQL column definition: > > `customers_impacted` varchar(3) DEFAULT NULL, > > > This is from forms.py (it's a ModelForm): > > YES_NO = ( > ('No', 'No'), > ('Yes', 'Yes'), > ) > customers_impacted = > forms.CharField(widget=forms.Select(choices=YES_NO),max_length=3) > > > This is from models.py: > > customers_impacted = models.CharField(max_length=3) > > > The field was originally a BooleanField but I changed it to CharField and > I can't see anywhere it could still be getting the Boolean / True / False > info from. > > Strangely, it works fine using the development server, but this error > happens when using Apache + mod_wsgi. I've rebooted the server, restarted > everything, tried changing collation etc. > > Could anyone suggest anything? Any extra logging etc I can turn on > somewhere to show where the validation is failing? > > Thanks. > Darren (confused) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out. <>
Form Validation Error: 'No' value must be either True or False.
Hi all. Really really confused by this one. Can someone show me where I'm being stupid please? Standard Django 1.5.1 app with MySQL. Trying to save to a VARCHAR(3) column with a forms.CharField form field and a models.CharField model field. When I try to save the form I get this validation error: [image: Inline images 1] This is the MySQL column definition: `customers_impacted` varchar(3) DEFAULT NULL, This is from forms.py (it's a ModelForm): YES_NO = ( ('No', 'No'), ('Yes', 'Yes'), ) customers_impacted = forms.CharField(widget=forms.Select(choices=YES_NO),max_length=3) This is from models.py: customers_impacted = models.CharField(max_length=3) The field was originally a BooleanField but I changed it to CharField and I can't see anywhere it could still be getting the Boolean / True / False info from. Strangely, it works fine using the development server, but this error happens when using Apache + mod_wsgi. I've rebooted the server, restarted everything, tried changing collation etc. Could anyone suggest anything? Any extra logging etc I can turn on somewhere to show where the validation is failing? Thanks. Darren (confused) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out. <>
Re: Make MPs answer to us
On 6 May 2010 07:41, Darren Mansell <darren.mans...@gmail.com> wrote: > > > On 6 May 2010 00:35, Russell Keith-Magee <freakboy3...@gmail.com> wrote: > >> On Thu, May 6, 2010 at 3:04 AM, Darren Mansell <darren.mans...@gmail.com> >> wrote: >> > >> > It's election day tomorrow. This is a great web site for lots of info >> about what's really going on: >> > [http://www.38degrees.org.uk] >> >> This is a forum about using Django. The site you reference is in no >> way relevant to that topic (as far as I can make out, it's written in >> PHP). >> >> Furthermore, this a forum where the vast majority of readers are not >> eligible to vote in the UK elections. >> >> While I heartily endorse the message that you should vote when >> appropriate in your particular jurisdiction, and be well informed when >> doing so, django-users isn't the right place to start promoting your >> political viewpoints. Please don't do this again. >> >> Yours, >> Russ Magee %-) >> >> >> > Sorry Keith and everyone, accidentally loaded this mail address from my > contacts. Oops. > And of course by Keith I meant Russ. Oh dear I should just give up. -- 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: Make MPs answer to us
On 6 May 2010 00:35, Russell Keith-Magee <freakboy3...@gmail.com> wrote: > On Thu, May 6, 2010 at 3:04 AM, Darren Mansell <darren.mans...@gmail.com> > wrote: > > > > It's election day tomorrow. This is a great web site for lots of info > about what's really going on: > > [http://www.38degrees.org.uk] > > This is a forum about using Django. The site you reference is in no > way relevant to that topic (as far as I can make out, it's written in > PHP). > > Furthermore, this a forum where the vast majority of readers are not > eligible to vote in the UK elections. > > While I heartily endorse the message that you should vote when > appropriate in your particular jurisdiction, and be well informed when > doing so, django-users isn't the right place to start promoting your > political viewpoints. Please don't do this again. > > Yours, > Russ Magee %-) > > > Sorry Keith and everyone, accidentally loaded this mail address from my contacts. Oops. -- 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.
Make MPs answer to us
It's election day tomorrow. This is a great web site for lots of info about what's really going on: [http://www.38degrees.org.uk] Darren -- 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.
Dynamic App Creation
Hello. I'm looking into making a Django app that allows you to create Django models. The idea is that you should be able to add fields and user workflows using a web page that then creates a model, view, template and syncs the DB. Users can then access these newly created apps separately. An example: An accounts department of a company wants to replace their Excel files that they currently use for expenses, claims etc. with a web-based system. The web based system will have a page where you can create fields such as a field for name, field for dept, field for expense, tax etc. The page then creates a Django app with a model, view and template from this for employees to fill in to submit expenses. The employees DB will have info about who is who's manager and will then allow the page creator to include workflows - e.g. employees enters details and submits, their manager gets a mail to request authorisation, they authorise and their director then has to authorise etc. I think if something like this were to exist it would allow lots of businesses to replace static documents for workflow with web based systems. Does anyone know of anything out there that already does this kind of thing? Darren --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
User Authentication Redirect Loop
Hello. I'm trying to log a user in using the @login_required decorator. I've followed the examples on http://docs.djangoproject.com/en/dev/topics/auth/#topics-auth but I can't get it to stop spiraling into a redirect loop. I've tried everything I can think of but I'm out of ideas. Please help. My settings.py has: LOGIN_URL = '/login/' LOGIN_REDIRECT_URL = '/' My urls.py is: from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), (r'^$', 'logviewer.viewer.views.index'), (r'^(?P\D+)/(?P\S+)/$', 'logviewer.viewer.views.logview'), (r'^(?P\D+)/$', 'logviewer.viewer.views.detail'), (r'^login/$', 'django.contrib.auth.views.login'), (r'^logout/$', 'django.contrib.auth.views.logout'), ) And this is part of the views: @login_required(redirect_field_name='redirect_to') def index(request): listOfSites = os.listdir('/root/Releases/WebSites') ignoreList = ['ScriptTest', 'Supportal'] realList = [] for site in listOfSites: if site not in ignoreList: realList.append(site) return render_to_response('logviewer/index.htm', {'realList' : realList}) Firefox redirects like so: http://logviewer/login/?redirect_to=/login/%3Fredirect_to%3D/login/%253Fredirect_to%253D/login/%25253Fredirect_to%25253D/login/%2525253Fredirect_to%2525253D/login/%252525253Fredirect_to%252525253D/login/%25252525253Fredirect_to%25252525253D/login/%2525252525253Fredirect_to%2525252525253D/login/%252525252525253Fredirect_to%252525252525253D/login/%25252525252525253Fredirect_to%25252525252525253D/login/%2525252525252525253Fredirect_to%2525252525252525253D/login/%252525252525252525253Fredirect_to%252525252525252525253D/login/%25252525252525252525253Fredirect_to%25252525252525252525253D/login/%2525252525252525252525253Fredirect_to%2525252525252525252525253D/login/%252525252525252525252525253Fredirect_to%252525252525252525252525253D/login/%25252525252525252525252525253Fredirect_to%25252525252525252525252525253D/login/%2525252525252525252525252525253Fredirect_to%2525252525252525252525252525253D/login/%252525252525252525252525252525253Fredirect_to%252525252525252525252525252525253D/login/%25252525252525252525252525252525253Fredirect_to%25252525252525252525252525252525253D/login/%2525252525252525252525252525252525253Fredirect_to%2525252525252525252525252525252525253D/ The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. * This problem can sometimes be caused by disabling or refusing to accept cookies Darren --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
manage.py syncdb Ignoring Models
I'm just trying to do a bit of home development on Ubuntu 9.04 which has Python 2.6. When trying to populate the database from the models it's randomly ignoring model definitions. I have no idea what's going on but the deprecation warning of sets may be to do with it? Output of ./manage.py syncdb: darr...@lenny:/home/darth/darth$ ./manage.py syncdb /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet Creating table auth_permission Creating table auth_group Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Creating table bmi_servertype Creating table bmi_tomcatstyle Creating table bmi_server Creating table bmi_site Creating table bmi_buildtype Creating table bmi_build Creating table bmi_generalsettings Creating table django_admin_log bmi/models.py: from django.db import models import datetime class ServerType(models.Model): server_type = models.CharField('Server Use', max_length=100) def __unicode__(self): return self.server_type class TomcatStyle(models.Model): tomcat_style = models.CharField('Description', max_length=100) filesystem_location = models.CharField('Tomcat Filesystem Location (before the site name)', max_length=100) suffix = models.CharField('Site Suffix (to be appended to the site name)', max_length=100, blank=True) def __unicode__(self): return self.tomcat_style class Server(models.Model): server_name = models.CharField(max_length=50) created_date = models.DateTimeField('Date Created') server_type = models.ForeignKey(ServerType) admin_user = models.CharField(max_length=20) admin_password = models.CharField(max_length=20) ip_address = models.IPAddressField() tomcat_style = models.ForeignKey(TomcatStyle, blank=True, null=True) def __unicode__(self): return self.server_name class Site(models.Model): broker_name = models.CharField('Broker Name', max_length=50) site_name = models.CharField('Site Name', max_length=50) created_date = models.DateTimeField('Date Created') st_tomcat_server = models.ForeignKey(Server, related_name='st_tomcat') uat_tomcat_server = models.ForeignKey(Server, related_name='uat_tomcat') live_tomcat_server = models.ForeignKey(Server, related_name='live_tomcat') st_sql_server = models.ForeignKey(Server, related_name='st_sql') uat_sql_server = models.ForeignKey(Server, related_name='uat_sql') live_sql_server = models.ForeignKey(Server, related_name='live_sql') def __unicode__(self): return self.broker_name class BuildType(models.Model): build_type = models.CharField('Type of build', max_length=100) def __unicode__(self): return self.build_type class BuildStage(models.Model): build_stage_name = models.CharField(max_length=20) def __unicode__(self): return self.build_stage_name class Build(models.Model): site = models.ForeignKey(Site) current_stage = models.ForeignKey(BuildStage) created_date = models.DateTimeField('Date Created') build_release = models.CharField('Release', max_length=7, unique=True) notes = models.TextField('Build Notes') sys_test_workflow = models.BooleanField('Include System Test Workflow') proj_coord_workflow = models.BooleanField('Include Project Co-ordination') build_path = models.CharField(max_length=200, blank=True, null=True) def __unicode__(self): return self.build_release class DeployTo(models.Model): build_release = models.ForeignKey(Build) build_stage = models.ForeignKey(BuildStage) planned_date = models.DateTimeField('Planned Date') scheduled_date = models.DateTimeField('Scheduled Deployment') class GeneralSettings(models.Model): releases_dir = models.CharField('Local Path to Releases Directory', max_length=100, unique=True) class Meta: verbose_name_plural = 'General Settings' def __unicode__(self): return "General Darth settings" --~--~-~--~~~---~--~~ 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: What's the most scalable Django deployment out there currently?
On Wed, Mar 25, 2009 at 5:09 AM, Alex Gaynorwrote: > > > On Wed, Mar 25, 2009 at 1:06 AM, Graham Dumpleton < > graham.dumple...@gmail.com> wrote: > >> >> >> >> On Mar 25, 3:45 pm, Alex Gaynor wrote: >> > On Wed, Mar 25, 2009 at 12:43 AM, Adam V. wrote: >> > >> > > Curse (http://www.curse.com/) manages to stay up on WoW patch day, so >> > > that's a pretty good sign. >> > >> > Curse is no longer running on Django(it's ASP.net now I think), no idea >> if >> > that was a technical decision or not. >> >> If it using ASP.net, maybe that is why none of their addresses respond >> to me from where I am. :-) >> >> Curse was using mod_python: >> >> http://www.davidcramer.net/curse/44/what-powers-curse.html >> >> David Cramer though has since switched to mod_wsgi and has expressed >> the opinion that mod_wsgi works a lot better. >> >> Important think though is not so much the hosting mechanism but how >> well you optimise the performance of your application and database. >> >> Graham >> >> >> >> >> > David also did a good talk on scaling Django(based on his experiences at > curse) at DjangoCon, the video is on youtube. > > Alex > > As far as DBs go we are scaling MySQL quite hard. If you ensure you have the tools to support it you can use circular replication with Linux-HA to provide a single IP address that the app connects to. You can also scale out Apache with Linux-HA in this way. We've found that it's very hard to scale asp.Net/SQL platforms out but using Linux with HA it's very cheap and easy. --~--~-~--~~~---~--~~ 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: Working With ModelForms
That was a great help thanks. I also used the copy() method on the request.POST dict and I could redirect to the same view. Cheers. On Mar 24, 2009 3:43 PM, "Thomas Guettler"wrote: Hi, my guess: You need to redirect after POST. if you give request.POST to the Form, it will overwrite the values from the model with the values from request.POST. If you do a redirect after POST, the value from the model will be displayed, since POST is empty after the redirect. BTW, I often do it like this: def view(request): if request.POST: data=request.POST else: data=None form=MyForm(data) Why do you access 'build_release' in POST? It would be better the create a Field for it and access form.cleaned_data['build_release'] HTH, Thomas DarrenM schrieb: > ... > elif request.POST['build_release']: > f = BuildForm(request.POST) > ... -- 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 -~--~~~~--~~--~--~---