List Info

Thread: Manipulator and views problem, where to save object ?




Manipulator and views problem, where to save object ?
user name
2006-02-20 14:01:52
Oh true,
didnt get the 500 error howerver no way to raise the error
isValideImageWeight.
all the test get added, when i check in the admin view the
field
"image" is empty.

Is there a way to see what value does all fields have before
being
inserted to the db, looks like image is empty...

my model :
[...]
image = meta.ImageField(upload_to='img',
help_text=_('Photot du plat
fini') , blank=True, null = True)
[...]

the template :
[...]
<p><label for="id_image">Photo du
plat fini:
</label>{{form.image_file}}{{ form.image }}  
<i>(100*100
pixels)</i></p>
[...]

the view.py
[...]
#Validator
def isValideImageWeight(self, field_data, all_data):
	print field_data
	if len(field_data["content"]) > 100:
		raise validators.ValidationError, "file too big
!"

#Ajouter
def create_recette(request):
	manipulator = recettes.AddManipulator()
	#12 being image_fil , recettes.AddManipulator().fields
	manipulator.fields[12].validator_list.append(isValideImageW
eight)
	manipulator.fields[11].validator_list.append(isValideImageW
eight)
[...]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Manipulator and views problem, where to save object ?
user name
2006-02-20 14:18:15
spoted the proble,
any validator added will just not work

view.py
#Validator
def isFoo(self, field_data, all_data):
	raise validators.ValidationError,
"!!!!!!!!!!!!!!!!!!!!!"

def create_recette(request):
	manipulator = recettes.AddManipulator()
	manipulator.fields[8].validator_list.append(isFoo)
	manipulator.fields[6].validator_list.append(isFoo)
	manipulator.fields[5].validator_list.append(isFoo)

the error never raise how come ??


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )