Skip to content

Instantly share code, notes, and snippets.

@codekoala
Created June 23, 2010 22:16
Show Gist options
  • Select an option

  • Save codekoala/450642 to your computer and use it in GitHub Desktop.

Select an option

Save codekoala/450642 to your computer and use it in GitHub Desktop.
import uuid
from django.db import models
from django.contrib.auth.models import User
from cumulus.storage import CloudFilesStorage
cloudfiles_storage = CloudFilesStorage()
# Create your models here.
class Upload(models.Model):
id = models.CharField(primary_key=True, default=lambda: uuid.uuid4().hex[:10])
file = models.FileField(storage=cloudfiles_storage, upload_to='files')
description = models.CharField(blank=True, null=True, max_length=255)
date_added = models.DateTimeField(auto_now_add=True)
added_by = models.ForeignKey(User)
is_active = models.BooleanField(default=True)
def __unicode__(self):
return self.description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment