from django.db import models
from django.contrib import admin
from web.models.base import BaseModel
from web.models.forum_category import ForumCategory


class ForumSubcategory(BaseModel):
    title = models.CharField()
    description = models.TextField()
    forum_category = models.ForeignKey(ForumCategory, on_delete=models.CASCADE)
    sticky = models.BooleanField()
    can_by_anon = models.BooleanField(default=False)

    class Meta:
        db_table = 'forum_subcategory'


class ForumSubcategoryAdmin(admin.ModelAdmin):
    search_fields = (
        'title',
        'description',
        'forum_category',
        'sticky',
    )

    list_display = (
        'title',
        'description',
        'forum_category',
        'sticky',
    )
