init
This commit is contained in:
parent
4439bb6d46
commit
000e45c1de
5 changed files with 20 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import Bb
|
||||
|
||||
class BbAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'content', 'price', 'published')
|
||||
list_display_links = ('title', 'content')
|
||||
search_fields = ('title', 'content', )
|
||||
|
||||
admin.site.register(Bb, BbAdmin)
|
|
@ -1,8 +1,14 @@
|
|||
from tabnanny import verbose
|
||||
from turtle import title
|
||||
from django.db import models
|
||||
|
||||
class Bb (models.Model):
|
||||
title = models.CharField(max_length=50)
|
||||
content = models.TextField(null=True, blank=True)
|
||||
price = models.FloatField(null=True, blank=True)
|
||||
published = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||
title = models.CharField(max_length=50, verbose_name = 'Товар')
|
||||
content = models.TextField(null=True, blank=True, verbose_name = 'Описание')
|
||||
price = models.FloatField(null=True, blank=True, verbose_name = 'Цена')
|
||||
published = models.DateTimeField(auto_now_add=True, db_index=True,
|
||||
verbose_name = 'Опубликованно')
|
||||
class Meta:
|
||||
verbose_name_plural = 'Объявления'
|
||||
verbose_name = 'Объявление'
|
||||
ordering = ['-published']
|
||||
|
|
|
@ -3,5 +3,5 @@ from django.shortcuts import render
|
|||
from .models import Bb
|
||||
|
||||
def index(request):
|
||||
bbs = Bb.objects.order_by('-published')
|
||||
bbs = Bb.objects.all()
|
||||
return render(request, 'index.html', {'bbs': bbs})
|
Binary file not shown.
|
@ -107,7 +107,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = 'ru'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue