Re: Validating data for use directly in a model (not via forms)

2015-10-21 Thread Yunti
Thanks, yes I did look at model validation in the docs - it looked to be tied to use via forms. I hadn't realised that it's not called automatically when an instance is created. So if I was to validate when using get_or_create method would I then manually call full_clean() after get_or_create

Re: Validating data for use directly in a model (not via forms)

2015-10-21 Thread Simon Charette
Hi Yunti, Did you read about model level validation ? Calling model_instance.full_clean() triggers validation but it's not implicitly called when you save an instance. For your date case you'll have to include a l

Validating data for use directly in a model (not via forms)

2015-10-21 Thread Yunti
I have a django project where I want to save web scraped data to the database via the django ORM- which will be used in the django app. The data is currently in the form of JSON -> converted to python dict via json.loads I setup my model with the narrowest/ most constrained field type possible