# Path: apps/projects/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=100)
#     description = models.TextField()
#     logo = ImageWithThumbsField(upload_to='images/projects', null=True, blank=True, sizes=((200, 200), (90, 90), ))
#     sponsor = models.CharField(max_length=100)
#     github = models.CharField(max_length=80, null=True, blank=True)
#     status = models.CharField(max_length=100, choices=PROJECT_STATES)
#     start_date = models.DateField()
#     end_date = models.DateField(null=True, blank=True)
#     slug = models.SlugField(max_length=100, blank=True)
# 
#     def github_link(self):
#         return "http://github.com/" + self.github
# 
#     def github_feed(self):
#         return self.github_link() + "/commits/master.atom"
# 
# 
#     def finished(self):
#         return self.end_date is not None
# 
#     def __unicode__(self):
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         self.slug = slugify(self.name)
#         if self.finished():
#             self.status = 'finalizado'
#             super(Project, self).save(*args, **kwargs)
#         else:
#             super(Project, self).save(*args, **kwargs)
# 
# class Document(models.Model):
#     title = models.CharField(max_length=100)
#     description = models.TextField()
#     file = models.FileField(upload_to='files/projects')
#     project = models.ForeignKey(Project)
#     uploaded_at = models.DateTimeField(auto_now_add=True)
# 
#     def __unicode__(self):
#         return self.title + ' - ' + self.description


from django.contrib import admin
from apps.projects.models import Project, Document


class DocumentInline(admin.StackedInline):
    model = Document
    extra = 1


class ProjectAdmin(admin.ModelAdmin):
    inlines = [DocumentInline]



# Path: apps/projects/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=100)
#     description = models.TextField()
#     logo = ImageWithThumbsField(upload_to='images/projects', null=True, blank=True, sizes=((200, 200), (90, 90), ))
#     sponsor = models.CharField(max_length=100)
#     github = models.CharField(max_length=80, null=True, blank=True)
#     status = models.CharField(max_length=100, choices=PROJECT_STATES)
#     start_date = models.DateField()
#     end_date = models.DateField(null=True, blank=True)
#     slug = models.SlugField(max_length=100, blank=True)
# 
#     def github_link(self):
#         return "http://github.com/" + self.github
# 
#     def github_feed(self):
#         return self.github_link() + "/commits/master.atom"
# 
# 
#     def finished(self):
#         return self.end_date is not None
# 
#     def __unicode__(self):
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         self.slug = slugify(self.name)
#         if self.finished():
#             self.status = 'finalizado'
#             super(Project, self).save(*args, **kwargs)
#         else:
#             super(Project, self).save(*args, **kwargs)
# 
# class Document(models.Model):
#     title = models.CharField(max_length=100)
#     description = models.TextField()
#     file = models.FileField(upload_to='files/projects')
#     project = models.ForeignKey(Project)
#     uploaded_at = models.DateTimeField(auto_now_add=True)
# 
#     def __unicode__(self):
#         return self.title + ' - ' + self.description


# Path: apps/projects/admin.py
from django.contrib import admin
from apps.projects.models import Project, Document



class DocumentInline(admin.StackedInline):
    model = Document
    extra = 1


class ProjectAdmin(admin.ModelAdmin):
    inlines = [DocumentInline]



admin.site.register(Project, ProjectAdmin)