Re: validation of admin form with inlines

2017-02-05 Thread ludovic coues
I would hide or make the amount field read-only and set it with a pre_save signals. This way, you don't have to worry about it and you get the right value every time instead of getting an error every now and then. 2017-02-04 16:32 GMT+01:00 Roberto Russi : > I need to validate a form in the admin

Re: Validation on two user foreign keys

2015-01-28 Thread Bala Subrahmanyam Varanasi
Hi Nicole, Override the Friendship model's 'save' method to test the unique combination of (initiator, recipient). Regards, On 29 January 2015 at 08:27, Nicole Harris wrote: > Hi All, > > I have a model called 'Friendship' that includes two foreign keys to > User. One is the 'initiator' of th

Re: Validation on creation

2013-09-16 Thread Mike Dewhirst
On 17/09/2013 2:06pm, Lachlan Musicman wrote: Hola, I'm pretty sure I get this, but I thought I'd ask. With an inventory model like: class Movement(models.Model): item = models.ForeignKey(Carrier) date = models.DateField(default=timezone.now()) user = models.ForeignKey(User)

Re: validation error in Django Admin

2012-12-14 Thread Chris Cogdon
Thanks for the follow up! On Wednesday, December 12, 2012 4:21:59 PM UTC-8, Mike Dewhirst wrote: > > I'm getting an unexpected validation error in Admin which baffles me. > Any hints appreciated ... here is the traceback > > http://dpaste.com/844972/ > > At the bottom of the traceback where the

Re: validation error in Django Admin

