-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Reagent992/feature/comments
comments app
- Loading branch information
Showing
5 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Comment | ||
|
||
|
||
@admin.register(Comment) | ||
class CommentAdmin(admin.ModelAdmin): | ||
list_display = ("pk", "author", "text", "created_at") | ||
list_filter = ("author", "created_at") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CommentsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "comments" | ||
verbose_name = "Комментарий" | ||
verbose_name_plural = "Комментарии" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from ipr.models import IPR | ||
from task.models import Task | ||
from users.models import User | ||
|
||
|
||
class Comment(models.Model): | ||
author = models.ForeignKey( | ||
User, | ||
related_name="comments", | ||
on_delete=models.CASCADE, | ||
verbose_name="Автор комментария", | ||
) | ||
ipr = models.ForeignKey( | ||
IPR, | ||
related_name="comments", | ||
on_delete=models.CASCADE, | ||
verbose_name="ИПР", | ||
) | ||
task = models.ForeignKey( | ||
Task, | ||
related_name="comments", | ||
on_delete=models.CASCADE, | ||
verbose_name="Задача", | ||
) | ||
|
||
text = models.TextField( | ||
verbose_name="Комментарий", | ||
max_length=settings.MAX_LEN_COMMENT_TEXT, | ||
) | ||
|
||
created_at = models.DateField( | ||
auto_now_add=True, | ||
verbose_name="Дата создания", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters