from django.contrib import admin
from news.forms import NewsForm
from news.models import New
class NewsAdmin(admin.ModelAdmin):
...
class NewsFormAdmin(admin.ModelAdmin):
form = NewsForm
admin.site.register(New, NewsAdmin)
@admin.register(New)
class NewsFormAdmin(admin.ModelAdmin):
form = NewsForm
$var = "1l";
echo (int)$var; // выведет 1
from django.db import models
from news.models import New
class TourCategory(models.Model):
name = models.CharField(max_length=200, verbose_name="Имя")
def delete(self, using=None, keep_parents=False):
news = New.objects.get(category_id=self.id)
self.delete()
news.delete()