2012-12-13 Thread Chris Cogdon
I'm going to take a guess that when you "drop one" of them, deleting it, there's still a query going on that might want to refer to the other one, and the to_python fails because that reference doesn't exist anymore. You might have better luck if you're using a OneToOne or ForeignKey (onetomany

Re: Validation error with formwizard and formset

2012-07-21 Thread Rob
The validation error i got was due to a custom view i wrote, and had nothing todo my my template etc etc. I switched back to the default example view provided by the Django site, and everything works. -- You received this message because you are subscribed to the Google Groups "Django users" g

Re: Validation For all form fields in Django templates

2012-02-22 Thread Sébastien Billion
Hi, You can generate a form easily with django ModelForm and add jquery ajax validation over. 2012/2/22 shaini sasidhar > How can I do the automatic client side form validation in django? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. >

Re: validation "warnings" in the admin?

2011-02-11 Thread Tom Evans
On Fri, Feb 11, 2011 at 7:53 PM, Greg Humphreys wrote: > I can do this easily enough with my own custom object creation view, but I'd > like to let my people still use the admin interface. > > I'd like to be able to do some validation of a created or changed object and > issue a WARNING before a

Re: Validation error messages without post

2010-08-20 Thread JP
Here is my form code as well: from django import forms from django.contrib.auth.models import User from djangoproject1.authentication.models import UserProfile class UserForm(forms.ModelForm): class Meta: model = User fields = ('username','password','email',) class UserProfile

Re: Validation and dynamically extending ChoiceField choices

2010-08-17 Thread ringemup
Oh, that sounds like a great way to handle it. Thank you! On Aug 17, 10:10 am, Alex Robbins wrote: > Maybe the ChoiceField should just be a CharField that just uses the > Select widget class? That way it won't have choices hardcoded into the > field validation. Your clean method could check that

Re: Validation and dynamically extending ChoiceField choices

2010-08-17 Thread Alex Robbins
Maybe the ChoiceField should just be a CharField that just uses the Select widget class? That way it won't have choices hardcoded into the field validation. Your clean method could check that the domain is valid. Alex On Aug 16, 1:39 pm, ringemup wrote: > I have a domain search form with two fiel

Re: Validation of dependent form fields

2010-06-14 Thread Dennis Kaarsemaker
On ma, 2010-06-14 at 11:26 -0700, Thomas Allen wrote: > Is there a way to assume one field to be invalid if another is? In the > form below, api_key can never be valid if location is not. The place to implement such checks is in the clean() method of the form, which is called after all the indivi

Re: validation error depending on widget

2009-10-16 Thread wmstudio
thanks a lot On Oct 16, 3:21 pm, Daniel Roseman wrote: > On Oct 16, 2:18 pm, wmstudio wrote: > > > > > > > Hi, > > > I have a model containing: > > > class Book(models.Model): > >     title = models.CharField(max_length=128) > >     price = models.DecimalField(max_digits=8, decimal_places=2

Re: validation error depending on widget

2009-10-16 Thread Daniel Roseman
On Oct 16, 2:18 pm, wmstudio wrote: > Hi, > > I have a model containing: > > class Book(models.Model): >     title = models.CharField(max_length=128) >     price = models.DecimalField(max_digits=8, decimal_places=2, > help_text='Please enter the price in $') >     summary = models.TextField(blank

Re: Validation

2009-08-05 Thread StevenC
There seems to be nothing on the doccumentation. On 5 Aug, 12:12, StevenC wrote: > NameError at /application/ > name 'input_formats' is not definedRequest Method: POST > Request URL:http://webapps.stamford.ac.uk/application/ > Exception Type: NameError > Exception Value: name 'input_formats' is

Re: Validation

2009-08-05 Thread StevenC
NameError at /application/ name 'input_formats' is not definedRequest Method: POST Request URL: http://webapps.stamford.ac.uk/application/ Exception Type: NameError Exception Value: name 'input_formats' is not defined On 5 Aug, 12:05, StevenC wrote: > How so i import input_format > > On 5 Aug,

Re: Validation

2009-08-05 Thread StevenC
How so i import input_format On 5 Aug, 11:51, Daniel Roseman wrote: > On Aug 5, 11:03 am, StevenC wrote: > > > > > > > Hey all!! > > > I have had some validation working but it seems to have stopped. I > > want the date format on my form to validate as DD-MM- so i have > > done the followi

Re: Validation

2009-08-05 Thread Daniel Roseman
On Aug 5, 11:03 am, StevenC wrote: > Hey all!! > > I have had some validation working but it seems to have stopped. I > want the date format on my form to validate as DD-MM- so i have > done the following within the view: > > DOB = forms.DateField(('%d/%m/%Y',),'Date Of Birth',help_text="Plea

Re: Validation with two fields

2009-05-27 Thread diogobaeder
Found it: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin Thanks anyway... :-) Diogo On May 27, 6:16 pm, diogobaeder wrote: > Thanks a lot, V! That answers my question... > > I agree with you at the architecture point... could you provide a URL >

Re: Validation with two fields

2009-05-27 Thread diogobaeder
Thanks a lot, V! That answers my question... I agree with you at the architecture point... could you provide a URL to documentation concerning specific form validation inside the admin site? Diogo On May 27, 5:36 am, V wrote: > On May 27, 5:56 am, Diogo Baeder wrote: > > > Hi, > > > I've go

Re: Validation with two fields

2009-05-27 Thread V
On May 27, 5:56 am, Diogo Baeder wrote: > Hi, > > I've got two fields, in a model object: "from_date" and "to_date". How > can I make the admin controller or model validate if the "from_date" > field has always a lower value than "to_date"? Both are > "django.db.models.DateField", but how can I c

Re: validation and the ORM layer

2009-05-25 Thread googletorp
Django 1.1 is im pure bigfix and stabalization mode, to get it out asap, so they probably wont fix this issue for version 1.1 ~Jakob On May 25, 8:32 pm, martin f krafft wrote: > also sprach Alex Gaynor [2009.05.25.1945 +0200]: > > > Django does not currently support model-validation, there is

Re: validation and the ORM layer

2009-05-25 Thread martin f krafft
also sprach Alex Gaynor [2009.05.25.1945 +0200]: > Django does not currently support model-validation, there is > a google summer of code project being done by Honza Kral to add > support for this. Good to know, thanks. This means that the feature won't be in 1.1 though, right? -- martin | htt

Re: validation and the ORM layer

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 12:35 PM, martin f krafft wrote: > Hey folks, > > while playing around with the DB API last night, we discovered that > the ORM layer does not enforce content validation. > > Since the blank field option defaults to False, we expected to be > unable to save ORM objects with

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
I completely removed pil from my system and rebuilt it with --force and now it seems to be working. Thanks for the help! On May 1, 10:23 am, George Song wrote: > Can you try the same operation using the Django development server and > see what happens? > > On 5/1/2009 7:19 AM, Jason Sypolt wrote

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread George Song
Can you try the same operation using the Django development server and see what happens? On 5/1/2009 7:19 AM, Jason Sypolt wrote: > Also, I'm going through wsgi and not mod_python. Not sure if that > makes a difference.. > > > On May 1, 10:12 am, George Song wrote: >> On 5/1/2009 6:56 AM, Jas

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
Also, I'm going through wsgi and not mod_python. Not sure if that makes a difference.. On May 1, 10:12 am, George Song wrote: > On 5/1/2009 6:56 AM, Jason Sypolt wrote: > > > I have pil 1.1.6 installed - it can find a jpeg decoder and all tests > > pass. I'm using django 1.0.2 and python 2.5 on

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
Yes, and everything looks to be installed correctly under site- packages. I guess django can find everything ok too, otherwise I'd probably get an import error. On May 1, 10:12 am, George Song wrote: > On 5/1/2009 6:56 AM, Jason Sypolt wrote: > > > I have pil 1.1.6 installed - it can find a jpeg

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread George Song
On 5/1/2009 6:56 AM, Jason Sypolt wrote: > I have pil 1.1.6 installed - it can find a jpeg decoder and all tests > pass. I'm using django 1.0.2 and python 2.5 on centos 5.3. Whenever I > try to upload a jpeg via the admin (ImageField), I get the following > validation error. > > "Upload a valid i

Re: Validation problems with formset_factory

2009-02-23 Thread mediumgrade
Worked like a charm. It was the ModelChoice field. It was trigging the errors because of the initial value I was setting. On Feb 20, 7:48 pm, Malcolm Tredinnick wrote: > On Fri, 2009-02-20 at 19:32 -0800, mediumgrade wrote: > > So, I have a form like this: > > > > class AddUserForm(forms.Form):

Re: Validation problems with formset_factory

2009-02-20 Thread Malcolm Tredinnick
On Fri, 2009-02-20 at 19:32 -0800, mediumgrade wrote: > So, I have a form like this: > > class AddUserForm(forms.Form): > username = forms.CharField(label='Username', required=False) > password1 = forms.CharField(label='Password', > widget=forms.PasswordInput) > password2 = forms.Char

Re: validation problems in inline admin form

2008-09-28 Thread Munhitsu
Hi, I have the same, so I've decided to live with the following workaround. Form.clean() is not reported properly for inlines but Form.clean_() works fine. In theory only Form.clean() is recommended for cross field validation but in fact Form.clean_() can also refer to the other fields. However t

Re: validation inline

2008-09-11 Thread Aaron C. de Bruyn
On 2008-09-09 at 22:46:52 -0700, Samuel Mathieson wrote: > Date: Tue, 9 Sep 2008 22:46:52 -0700 (PDT) > To: Django users > From: Samuel Mathieson <[EMAIL PROTECTED]> > Subject: validation inline > > Hello, I am trying to get some sort of validation inline for the > admin: > > > The validation

Re: Validation Implementation (architectural question) with newforms

2008-07-18 Thread Nash
Yesh, this looks like the fix. Thanks alot Karen! On Jul 18, 8:01 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Jul 18, 2008 at 10:47 AM, Nash <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > There are loads of places to validate your data in django. You can do > > it at the Model's field

Re: Validation Implementation (architectural question) with newforms

2008-07-18 Thread Karen Tracey
On Fri, Jul 18, 2008 at 10:47 AM, Nash <[EMAIL PROTECTED]> wrote: > > Hi all, > > There are loads of places to validate your data in django. You can do > it at the Model's field, at the Model.save() at the form's field level > clean_FIELD_NAME(), at the form level clean_data() etc. > > If I have a

Re: Validation Problem with ModelChoiceField

2008-06-27 Thread TiNo
Looking at the source, ModelChoiceField validates the given id against the initial queryset, where you provided an empty one. "models.Gallery.objects.none()" So no id's validate. I think changing none() to all() should make it work. TiNo On Jun 26, 9:01 pm, mwebs <[EMAIL PROTECTED]> wrote: > Hel

Re: Validation system for models

2008-03-07 Thread Malcolm Tredinnick
On Fri, 2008-03-07 at 14:13 -0800, Hugh Bien wrote: > For the website I'm writing, I've just been overriding the > 'validate()' method on models but that's still experimental: > > http://www.djangoproject.com/documentation/models/validation/ > > Is there a built-in validation system for Django

Re: Validation of dynamically generated forms

2007-10-11 Thread pinco
Frank, your snippet works great. I just removed the int conversion on bf_data, since I want to have f.is_valid() = false if the user submits something different than an integer. Without you I would never be able to solve the problem. Thanks a lot. On 11 Ott, 09:51, pinco <[EMAIL PROTECTED]> wr

Re: Validation of dynamically generated forms

2007-10-11 Thread pinco
Great! Thank you very much Frank. On 10 Ott, 22:03, FrankW <[EMAIL PROTECTED]> wrote: > I would swear that I posted a response to this earlier today, but it > doesn't seem to show up in the group. The problem you're having is > because of the 'cart_item_' that you are adding in. It is not being

Re: Validation of dynamically generated forms

2007-10-10 Thread FrankW
I would swear that I posted a response to this earlier today, but it doesn't seem to show up in the group. The problem you're having is because of the 'cart_item_' that you are adding in. It is not being added into the dictionary that is assigned to the form's data. >>> f.fields {'cart_item_a':

Re: Validation of dynamically generated forms

2007-10-10 Thread FrankW
If you look at f.errors or k.errors, you'll see: {'cart_item_b': [u'This field is required.'], 'cart_item_a': [u'This field is required.']} The reason for this is that the forms data looks like: {'a': '1', 'b': '2'} or {'a': 1, 'b': 2} The tricks that you're playing with changing the name of the

Re: Validation of dynamically generated forms

2007-10-08 Thread pinco
Frank, thak you for your help. I worked on the form model using bound field, and now the forms is bound. class CartForm(forms.Form): def __init__(self, a): super(CartForm, self).__init__(a) for key in a.keys(): self.fields['cart_ite

Re: Validation of dynamically generated forms

2007-10-06 Thread FrankW
In your example, self.fields[str(key)]=forms.CharField(initial=c[key]) isn't doing what you expect. You are setting the initial attribute of a field, not creating a BoundField. See django/newforms/forms.py, and look at the comments for BaseForm and Form and the code for BoundField. On Oct 6,

Re: Validation after form.save(commit=False) - newforms

2007-09-27 Thread Paddy Joy
Thanks Richard that seems like a much more logical way of doing it. Works with one slight change: form_data = request.POST.copy() form_data['domain_id'] = domain_id form = DNSRecordForm(form_data) if form.is_valid(): form.save() Paddy On Sep 27, 11:35 am, Richard Dahl <[EMAIL PROTECTED

Re: Validation after form.save(commit=False) - newforms

2007-09-26 Thread Richard Dahl
Off the top of my head, how about something like this: form_data = request.POST form_data['domain_id'] = domain_id form = DNSRecordForm(form_data) if form.is_valid(): form.save() I think you should get the idea. Obviously the DNSRecordForm will have to have the domain field in it. -ri

Re: Validation problem with newforms and initial value for URLField

2007-08-26 Thread Shev
Yes, I've created a custom clean method to deal with this for now, thanks. Perhaps the docs should be updated to have a note on that example. On my page, I wanted to include an initial "http://"; value so users would not be confused as to what was expected in the field, but the field was also op

Re: Validation problem with newforms and initial value for URLField

2007-08-26 Thread Peter Melvyn
On 8/26/07, Shev <[EMAIL PROTECTED]> wrote: > But neither should an initial field value raise an error when > the POSTed data is exactly the same as the starting value; > it should just be ignored and the value discarded. Even if you supply a valid inital value? It does not sound well for me...

Re: Validation problem with newforms and initial value for URLField

2007-08-25 Thread Shev
No, invalid data should not pass. But neither should an initial field value raise an error when the POSTed data is exactly the same as the starting value; it should just be ignored and the value discarded. On Aug 25, 7:32 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 8/25/07, Shev <[EMAIL

Re: Validation problem with newforms and initial value for URLField

2007-08-25 Thread Jeremy Dunck
On 8/25/07, Shev <[EMAIL PROTECTED]> wrote: ... > However, what I'm seeing is that when I actually do set > initial='http://' for a URLField, either in the field definition above > or via passing in a dictionary for dynamic initial values, if I then > submit/POST the form without changing the URLF

Re: Validation discrepancies between admin and newforms

2007-01-31 Thread Waylan Limberg
The admin app is currently being rebuilt to use newforms. No doubt this, plus many similar issues are being addressed there. Watch the dev list for discussions and check out the branch here: http://code.djangoproject.com/browser/django/branches/newforms-admin On 1/31/07, Kilian CAVALOTTI <[EMAIL

Re: Validation on Client Side? Django support only server side validation

2007-01-17 Thread [EMAIL PROTECTED]
I like to do my client-side validation as they go, and have a nice script that does just that on any input I add the class "required" to... tells them when it's wrong, and when it's right, before they ever hit submit. Then let the server side double-check. None of that has anything to do with dja

Re: Validation of Dynamically generated forms.

2007-01-17 Thread mojo
ok, simple example: we need a form, that consists of questions. question is a django model and we can have any number of them. let's assume, that answer is a string, so we can use text widget (in my project type of field varied for questions). in manipulator's __init__ we iterate all questions t

Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread jfagnani
It would be really nice to have validation that occurs on the client during input. Not to reduce the load on the server, but to make the feedback to the user much more immediate. I know this can be done with any of the many JavaScript libraries, and I'm using MochiKit to do this now, but it'd be

Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread Jeremy Dunck
On 1/16/07, johnny <[EMAIL PROTECTED]> wrote: I would like to push it on client, to keep my server load light. Are you really doing heavy processing to validate and/or handling so many requests that this is an issue? Don't borrow trouble. :) --~--~-~--~~~---~--

Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread James Bennett
On 1/16/07, johnny <[EMAIL PROTECTED]> wrote: Django support only server side validation. Dose it support validation on Client Side? I would like to push it on client, to keep my server load light. You could use any of the many freely-available quality JavaScript toolkits to do this. However

Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread Tim Chase
Django support only server side validation. Dose it support validation on Client Side? I would like to push it on client, to keep my server load light. Well, through JavaScript, you can do *both* server-side and client-side validation. However, not everybody flies with JS enabled (speaking

Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread Waylan Limberg
On 1/16/07, johnny <[EMAIL PROTECTED]> wrote: Django support only server side validation. Dose it support validation on Client Side? I would like to push it on client, to keep my server load light. Any client side processing would be done with javascript. However, you must always remember th

Re: Validation of Dynamically generated forms.

2007-01-16 Thread [EMAIL PROTECTED]
oldforms since the newforms are still very much in development. --~--~-~--~~~---~--~~ 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 unsubscrib

RE: Validation of Dynamically generated forms.

2007-01-16 Thread mojo
Hi. I was able to build survey kinda project using dynamic forms. Are you interested in oldforms or newforms? -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, January 16, 2007 5:45 PM To: Django users Subject:

Re: Validation 3 steep complicate form

2006-12-04 Thread MerMer
You may want to check out django.newforms which is going to be the replacement for forms and manipulators. According to a recent threads in the development forum it is already being used by in some production environments. The formal documentation is sparse but there is alot of detail in the cod

Re: Validation 3 steep complicate form

2006-12-04 Thread Jorge Gajon
Hi, On 12/3/06, GvaderTh <[EMAIL PROTECTED]> wrote: > > Hello All. I read django documentation about forms, had seek internet > and didn't found solution for situation like this: I have order form > divided to 3 steeps, after every step should be validation and if > validation is succesfull, user

Re: Validation based on a related object field (ForeignKey) value

2006-06-07 Thread mamcxyz
Forget this code... really not work :( The reason is that is necesary save *first* the parent then go for children. I test several things, like do the save in the child (expecting that "detect" is their parent is not saved) but this only insert orphan childs... Now we are 2 with the same questi

Re: Validation based on a related object field (ForeignKey) value

2006-06-07 Thread mamcxyz
Overwrite the save() methon. Example: (I wanna test if at least 1 addr is added) def save(self): #Comprobar que existe al menos UNA direccion... existe = False for addr in self.restaurantaddress_set.all(): existe = True break Why this and no

Re: Validation based on a related object field (ForeignKey) value

2006-06-07 Thread strangy
strangy wrote: > Hello, > Is there a way to validate a field in the model based on a value in a > related object (ForeignKey field) ?? > > For example: > I have an Activity object which definex a maxscore integer field and an > StudentActivity object which has a score field. Now i want to validat

Re: Validation of related objects

2005-09-28 Thread Maniac
[EMAIL PROTECTED] wrote: What I want is to be able to check that exactly 4 ansers have been given and that only one of these 4 is listed as being correct Anyone got any ideas on where I might start with this kind of thing. I noticed validator lists for certain fields but wasn't sure that this