~akl-web-site-team/akl-web-site/django

« back to all changes in this revision

Viewing changes to src/programos/models.py

  • Committer: Mantas Zimnickas
  • Date: 2010-06-05 16:16:40 UTC
  • Revision ID: sirexas@gmail.com-20100605161640-nmq3o8a25rdf7o9y
Almost working projects list

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    author = models.ForeignKey(User, null=True, blank=True, editable=True)
35
35
    allow_comments = models.BooleanField(default=True, blank=False, editable=True)
36
36
    category = models.ForeignKey(ProjectsCategory, null=False, blank=False, editable=True)
37
 
    image = models.ImageField(upload_to='programos', storage=uploads_storage)
 
37
    image = models.ImageField(upload_to='programos/%Y/%m/%d', storage=uploads_storage)
 
38
    objects = models.Manager()
 
39
 
 
40
    def published(self, limit=None):
 
41
        qs = Project.objects.get_query_set().filter(created__isnull=False).order_by('-created')
 
42
        if limit:
 
43
            return qs[:limit]
 
44
        return qs
 
45
 
38
46
    
39
47
    def approved_comments(self):
40
48
        return Comment.objects.for_model(self).filter(is_public=True)