-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapps.py
More file actions
27 lines (19 loc) · 787 Bytes
/
Copy pathapps.py
File metadata and controls
27 lines (19 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import importlib
from django.apps import AppConfig
from django.conf import settings
from pydantic import BaseModel
class PostsConfigExtra(BaseModel):
title_maxlength: int = 20
text_preview_length: int = 10
post_images_upload_to: str = 'images/posts'
post_videos_upload_to: str = 'videos/posts'
class PostsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'posts'
def __init__(self, app_name, app_module):
super().__init__(app_name, app_module)
config = getattr(settings, 'CONNECT_CLUB_POSTS_CONFIG', {})
self.extra = PostsConfigExtra.model_validate(config)
def ready(self):
# Implicitly connect signal handlers decorated with @receiver.
importlib.import_module("posts.signals")