Streamlining Model validation of ForeignKeys

2024-05-10 Thread Shaheed Haque
validation using Form.clean_xxx(). 2. Form cross-field validation using Form.clean(). 3. Model validation, including validating the FK. like this: ... File "/.../django/forms/forms.py", line 197, in is_valid return self.is_bound and not self.errors File "/.../django/forms/forms.py

Re: Model validation across relationships

2014-03-24 Thread Joshua Pokotilow
e_numbers.exists(): >> raise ValidationError("SMS notifications cannot be enabled >> because this user has no phone number") >> >> I *think* it’s OK, but the documentation for Model.clean() seems >> somewhat vague about what sorts of checks one

Re: Model validation across relationships

2014-03-23 Thread Simon Charette
r.phone_numbers.exists(): > raise ValidationError("SMS notifications cannot be enabled > because this user has no phone number") > > I *think* it’s OK, but the documentation for Model.clean() seems somewhat > vague about what sorts of checks one may implement. S

Model validation across relationships

2014-03-21 Thread Joshua Pokotilow
Error("SMS notifications cannot be enabled because this user has no phone number") I *think* it’s OK, but the documentation for Model.clean() seems somewhat vague about what sorts of checks one may implement. Specifically, it says, “This method should be used to provide custom model valida

Re: conditional model validation

2012-09-28 Thread Lachlan Musicman
On Friday, September 28, 2012, Babatunde Akinyanmi wrote: > Let me try to assist. A forms is_valid method causes 3 types of > cleaning methods to be run. Based on that, I'm sure you really don't > need to override it. > > Yes, I've just discoverde the ValidationError e part of the docs :| > I r

Re: conditional model validation

2012-09-27 Thread Babatunde Akinyanmi
Let me try to assist. A forms is_valid method causes 3 types of cleaning methods to be run. Based on that, I'm sure you really don't need to override it. I really don't understand what you mean by "I want the description field to be not blank/not the empty string" so maybe I could have been of mor

conditional model validation

2012-09-27 Thread Lachlan Musicman
Hola, I'm searching without much luck and can't see the answer in the docs. Am wanting to override the is_valid() method on a model (I think that's what I want). Basically, I have a choices field, and if one of those choices is selected, then I want a description field to be not blank/not the em

Re: Model Validation with Exception Handling

2012-09-13 Thread Jani Tiainen
ddress must be unique. It could either fail because 1. It's not Unique (or) 2. It's an invalid email address. What I really want to do is determine the exception/error-type so that I can handle it appropriately. On Wed, Sep 12, 2012 at 7:09 PM, Kurtis mailto:kurtis.mull...@gmail.com>>

Re: Model Validation with Exception Handling

2012-09-12 Thread Kurtis Mullins
27;s an invalid email address. What I really want to do is determine the exception/error-type so that I can handle it appropriately. On Wed, Sep 12, 2012 at 7:09 PM, Kurtis wrote: > Hey Guys, > > Do you have any suggestions on a good way to grab error types during Model > Validation?

Model Validation with Exception Handling

2012-09-12 Thread Kurtis
Hey Guys, Do you have any suggestions on a good way to grab error types during Model Validation? I'm not using Forms or HTML. First, here's a simplified snippet showing my current format for Model Data Validation. my_object = MyModel(**data_dict) try: my_object.

Re: Model validation fails, when inherited model redeclare parent field

2012-04-03 Thread shiva
Jani, thank you. 2012/4/4 Jani Tiainen : > Hi, > > You'ew hitting limitation of Django ORM which prohibits overriding fields. > > https://docs.djangoproject.com/en/1.3/topics/db/models/#field-name-hiding-is-not-permitted > > > 4.4.2012 6:34, shiva kirjoitti: > >> Hello! >> >> In our apps (that use

Re: Model validation fails, when inherited model redeclare parent field

2012-04-03 Thread Jani Tiainen
Hi, You'ew hitting limitation of Django ORM which prohibits overriding fields. https://docs.djangoproject.com/en/1.3/topics/db/models/#field-name-hiding-is-not-permitted 4.4.2012 6:34, shiva kirjoitti: Hello! In our apps (that use Django 1.2.7) we use following models: class BaseRegistratio

Model validation fails, when inherited model redeclare parent field

2012-04-03 Thread shiva
Hello! In our apps (that use Django 1.2.7) we use following models: class BaseRegistration(models.Model): exhibition = models.ForeignKey(...) year = models.IntegerField(...) user = models.ForeignKey('auth.User') class BarcodeRegistration(BaseRegistration): class M

modelForm validation -> model validation -> trigger field validation?

2012-01-25 Thread Sven
hi there, has anyone of you an idea in which cycle the field method of ForeignKey.validate is triggered? I have a custom ForeignKey Field where i override the validate method. So i expect that ModelForm validation triggers -> Model validation (clean methods) and this trigg

model validation after related objects are updated

2011-10-21 Thread sspross
hi all i have a admin model with tabluarinlines. i want to do some additinal validations in the clean() function of the model, but the validations (sum aggregation) depends on the relatated objects (inlines). where can i "hook" me in, to perform the validations after the related objects were sav

Re: form.is_valid() NOT triggering model validation?

2011-09-29 Thread momo2k
Well, with the new knowledge about the debugger I found the place where BaseModelForm calls all three form-validation methods in forms/ models.py:306:_post_form Sorry. On Sep 29, 9:26 pm, momo2k wrote: > That explains my thoughts that the debugger is "disturbing" the > correct execution of the c

Re: form.is_valid() NOT triggering model validation?

2011-09-29 Thread momo2k
That explains my thoughts that the debugger is "disturbing" the correct execution of the code, but this discussion does *not* (!) answer my question where the *model* of a *ModelForm* gets full_clean- ed - and why it doesn't do so in my case. On Sep 29, 8:48 pm, Shawn Milochik wrote: > This exact

Re: form.is_valid() NOT triggering model validation?

2011-09-29 Thread Shawn Milochik
This exact thing was just discussed on this list. https://groups.google.com/d/topic/django-users/R2HUGqZ1BAQ/discussion -- 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 unsub

form.is_valid() NOT triggering model validation?

2011-09-29 Thread momo2k
rrors attribute of a ModelForm has always triggered form validation, but as of Django 1.2, it will also trigger model validation. This has the side-effect of cleaning the model you pass to the ModelForm constructor. For instance, calling is_valid() on your form will convert any date fields on your mod

Re: Model Validation

2011-09-25 Thread Kurtis Mullins
Looks like you want to use this field: https://docs.djangoproject.com/en/dev/ref/models/fields/#positiveintegerfield On Sat, Sep 24, 2011 at 11:54 PM, jenia ivlev wrote: > I have a model M that has a field num=models.IntegerField() > I have a modelform called 'F' for model 'M'. > I want to ensur

Model Validation

2011-09-24 Thread jenia ivlev
I have a model M that has a field num=models.IntegerField() I have a modelform called 'F' for model 'M'. I want to ensure that num is never negative. If I do validation in my form class, 'F', then i can do clean_num(): if negative than throw ValidationError('Num can never be negative'). This valid

How to override the model validation on server start?

2011-03-15 Thread Allan
hi Everyone I have a model that i exported from a legacy database. when i start the server it tells me that some of the fields cannot have unique=true with a string CharField with a length over 255. Is there a way to override the model validation that runs on server start? Thanks, Allan -- You

Re: Possible bug in model validation

2011-02-03 Thread Karen Tracey
On Thu, Feb 3, 2011 at 12:30 PM, Miguel Araujo wrote: > Las try or I will report it as a bug as I think it is. > Your original post was a bit sparse on code/traceback details for the actual problem you observed. The only specific code you showed was the lines you added to work around the problem

Re: Possible bug in model validation

2011-02-03 Thread Miguel Araujo
everyone, >> >> I have a model A that has a overwritten save method that updates a model >> B's field. Both (A & B) have model validation using full_clean method. >> Problem is that B model's validation fails when updating the field, because >> it raises an Integr

Re: Possible bug in model validation

2011-01-28 Thread Miguel Araujo
Well, I'm just trying to figure out if this should be reported. Thanks, regards Miguel Araujo @maraujop 2011/1/22 Miguel Araujo > Hi everyone, > > I have a model A that has a overwritten save method that updates a model > B's field. Both (A & B) have model v

Possible bug in model validation

2011-01-22 Thread Miguel Araujo
Hi everyone, I have a model A that has a overwritten save method that updates a model B's field. Both (A & B) have model validation using full_clean method. Problem is that B model's validation fails when updating the field, because it raises an IntegrityError saying the primary key

Re: How long is a model validation heavy testsuite supposed to run?

2010-10-13 Thread Jonathan Barratt
On 13 ?.?. 2010, at 22:07, Javier Guerra Giraldez wrote: > 2010/10/13 Jonathan Barratt : >> not being an SQLite user myself but knowing the database image is a simple >> single file > > you'd be surprised to learn that a good single-file architecture can > be waaay faster than a more complex sys

Re: How long is a model validation heavy testsuite supposed to run?

2010-10-13 Thread Javier Guerra Giraldez
2010/10/13 Jonathan Barratt : > not being an SQLite user myself but knowing the database image is a simple > single file you'd be surprised to learn that a good single-file architecture can be waaay faster than a more complex system. (good examples include Tokyo Cabinet and Varnish and, yes, SQL

Re: How long is a model validation heavy testsuite supposed to run?

2010-10-13 Thread Jonathan Barratt
On 13 ?.?. 2010, at 17:43, Russell Keith-Magee wrote: > 2010/10/13 Jonathan Barratt : >> On 13 ?.?. 2010, at 2:31, Jorge Vargas wrote: > >> A database migration might not be the sort of effort you were looking for, >> but I can only imagine that moving from SQLite to Postgres or MySQL would >>

Re: How long is a model validation heavy testsuite supposed to run?

2010-10-13 Thread Russell Keith-Magee
2010/10/13 Jonathan Barratt : > On 13 ?.?. 2010, at 2:31, Jorge Vargas wrote: > A database migration might not be the sort of effort you were looking for, > but I can only imagine that moving from SQLite to Postgres or MySQL would > offer you the largest possible performance gains... Unlikely.

Re: How long is a model validation heavy testsuite supposed to run?

2010-10-13 Thread Russell Keith-Magee
On Wed, Oct 13, 2010 at 3:31 AM, Jorge Vargas wrote: > Hello, > > I recently inherited a project that uses a lot of model validations > and is mainly just a model (we have two django apps that use it as > their backend). > > The test suite currently returns > > Ran 460 tests in 980.347s > That is

Re: How long is a model validation heavy testsuite supposed to run?

2010-10-13 Thread Jonathan Barratt
On 13 ?.?. 2010, at 2:31, Jorge Vargas wrote: > Hello, > > I recently inherited a project that uses a lot of model validations > and is mainly just a model (we have two django apps that use it as > their backend). > > The test suite currently returns > > Ran 460 tests in 980.347s > That is runn

How long is a model validation heavy testsuite supposed to run?

2010-10-12 Thread Jorge Vargas
Hello, I recently inherited a project that uses a lot of model validations and is mainly just a model (we have two django apps that use it as their backend). The test suite currently returns Ran 460 tests in 980.347s That is running on a SQLite db. Is this normal/expected behavior ? is there a

Re: Model Validation - Prevent Datetimefield overlaps?

2010-08-30 Thread Karen Tracey
On Mon, Aug 30, 2010 at 10:34 PM, Victor Hooi wrote: > Just playing around - I noticed that setting "unique=True" on a > DateTimeField() doesn't seem to work? As in, I was able to do > something like: > > b1 = > > BandwidthUsageEntry(start_of_usage_block=datetime.datetime(2007,05,05,12,05), > > e

Model Validation - Prevent Datetimefield overlaps?

2010-08-30 Thread Victor Hooi
heya, I have a model that contains a whole bunch of bytes in/out for datetime ranges. I.e.: class BandwidthUsageEntry(models.Model): start_of_usage_block = models.DateTimeField() end_of_usage_block = models.DateTimeField() bytes_in = models.IntegerField() bytes_out = models.Intege

Re: Model validation for non-django-orm databases

2010-08-30 Thread Owen Nelson
Sounds good. Thanks for the advice! -- 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. Fo

Re: Model validation for non-django-orm databases

2010-08-30 Thread David De La Harpe Golden
On 30/08/10 15:12, Owen Nelson wrote: > I just started to wonder if the ORM would, I don't > know... "freak out" on the off-chance I run a query that returns a set of > objects with duplicate values on what is supposed to be the pk. Nah, you just get multiple objects back with the same "pk", map

Re: Model validation for non-django-orm databases

2010-08-30 Thread Owen Nelson
ing save() to make it raise NotImplementedError (it's a read-only database after all). > I'm not sure about django 1.2+ model validation with the hack, though, > or even just django 1.2. We use the hack - but presently with 1.1. > Good deal. I'd be targeting 1.2+ so I'll just hav

Re: Model validation for non-django-orm databases

2010-08-30 Thread David De La Harpe Golden
odels.CompositeField(['foo', 'bar'], primary_key=True) work, but right now it doesn't. > loads/validates I'm happy. I'm not sure about django 1.2+ model validation with the hack, though, or even just django 1.2. We use the hack - but presently with

Model validation for non-django-orm databases

2010-08-29 Thread onelson
I've got an external (read-only) database that I'd like to hook into an app I'm working on -- it violates django's pk assumption by using composite keys. I'm hoping that, given a couple of assumptions of my own, I can hook these tables up to the ORM without having the universe implode. Since the d

model validation with admin.TabularInline

2010-08-20 Thread bagheera
Take a look into pool app from django tutorial. How can i make validation of Question model to have at least two Answer entered, if admin.TabularInline is used? http://docs.djangoproject.com/en/1.2/intro/tutorial02/#adding-related-objects -- Linux user -- You received this message because

Re: Admin Model Validation on ManyToMany Field

2010-07-15 Thread Heleen
Thanks very much for your reply! I got it working now. At first I couldn't get my head around how it would work using the clean of the intermediary model. But after a night's sleep it made sense to me. In the Admin my Permission model (the users field) is an inline of Application and when I put the

Re: Admin Model Validation on ManyToMany Field

2010-07-14 Thread jaymzcd
Hi Heleen, I think this is because your running the users through an intermediate model. That changes the way you need to work with the M2M data. You should be working on the Permission model/objects instead. If you check out the M2M docs for models via an intermediate: http://docs.djangoproject.

Re: Admin Model Validation on ManyToMany Field

2010-07-14 Thread Nuno Maltez
On Wed, Jul 14, 2010 at 3:50 PM, Nuno Maltez wrote: > Sorry, I can't reproduce your error with django 1.2. > > I copied your models (just removed the intermediaty "Permission" > because I don't know your User model) into a new app and I have 2 Oops, forgot to add i made the ManyToMany a relation

Re: Admin Model Validation on ManyToMany Field

2010-07-14 Thread Nuno Maltez
Sorry, I can't reproduce your error with django 1.2. I copied your models (just removed the intermediaty "Permission" because I don't know your User model) into a new app and I have 2 scenarios Adding an Application in the admin: a) if I select a User and Folder, the validation runs just fine b)

