# Path: quick_reports_demo/blog/models.py
# class Article(models.Model):
#     class Status:
#         DRAFT = 0
#         PUBLISHED = 1
#         CHOICES = [(DRAFT, "Draft"), (PUBLISHED, "Published")]
# 
#     title = models.CharField(max_length=190)
#     body = models.TextField()
#     slug = models.SlugField(max_length=190)
#     status = models.IntegerField(choices=Status.CHOICES, default=Status.DRAFT)
#     author = models.ForeignKey(User, related_name="blog_article_author")
#     created_at = models.DateTimeField(default=timezone.now)
# 
#     class Meta:
#         ordering = ["-created_at"]
# 
#     def __unicode__(self):
#         return self.title
# 
#     class QuickReport():
#         date_field = "created_at"
# 
#         report_set = (
#             {
#                 "name": "Published",
#                 "query": Q(status=1)
#             },
#             {
#                 "name": "Drafts",
#                 "query": Q(status=0)
#             },
#         )


from django.contrib import admin
from quick_reports_demo.blog.models import Article


class ArticleAdmin(admin.ModelAdmin):

    def __init__(self, *args, **kwargs):
        super(ArticleAdmin, self).__init__(*args, **kwargs)


# Path: quick_reports_demo/blog/models.py
# class Article(models.Model):
#     class Status:
#         DRAFT = 0
#         PUBLISHED = 1
#         CHOICES = [(DRAFT, "Draft"), (PUBLISHED, "Published")]
# 
#     title = models.CharField(max_length=190)
#     body = models.TextField()
#     slug = models.SlugField(max_length=190)
#     status = models.IntegerField(choices=Status.CHOICES, default=Status.DRAFT)
#     author = models.ForeignKey(User, related_name="blog_article_author")
#     created_at = models.DateTimeField(default=timezone.now)
# 
#     class Meta:
#         ordering = ["-created_at"]
# 
#     def __unicode__(self):
#         return self.title
# 
#     class QuickReport():
#         date_field = "created_at"
# 
#         report_set = (
#             {
#                 "name": "Published",
#                 "query": Q(status=1)
#             },
#             {
#                 "name": "Drafts",
#                 "query": Q(status=0)
#             },
#         )


# Path: quick_reports_demo/blog/admin.py
from django.contrib import admin
from quick_reports_demo.blog.models import Article



class ArticleAdmin(admin.ModelAdmin):

    def __init__(self, *args, **kwargs):
        super(ArticleAdmin, self).__init__(*args, **kwargs)


    list_display = ('pk', 'title', 'created_at', 'status')