from django.db import models
from django.contrib import admin
# Create your models here.
class BlogPost(models.Model):
    title = models.CharField(max_length=150)
    body = models.TextField()
    timestamp = models.DateTimeField()

    class Meta:
        ordering = ('-timestamp',)


class BlogPostAdmin(admin.ModelAdmin):
    list_display = ("title", 'timestamp')


class Links(models.Model):
    """
        A model for links to other sites
    """
    label = models.CharField(max_length=100)
    site_link = models.CharField(max_length=300)
    slug = models.SlugField()

    class Meta:
        ordering = ['label']
        verbose_name_plural = "links"

    def __unicode__(self):
        return self.label


admin.site.register(BlogPost, BlogPostAdmin)
admin.site.register(Links)
