new models, frontend functions, public pages

This commit is contained in:
2025-05-07 15:41:03 +09:00
parent 91f0d54563
commit 18497d4343
784 changed files with 124024 additions and 289 deletions

View File

@@ -0,0 +1,41 @@
from django.db import models
from django.conf import settings
class LinkGroup(models.Model):
owner = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='api_link_groups' # уникальное имя, чтобы не конфликтовать с links app
)
name = models.CharField(max_length=100)
order = models.PositiveIntegerField(default=0)
description = models.TextField(blank=True, null=True)
icon = models.ImageField(
upload_to='link_groups/',
null=True,
blank=True,
help_text='Иконка группы ссылок'
)
def __str__(self):
return f"{self.owner.username} - {self.name}"
class Link(models.Model):
owner = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='links'
)
group = models.ForeignKey(
LinkGroup,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='links'
)
title = models.CharField(max_length=200)
url = models.URLField()
icon = models.URLField(blank=True, null=True)
order = models.PositiveIntegerField(default=0)
def __str__(self):
return self.title