-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Yeah thank you, had an outdated django version.
but I have another fundamental question about ImageField.
If I use ImageFields in a Form, does to form handle the storage for me or have I
to save the image specially?
Because I cant figure out how ImageField works.
here is my code
model :
class ContactInfo(models.Model):
wiki_name = models.CharField(max_length=50, blank=True, null=True)
image = models.ImageField(upload_to='/site_media/userpics/', blank=True)
user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED,
num_in_admin=1, max_num_in_admin=1)
form :
class UserPicForm(ModelForm):
class meta:
model = ContactInfo
include = ('image')
view :
ci = ContactInfo.objects.get(user=current_user)
form = UserPicForm(request.POST,request.FILES, instance=ci)
if form.is_valid() :
form_data = form.save()
print form_data.image # prints an empty string and I dont know why
form :
<form id='membmer-form-userpic' enctype="multipart/form-data" method="post"
action="/member/{{user.username}}/update/picture/" >
<dt><label>Image</label></dt>
<dd><input name='image' id="member-userpic" type="file"/> </dd>
regards
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIf4OzM/NgBE4GzRgRAlVVAKCL9fye86FITb+8fiheBK7hk20B0wCffZdK
Nf6tR66EfrBEzY7waig/pXE=
=6T7t
-----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---