Re: Admin Model Validation on ManyToMany Field

2010-07-14 Thread Heleen
Thank you for your reply. Yes I have selected a user and folder. I believe ManyToMany fields are always optional (hence many to many). So my users and company fields are optional, but my folder field isn't. When I add a new Application in the Admin I do specify a folder and users (if I don't I wou

Re: Admin Model Validation on ManyToMany Field

2010-07-14 Thread Nuno Maltez
Hi, Just a guess: have you actually selected a user and a folder when submitting the form? I think only valid field are present on the cleaned_data dict, and your users and folder fields are not optional (blank=True, null=True). hth, nuno On Tue, Jul 13, 2010 at 1:45 PM, Heleen wrote: > Hello,

Admin Model Validation on ManyToMany Field

2010-07-13 Thread Heleen
Hello, I have the following classes: class Application(models.Model): users = models.ManyToManyField(User, through='Permission') folder = models.ForeignKey(Folder) class Folder(models.Model): company = models.ManyToManyField(Compnay) class UserProfile(models.Model): user = models.OneToOneFie

Re: Model validation (not form validation)

2010-06-17 Thread derek
On Jun 16, 8:20 am, MH wrote: > Hi, > I'm making a model, that has a bit complex dependencies between the fields, > such as date progression (start_date must not be later than finish_date). > I'm looking for a way to validate these dependencies while creating (or > saving) the model, but I am not

