added application review

This commit is contained in:
Anatoly 2019-08-30 10:48:44 +03:00
parent 46faf6ecee
commit b7c1d6a48d
19 changed files with 52 additions and 0 deletions

0
apps/review/__init__.py Normal file
View File

7
apps/review/admin.py Normal file
View File

@ -0,0 +1,7 @@
from django.contrib import admin
from review import models
@admin.register(models.Review)
class ReviewAdminModel(admin.ModelAdmin):
"""Admin model for model Review."""

7
apps/review/apps.py Normal file
View File

@ -0,0 +1,7 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class ReviewConfig(AppConfig):
name = 'review'
verbose_name = _('reviews')

View File

34
apps/review/models.py Normal file
View File

@ -0,0 +1,34 @@
from django.contrib.contenttypes import fields as generic
from django.db import models
from django.utils.translation import gettext_lazy as _
from utils.models import BaseAttributes
class ReviewQuerySet(models.QuerySet):
"""QuerySets for model Review"""
def by_reviewer(self, user):
"""Return reviews by user"""
return self.filter(reviewer=user)
class Review(BaseAttributes):
"""Review model"""
reviewer = models.ForeignKey('account.User',
related_name='review',
on_delete=models.CASCADE,
verbose_name=_('reviewer'),)
content_object = generic.GenericForeignKey('content_type', 'object_id')
language = models.ForeignKey('translation.Language',
on_delete=models.CASCADE,
related_name='review',
verbose_name=_('Review language'))
text = models.TextField(verbose_name=_('Text'))
objects = ReviewQuerySet.as_manager()
class Meta:
"""Meta class."""
verbose_name = _('Review')
verbose_name_plural = _('Reviews')

View File

View File

View File

View File

3
apps/review/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

View File

View File

0
apps/review/urls/web.py Normal file
View File

View File

View File

View File

0
apps/review/views/web.py Normal file
View File

View File

@ -65,6 +65,7 @@ PROJECT_APPS = [
'translation.apps.TranslationConfig',
'configuration.apps.ConfigurationConfig',
'timetable.apps.TimetableConfig',
'review.apps.ReviewConfig',
]
EXTERNAL_APPS = [