On Sat, Mar 25, 2006 at 07:35:46AM -0800, sparkydeville wrote:
> To clarify the use-case, consider an article like an image gallery,
> wherein one article can have more than one image associated with it.
> Further it would be helpful if the Article add/edit form could allow
> users to add images while adding / editing articles.

How are the images integrated into the articles?

This is something I'm working on for my blog implementation.  My current
design has a model Entry to hold blog entries and a model Attachment so
I can attach images to an Entry.

class Entry(meta.Model):
        title = meta.CharField(maxlength=100)
        subtitle = meta.CharField(maxlength=100, blank=True)
        pub_date = meta.DateTimeField('date published')
        author = meta.ForeignKey(User)
        status = meta.CharField(maxlength=32, 
                        choices=STATUS_CHOICES, 
                        default='Draft',
                        radio_admin=True)
        tags = meta.ManyToManyField(Tag)
        body = meta.TextField()
        format = meta.PositiveIntegerField(choices=FORMAT_CHOICES, 
                        default=4,
                        radio_admin=True)

class Attachment(meta.Model):
        entry = meta.ForeignKey(Entry, edit_inline=meta.TABULAR, num_in_admin=2)
        url = meta.CharField('URL', maxlength=200, core=True)
        file = meta.FileField('Attachment', upload_to='attachments')

To display the attachments in an Entry I reference the URL of the
attachment in the body of the entry.  This worked for me on the detail
page of the entry, but not a list of entries.  :(

After looking around the 'Net for ways people are referencing images in
blogs and articles, it appears that everyone just dumps all of their
images into one directory.  This doesn't feel very clean to me, but I
might have to give in.

I haven't had any problems with the data base and the FileField I'm
using.  I see problems with the error handling in the edit_inline
templates.  It seems that the field groups were recently wrapped and now
the templates can't find the error messages for edit_inline fields
anymore.  Yeah, I should file a bug on it. ;)

Nate

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to