Model validation (not form validation)

2010-06-16 Thread MH
Hi, I'm making a model, that has a bit complex dependencies between the fields, such as date progression (start_date must not be later than finish_date). I'm looking for a way to validate these dependencies while creating (or saving) the model, but I am not sure which approach should I use. The be

model validation fails if a field is excluded in the modelform

2010-02-09 Thread Kenneth Gonsalves
hi, I have a modelForm for a model where one field is excluded. One of the lines in my model validation needs that field - so model validation fails with a 'DoesNotExist' error. How does one get round this? The relevant parts of the model and the traceback are appended. The field e

Re: False negatives on model validation of CharField with choices

2010-01-29 Thread Thomas B. Higgins
Ramiro, great work on this! With your second patch I'm back in business - with optgroups! On a related matter, I don't often want a "blank" option when I use choices/selects. I've been setting default selections and eliminating the "blank" line as described on 11/07/07 by semenov in #4653 using a

Re: False negatives on model validation of CharField with choices

2010-01-29 Thread Thomas B. Higgins
Ramiro, great work on this! With your second patch I'm back in business - with optgroups! On a related matter, I don't often want a "blank" option when I use choices/selects. I've been setting default selections and eliminating the "blank" line as described on 11/07/07 by semenov in #4653 using a

Re: False negatives on model validation of CharField with choices

