Hello,
I am really struggling with the forms in django. Its very
nice that we
get simple forms, including validation, for free, but we
don't seem to
get anything else. I understand that it is possible to
write a custom
manipulator, but it is completely undocumented, and I'm
struggling with
getting one working. What's more, I can't see any way to
make a custom
manipulator dynamic at all. That is, I'd like to create
forms, with a
little javascript button that says "Add More
Fields". I'll give an
example.
Lets say I have a photo gallery application, with these
models:
class Gallery(models.Model):
def __str__(self):
return self.client+" - "+self.name
added = models.DateTimeField(auto_now=True)
name = models.CharField(maxlength=75)
description = models.TextField(null=True)
class Composite(models.Model):
gallery = models.ForeignKey(Gallery, db_column='gallery')
added = models.DateTimeField()
name = models.CharField(maxlength=75,core=True)
description = models.TextField()
fullsize =
models.ImageField(upload_to=os.path.join(settings.SITE_ROOT,
settings.MEDIA_RELATIVE_PATH),height_field=True,
width_field=True)
thumbnail =
models.ImageField(upload_to=os.path.join(settings.SITE_ROOT,
settings.MEDIA_RELATIVE_PATH),height_field=True,
width_field=True)
I know these models probably aren't perfect, but I'm new to
this. And,
at any rate, this still gives me a good base for explaining
what I'm
trying to do.
So, now, I want to make a form for adding photos to the
gallery.
There's no way that I want to make my users submit one image
at a time
to this gallery. In fact, I'd like to give my user the
ability to add
as many (or as few) images to their gallery as they like.
So, I'd like
to have a form that starts out with, say, 5 image upload
forms, and
then has a little js button next to it, that adds another
upload form,
to a limited point of say, 20 (but that should be variable,
to my
liking, too).
Can I do this with django? I know that I need a custom
manipulator.
But, I have NO idea where to start. A tutorial, or some
code would be
great. I have read the django code, and its really not
helping. So,
please, help me get started!
--~--~---------~--~----~------------~-------~--~----~
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 unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|