praktikum6 18.11

This commit is contained in:
khaloufam70043 committed 2019-11-19 15:26:29 +01:00
1 parent 3efafd6fe6
commit f66c98fa11
5850 files changed
+9081 -589899

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
# Generated by Django 2.2.7 on 2019-11-19 13:44
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Notice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('notice_title', models.CharField(max_length=80)),
('notice_text', models.CharField(max_length=400)),
('pub_start', models.DateTimeField()),
('pub_end', models.DateTimeField()),
],
),
]
Binary file not shown.
+5
View File
@@ -1,3 +1,8 @@
from django.db import models
# Create your models here.
class Notice(models.Model):
notice_title = models.CharField(max_length=80)
notice_text = models.CharField(max_length=400)
pub_start = models.DateTimeField()
pub_end = models.DateTimeField()
+7 -1
View File
@@ -1,6 +1,12 @@
from django.shortcuts import render
from .models import Notice
from django.utils import timezone
# Create your views here.
def index(request):
return render(request, 'Posts/index.html')
notices = Notice.objects.all()
notices = notices.filter(pub_start__lte=timezone.now() )
notices = notices.filter(pub_end__gte=timezone.now() )
context = { "notices": notices}
return render(request, 'Posts/index.html', context)