2010-01-29 Thread Ramiro Morales
On Thu, Jan 28, 2010 at 2:46 PM, Thomas B. Higgins wrote: > I've done some further checking, and see that this issue has two > parts. The first part is certainly a bug. Basically, selects with > optgroups are broken. Here's the ticket: > http://code.djangoproject.com/ticket/12722. Sorry I didn't

Re: False negatives on model validation of CharField with choices

2010-01-28 Thread Thomas B. Higgins
not be > necessary to fill the field, even if blank=False. > > FloatFields with choices and IntegerFields with choices continue to > behave as expected. > > It seems clear that when the is_valid() method is run on the form, > something bad is happening to CharFields with choices,

Re: False negatives on model validation of CharField with choices

2010-01-28 Thread Karen Tracey
reported as invalid, probably by automatic model > validation. > > My code works fine under version 1.1.1 and I see nothing in the > development documentation to explain this odd new behavior. > > Any thoughts? > What you are describing is not ringing any bells and I cannot r

False negatives on model validation of CharField with choices

2010-01-27 Thread Thomas B. Higgins
ems clear that when the is_valid() method is run on the form, something bad is happening to CharFields with choices, and this type of field only, and perfectly valid string selections or string defaults are being reported as invalid, probably by automatic model validation. My code works fine under version

Re: Model validation

2009-11-12 Thread rebus_
2009/11/12 Dirk Uys : > On Thu, Nov 12, 2009 at 2:23 PM, rebus_ wrote: > >> >> You can add custom clean methods in your form: >> >> class Event (models.Model): >>    start_date = models.DateField() >>    end_date = models.DateField() >> >>   def clean(self): >>       start = self.cleaned_data.get(

Re: Model validation

2009-11-12 Thread Dirk Uys
On Thu, Nov 12, 2009 at 2:23 PM, rebus_ wrote: > You can add custom clean methods in your form: > > class Event (models.Model): >start_date = models.DateField() >end_date = models.DateField() > >def clean(self): > start = self.cleaned_data.get('start_date', False) > end =

Re: Model validation

2009-11-12 Thread rebus_
2009/11/12 Dirk Uys : > I have a model with a from and to date: > > class Event (models.Model): >     start_date = models.DateField() >     end_date = models.DateField() > > In order to ensure start_date is always before end_date i can think of 3 > options: > > 1. Use form validation iow in the cle

Model validation

2009-11-12 Thread Dirk Uys
I have a model with a from and to date: class Event (models.Model): start_date = models.DateField() end_date = models.DateField() In order to ensure start_date is always before end_date i can think of 3 options: 1. Use form validation iow in the clean method of an inherited form 2. Use t

Re: model-validation: Excessive (and weird) queries during validation

2009-11-02 Thread Mark L.
On Nov 2, 10:27 pm, Karen Tracey wrote: > On Mon, Nov 2, 2009 at 1:41 PM, Mark L. wrote: > > > As the subject states, I am using the model-validation branch at the > > moment, which allows me to do, well, validation in the models. > > > I've however, noticed

Re: model-validation: Excessive (and weird) queries during validation

2009-11-02 Thread Karen Tracey
On Mon, Nov 2, 2009 at 1:41 PM, Mark L. wrote: > > As the subject states, I am using the model-validation branch at the > moment, which allows me to do, well, validation in the models. > > I've however, noticed a very strange behaviour of the validation > logic, - any time

model-validation: Excessive (and weird) queries during validation

2009-11-02 Thread Mark L.
As the subject states, I am using the model-validation branch at the moment, which allows me to do, well, validation in the models. I've however, noticed a very strange behaviour of the validation logic, - any time the clean() method is fired on the "materialized" (saved or ret

Re: Mutually exclusive fields in model validation

2009-09-15 Thread Daniel Roseman
On Sep 15, 11:19 pm, Sonal Breed wrote: > Thanks a lot Cliff, I implemented it in a similar manner, just wanted > to know if we > have anything like validation rules a la Access. > > Thanks again, > Sincerely, > Sonal. Not yet. Honza Kral's Google Summer of Code proje

Re: Mutually exclusive fields in model validation

2009-09-15 Thread Sonal Breed
Thanks a lot Cliff, I implemented it in a similar manner, just wanted to know if we have anything like validation rules a la Access. Thanks again, Sincerely, Sonal. On Sep 15, 3:08 pm, "J. Cliff Dyer" wrote: > Override the save method on your model, something like: > > class MyModel(models.Mode

Re: Mutually exclusive fields in model validation

2009-09-15 Thread J. Cliff Dyer
Override the save method on your model, something like: class MyModel(models.Model): field1 = models.TextField(blank=True) field2 = models.TextField(blank=True) def save(self): if (self.field1 and self.field2): raise ModelValidationError, "only one can live"

Mutually exclusive fields in model validation

2009-09-15 Thread Sonal Breed
Hi all, I have a model wherein I want to put a validation as You must enter Field1 or Field2, but not both. This model is at the back end and not visible through forms. How do I accomplish it? Thanks, Sincerely, Sonal --~--~-~--~~~---~--~~ You received this mess

Re: model validation errors

2009-09-01 Thread alain31
docs on those topics. If anyone could point a link ... Thanks, Alain. On 1 sep, 14:32, Thomas Guettler wrote: > Hi, > > Up to now Model Validation is not possible with django. You need to use > a ModelForm. The documentation contains examples how to do custom validation. > >

Re: model validation errors

2009-09-01 Thread Thomas Guettler
Hi, Up to now Model Validation is not possible with django. You need to use a ModelForm. The documentation contains examples how to do custom validation. alain31 schrieb: > Hello, I wrote a model to manage small TeX fragments: > > class LaTeX(models.Model): > latex = mode

model validation errors

2009-08-31 Thread alain31
d model.id ... - I found http://code.djangoproject.com/ticket/6845 with a patch to do model validation (1 year ago) that looks like what I need, but is it stable? Any hint ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &q

Re: Model Validation

2009-07-19 Thread sjtirtha
I just found the error. This is the correct code class AbstractContent(models.Model): viewed = models.PositiveIntegerField(max_length=7, blank=True, null=True) #rating = #ranking = created_by = models.ForeignKey(User, related_name="%(class)s_create

Re: Model Validation

2009-07-19 Thread sjtirtha
Hi, I did by mistake copy and paste the coding from my editor. But in my coding it is "User". Still I have the same error. Steve On Sun, Jul 19, 2009 at 12:36 AM, Joshua Russo wrote: > On Sat, Jul 18, 2009 at 9:03 PM, sjtirtha wrote: > >> class AbstractContent(models.Model): >> viewed

Re: Model Validation

2009-07-18 Thread Joshua Russo
On Sat, Jul 18, 2009 at 9:03 PM, sjtirtha wrote: > class AbstractContent(models.Model): > viewed = models.PositiveIntegerField(max_length=7, > blank=True, null=True) > #rating = > #ranking = > created_by = models.ForeignKey(User) > changedBy

Model Validation

2009-07-18 Thread sjtirtha
Hi, I try to call manage.py syncdb for my models, but I always get error Lasttime, I solve the problem, by defining related_name for changedBy attribute. But now, I got the same problem after I define the model as abstract. Error: One or more models did not validate: person.person: Accessor for f

Re: Model validation basics

2008-01-12 Thread zobbo
On Jan 12, 6:36 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > Did you miss the "This is an experimental feature!" note at the top of: > > http://www.djangoproject.com/documentation/models/validation/ > > ? > > Last I recall seeing it ment

Re: Model validation basics

2008-01-12 Thread Karen Tracey
te >return self.cursor.execute(sql, params) > ProgrammingError: value too long for type character varying(15) > > BANG! > > I'd be expecting for Django to tell me before postgres does, that the > field does not validate. Am I misunderstanding something? > Did you miss the &quo

Model validation basics

2008-01-12 Thread Ian J Cottee
I've actually written a couple of basic apps in Django but today I thought I'd play around with doc tests and realised I didn't know as much as I thought I did. This is all done with latest trunk. Let's take a model definition that has just the following: class PartType(models.Model): code

Re: Model Validation - Best practices

2007-11-15 Thread eriku777
Does anyone know if the Model class validate() method will be ready any time soon? I am trying to learn Django but don't want to spend a lot of time hacking save() work-arounds if new core features will resolve the issue of business logic validation within models. -- Eric -- On Oct 24, 12:11 am

Re: Model Validation - Best practices

2007-11-11 Thread [EMAIL PROTECTED]
ld love to help move this work along or contribute in any way > > possible to completing model validation. In my project it is the #1 > > missing feature, requiring quite a few violations of DRY. I have a > > large backend set of functionality where I want to use my models and >

Re: Model Validation - Best practices

2007-11-11 Thread Malcolm Tredinnick
le to call > > my_model.validate() and have things work similarly to how they do with > > newforms. > > are their open bugs or a branch where this work is being done? I > would love to help move this work along or contribute in any way > possible to completing model v

Re: Model Validation - Best practices

2007-11-11 Thread [EMAIL PROTECTED]
ith > newforms. are their open bugs or a branch where this work is being done? I would love to help move this work along or contribute in any way possible to completing model validation. In my project it is the #1 missing feature, requiring quite a few violations of DRY. I have a large backe

Re: Model Validation - Best practices

2007-10-31 Thread Malcolm Tredinnick
On Wed, 2007-10-31 at 18:05 -0700, Ken wrote: > > > On Oct 31, 6:07 pm, Ken <[EMAIL PROTECTED]> wrote: > > > > > I have a similar thing I wish to accomplish. It's not quite model > > validation, rather model completion. The form provides a field tha

Re: Model Validation - Best practices

2007-10-31 Thread Ken
On Oct 31, 6:07 pm, Ken <[EMAIL PROTECTED]> wrote: > > I have a similar thing I wish to accomplish. It's not quite model > validation, rather model completion. The form provides a field that > fills one model field but has to be munged to fill a second model

Re: Model Validation - Best practices

2007-10-31 Thread Ken
back to, say, the > admin interface or places like that. But it's the workaround you need to > do at the moment. > > Regards, > Malcolm > > -- I have a similar thing I wish to accomplish. It's not quite model validation, rather model completion. The form provides a

Re: Model Validation - Best practices

2007-10-23 Thread Malcolm Tredinnick
On Wed, 2007-10-24 at 04:40 +, Camo wrote: > Hi Guys, > > I just been working my way through Django, top framework by the way. > > Anyways I just wondering if any one can shed some light model > validation, > > It seems the only validations are either through

Re: Model Validation - Best practices

2007-10-23 Thread Kenneth Gonsalves
On 24-Oct-07, at 10:10 AM, Camo wrote: > So I was just wondering how people go about validating models. overide the save() method and add your own business rules in the model -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~--

Model Validation - Best practices

2007-10-23 Thread Camo
Hi Guys, I just been working my way through Django, top framework by the way. Anyways I just wondering if any one can shed some light model validation, It seems the only validations are either through the newforms or simple validation through the fields. But there doesn't seem to b

Re: model validation

2007-03-11 Thread Greg Donald
On 3/10/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Validation happens on the strings submitted from a form, *before* they > are converted to Python objects (since there's no guarantee we can > convert them without error). We do not have model-aware validation at > the moment, but it is co

Re: model validation

2007-03-10 Thread Malcolm Tredinnick
On Sat, 2007-03-10 at 16:59 -0600, Greg Donald wrote: > On 3/10/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > I assume you mean via some way other than a form or the admin interface, > > Model validation doesn't occur in the model itself? Validation happens on

Re: model validation

2007-03-10 Thread Greg Donald
On 3/10/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I assume you mean via some way other than a form or the admin interface, Model validation doesn't occur in the model itself? > because in those two cases, field validation should catch it. What is "field validat

Re: model validation

2007-03-10 Thread Malcolm Tredinnick
On Sat, 2007-03-10 at 11:53 -0600, Greg Donald wrote: > Why doesn't this prevent me from entering an empty string into the database? > > name = models.CharField(maxlength=32, blank=False, null=False) I assume you mean via some way other than a form or the admin interface, because in those two ca

model validation

2007-03-10 Thread Greg Donald
Why doesn't this prevent me from entering an empty string into the database? name = models.CharField(maxlength=32, blank=False, null=False) Thanks, -- Greg Donald http://destiney.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Model validation errors ...

2006-11-09 Thread ZebZiggle
Ah ... of course. Thanks James! Keep up the great work! -Sandy --~--~-~--~~~---~--~~ 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 unsubscr

Re: Re: Model validation errors ...

2006-11-09 Thread James Bennett
On 11/9/06, ZebZiggle <[EMAIL PROTECTED]> wrote: > My question is ... why is Accusation any different tan Message, > ReadMessage or any of the other tables that relate back to Player? The problem was that Accusation has *two* fields which relate to Player. When 'related_name' isn't set, that mean

Re: Model validation errors ...

2006-11-09 Thread ZebZiggle
More on this: If I change Accusation to: class Accusation(models.Model): game = models.ForeignKey(Game) player = models.ForeignKey(Player, related_name='related_player') accusedPlayer = models.ForeignKey(Player, related_name='related_accusedPlayer') isCommitted = models.BooleanFi

Model validation errors ...

2006-11-09 Thread ZebZiggle
Hi there, I've decided to drop my old 0.91 database and rebuild, rather than try to upgrade it. So, in my dev environment I've dropped the database, but now when I try to 'syncdb' I get the following validation error. Error: Couldn't install apps, because there were errors in one or more models:

Re: Errors in model validation

2006-09-25 Thread [EMAIL PROTECTED]
You can disregard this thread. This was a problem of circular references that i fixed over the weekend (before the message was moderated) by passing the ForeignKey the string of the Model name instead of the object (as per Django documentation!) Also please disregard other messages like these (s

Errors in model validation

2006-09-25 Thread Lorenzo Bolognini
Hi all, I have a problem with the app below (SVN repo with read access) and i tried everything to fix it. Probably u guys can help. It seems to me some problem with namespace import, particularly the *order* in which the names are imported. The code in the repo is already broken but u can "fix i

Re: model validation and foreign keys

2006-06-28 Thread Russell Keith-Magee
On 6/29/06, Michael Radziej <[EMAIL PROTECTED]> wrote: Hey russellm,thanks a lot for the extended model validation--it rocks! Youprobably saved me endless hours of debugging twisted things!No problems Michael - glad I could help you out. Yours,Russ

  1   2   >