Hey guys, I just did the big switch from PHP and I'm wondering if you
can help me solve this issue the django way.

The big picture is, we've got news associated with images and videos.
Those "medias" can be ordered and must provide thumbnails for the
client side.

So far i came up with inline ordering in the admin and thumbnail
generations via sorl.
I found out ffmpeg could easily extract thumbnails from videos so i
was about to try to build a wrapper around it to handle video files
the way sorl does with images via PIL. Do you know any other way to
generate video thumbnails?

In order to structure the project i built a django app called "media"
and defined a VideoField(forms.FileField) class, this way we extract .
I'm planing to use an intermediate field called MediaField which will
handle the abstraction with a dictionary association based on the
model type attribute.

class NewsMedia(models.Model):
    """
    News Media
    """
    MEDIA_CHOICES = (
        ('image', _('image')),
        ('video', _('video')),
    )
    news             = models.ForeignKey(News)
    type             = models.CharField(max_length=1,
choices=MEDIA_CHOICES)
    media            = models.MediaField(medias={
                                                 'images':
models.ImageField(upload_to='uploads/images/'),
                                                 'video' :
models.VideoField(upload_to='uploads/videos/'),
                                                 },
                                         type_field='type');
    order            = models.IntegerField(null=True, blank=True)

    class Meta:
        ordering     = ('order',)

Also i'm having problems trying to figure out whats the exact
difference between django.form.FileField and
django.db.models.FileField.

I'd greatly appreciate If you have any idea how to implement those
features or know an already existing solution.

thanks,
Simon

-- 
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.

Reply via email to