Commit 8f6731e3 authored by luxcem's avatar luxcem

migrations and admin for articles / votes

parent 60d8e115
from django.contrib import admin from django.contrib import admin
# Register your models here. from .models import Article, UnDVotes
admin.site.register(Article)
admin.site.register(UnDVotes)
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-22 14:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rp', '0002_undvotes'),
]
operations = [
migrations.AlterModelOptions(
name='article',
options={'verbose_name': 'Article', 'verbose_name_plural': 'Articles'},
),
migrations.AlterModelOptions(
name='undvotes',
options={'verbose_name': 'Vote', 'verbose_name_plural': 'Votes'},
),
migrations.AddField(
model_name='article',
name='und_score',
field=models.IntegerField(default=0),
),
]
...@@ -18,3 +18,7 @@ class Article(UnDVotedMixin): ...@@ -18,3 +18,7 @@ class Article(UnDVotedMixin):
published = models.BooleanField(_("Published")) published = models.BooleanField(_("Published"))
tags = TaggableManager() tags = TaggableManager()
class Meta:
verbose_name = _("Article")
verbose_name_plural = _("Articles")
...@@ -4,6 +4,7 @@ from django.contrib.contenttypes.fields import GenericForeignKey ...@@ -4,6 +4,7 @@ from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class UnDVotes(models.Model): class UnDVotes(models.Model):
...@@ -23,6 +24,10 @@ class UnDVotes(models.Model): ...@@ -23,6 +24,10 @@ class UnDVotes(models.Model):
#: The Voted object #: The Voted object
content_object = GenericForeignKey("content_type", "object_id") content_object = GenericForeignKey("content_type", "object_id")
class Meta:
verbose_name = _("Vote")
verbose_name_plural = _("Votes")
def __str__(self): def __str__(self):
return "{}:{}:{}".format(self.user, self.content_object, self.score) return "{}:{}:{}".format(self.user, self.content_object, self.score)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment