# Path: blog/models.py
# class Post(models.Model):
#     title = models.CharField(max_length=60)
#     tags = TaggableManager()
#     author = models.ForeignKey(User, null=True)
#     body = models.TextField()
#     created = models.DateTimeField(auto_now_add=True)
# 
#     class Meta:
#         ordering = ['-created']
# 
#     def __unicode__(self):
#         return self.title
#         return unicode(self.created)
# 
# class Comment(models.Model):
#     created = models.DateTimeField(auto_now_add=True)
#     name = models.CharField(max_length=60)
#     email = models.EmailField(max_length=35, null=True)
#     body = models.TextField()
#     post = models.ForeignKey(Post)
# 
#     class meta:
#         ordering = ['-created']
# 
#     def __unicode__(self):
#         return unicode("%s: %s" % (self.post, self.body[:60]))


from django.contrib import admin
from .models import Post, Comment


# Register your models here.


class PostAdmin(admin.ModelAdmin):
    search_fields = ["title"]
    display_fields = ["title", "created"]


class CommentAdmin(admin.ModelAdmin):
    display_fields = ["post", "author", "created"]

admin.site.register(Post, PostAdmin)

# Path: blog/models.py
# class Post(models.Model):
#     title = models.CharField(max_length=60)
#     tags = TaggableManager()
#     author = models.ForeignKey(User, null=True)
#     body = models.TextField()
#     created = models.DateTimeField(auto_now_add=True)
# 
#     class Meta:
#         ordering = ['-created']
# 
#     def __unicode__(self):
#         return self.title
#         return unicode(self.created)
# 
# class Comment(models.Model):
#     created = models.DateTimeField(auto_now_add=True)
#     name = models.CharField(max_length=60)
#     email = models.EmailField(max_length=35, null=True)
#     body = models.TextField()
#     post = models.ForeignKey(Post)
# 
#     class meta:
#         ordering = ['-created']
# 
#     def __unicode__(self):
#         return unicode("%s: %s" % (self.post, self.body[:60]))


# Path: blog/admin.py
from django.contrib import admin
from .models import Post, Comment



# Register your models here.


class PostAdmin(admin.ModelAdmin):
    search_fields = ["title"]
    display_fields = ["title", "created"]


class CommentAdmin(admin.ModelAdmin):
    display_fields = ["post", "author", "created"]

admin.site.register(Post, PostAdmin)

admin.site.register(Comment, CommentAdmin)