[func] added posts
parent
597d7ce7aa
commit
58187c18f6
|
|
@ -1,3 +1,4 @@
|
||||||
venv/
|
venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
media/**/*
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
|
|
@ -1,3 +1,18 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django_summernote.admin import SummernoteModelAdmin
|
||||||
|
from .models import *
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
|
||||||
|
class PostModelAdmin(SummernoteModelAdmin):
|
||||||
|
summernote_fields = ['content']
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Post, PostModelAdmin)
|
||||||
|
|
||||||
|
admin.site.site_header = 'pdlzbs'
|
||||||
|
admin.site.site_title = 'pdlzbs'
|
||||||
|
admin.site.index_title = 'Panel administracyjny'
|
||||||
|
admin.site.site_url = '/'
|
||||||
|
admin.site.enable_nav_sidebar = False
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@ from django.apps import AppConfig
|
||||||
class CoreConfig(AppConfig):
|
class CoreConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'core'
|
name = 'core'
|
||||||
|
verbose_name = 'Baza danych'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 4.0.5 on 2022-06-15 18:35
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Post',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=250, verbose_name='Tytuł')),
|
||||||
|
('content', models.TextField(verbose_name='Treść')),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Ogłoszenie',
|
||||||
|
'verbose_name_plural': 'Ogłoszenia',
|
||||||
|
'ordering': ['-created_at'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -1,3 +1,17 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
||||||
|
class Post(models.Model):
|
||||||
|
title = models.CharField('Tytuł', max_length=250)
|
||||||
|
content = models.TextField('Treść')
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Ogłoszenie'
|
||||||
|
verbose_name_plural = 'Ogłoszenia'
|
||||||
|
ordering = ['-created_at']
|
||||||
|
|
|
||||||
|
|
@ -1134,6 +1134,11 @@ select {
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.my-4 {
|
||||||
|
margin-top: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.mt-\[40px\] {
|
.mt-\[40px\] {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
}
|
}
|
||||||
|
|
@ -1146,6 +1151,14 @@ select {
|
||||||
margin-left: -12px;
|
margin-left: -12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mb-0 {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-4 {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
@ -1206,6 +1219,14 @@ select {
|
||||||
flex-basis: 33.333333%;
|
flex-basis: 33.333333%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.basis-3\/5 {
|
||||||
|
flex-basis: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basis-2\/5 {
|
||||||
|
flex-basis: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
.border-collapse {
|
.border-collapse {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
@ -1254,11 +1275,29 @@ select {
|
||||||
border-bottom-width: 1px;
|
border-bottom-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.border-b-2 {
|
||||||
|
border-bottom-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-dashed {
|
||||||
|
border-style: dashed;
|
||||||
|
}
|
||||||
|
|
||||||
.border-slate-400 {
|
.border-slate-400 {
|
||||||
--tw-border-opacity: 1;
|
--tw-border-opacity: 1;
|
||||||
border-color: rgb(148 163 184 / var(--tw-border-opacity));
|
border-color: rgb(148 163 184 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.border-stone-500 {
|
||||||
|
--tw-border-opacity: 1;
|
||||||
|
border-color: rgb(120 113 108 / var(--tw-border-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-stone-400 {
|
||||||
|
--tw-border-opacity: 1;
|
||||||
|
border-color: rgb(168 162 158 / var(--tw-border-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-white {
|
.bg-white {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||||
|
|
@ -1269,6 +1308,11 @@ select {
|
||||||
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.py-4 {
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.pb-1 {
|
.pb-1 {
|
||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
@ -1277,6 +1321,22 @@ select {
|
||||||
padding-right: 50px;
|
padding-right: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pb-6 {
|
||||||
|
padding-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pb-4 {
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pt-4 {
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pt-0 {
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
@ -1293,11 +1353,26 @@ select {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-2xl {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
line-height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.text-5xl {
|
.text-5xl {
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-4xl {
|
||||||
|
font-size: 2.25rem;
|
||||||
|
line-height: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-3xl {
|
||||||
|
font-size: 1.875rem;
|
||||||
|
line-height: 2.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.font-bold {
|
.font-bold {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
@ -1327,6 +1402,11 @@ select {
|
||||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.underline {
|
||||||
|
-webkit-text-decoration-line: underline;
|
||||||
|
text-decoration-line: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.antialiased {
|
.antialiased {
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,22 @@
|
||||||
{% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %}
|
{% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %}
|
||||||
{% load static tailwind_tags %} {% block content %}
|
{% load static tailwind_tags %} {% block content %}
|
||||||
<div
|
<div class="flex flex-col lg:flex-row justify-around gap-4 prose-h1:font-light">
|
||||||
class="flex flex-col lg:flex-row w-full justify-around gap-4 prose-h1:font-light"
|
<article class="prose w-full basis-3/5">
|
||||||
>
|
<h1>{{ highlight.title }}</h1>
|
||||||
<div class="w-full prose basis-2/3">
|
{{ highlight.content | safe }}
|
||||||
<h1>Grand Prix Województwa</h1>
|
</article>
|
||||||
<div>
|
<div class="flex flex-col basis-2/5">
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
<h1 class="text-3xl pb-6 mb-4 border-b border-stone-500 border-dashed">
|
||||||
tempor incididunt ut labore et dolore magna aliqua. Arcu vitae elementum
|
Aktualności PodlZBS
|
||||||
curabitur vitae nunc sed velit dignissim sodales. Sit amet aliquam id diam
|
</h1>
|
||||||
maecenas ultricies mi eget mauris. Enim ut tellus elementum sagittis vitae
|
{% for post in posts %}
|
||||||
et leo duis ut. Rutrum tellus pellentesque eu tincidunt tortor aliquam
|
<article
|
||||||
nulla facilisi cras. Viverra justo nec ultrices dui sapien. Commodo
|
class="prose w-full py-4 {% if forloop.first %}pt-0{% endif %} {% if not forloop.last %}border-b border-stone-400{% endif %}"
|
||||||
viverra maecenas accumsan lacus. Facilisis mauris sit amet massa vitae.
|
>
|
||||||
Orci dapibus ultrices in iaculis nunc sed augue lacus viverra.
|
<h2 class="mb-0">{{ post.title }}</h2>
|
||||||
Pellentesque nec nam aliquam sem et tortor consequat id porta. Feugiat sed
|
{{ post.content | safe }}
|
||||||
lectus vestibulum mattis ullamcorper velit sed ullamcorper. Elementum
|
</article>
|
||||||
pulvinar etiam non quam lacus suspendisse faucibus. Malesuada fames ac
|
{% endfor %}
|
||||||
turpis egestas integer eget. Fermentum posuere urna nec tincidunt praesent
|
|
||||||
semper. Odio ut sem nulla pharetra diam. Tincidunt tortor aliquam nulla
|
|
||||||
facilisi cras fermentum odio eu feugiat. Tortor aliquam nulla facilisi
|
|
||||||
cras fermentum odio eu.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="w-full prose basis-1/3">
|
|
||||||
<h1>Aktualności PodlZBS</h1>
|
|
||||||
<div>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
||||||
tempor incididunt ut labore et dolore magna aliqua. Arcu vitae elementum
|
|
||||||
curabitur vitae nunc sed velit dignissim sodales. Sit amet aliquam id diam
|
|
||||||
maecenas ultricies mi eget mauris. Enim ut tellus elementum sagittis vitae
|
|
||||||
et leo duis ut. Rutrum tellus pellentesque eu tincidunt tortor aliquam
|
|
||||||
nulla facilisi cras. Viverra justo nec ultrices dui sapien. Commodo
|
|
||||||
viverra maecenas accumsan lacus. Facilisis mauris sit amet massa vitae.
|
|
||||||
Orci dapibus ultrices in iaculis nunc sed augue lacus viverra.
|
|
||||||
Pellentesque nec nam aliquam sem et tortor consequat id porta. Feugiat sed
|
|
||||||
lectus vestibulum mattis ullamcorper velit sed ullamcorper. Elementum
|
|
||||||
pulvinar etiam non quam lacus suspendisse faucibus. Malesuada fames ac
|
|
||||||
turpis egestas integer eget. Fermentum posuere urna nec tincidunt praesent
|
|
||||||
semper. Odio ut sem nulla pharetra diam. Tincidunt tortor aliquam nulla
|
|
||||||
facilisi cras fermentum odio eu feugiat. Tortor aliquam nulla facilisi
|
|
||||||
cras fermentum odio eu.
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,20 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
from .models import *
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
class HomeView(TemplateView):
|
class HomeView(TemplateView):
|
||||||
template_name = 'home.html'
|
template_name = 'home.html'
|
||||||
extra_context = {
|
|
||||||
'home': 'active'
|
def get_context_data(self, **kwargs):
|
||||||
}
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
posts = list(Post.objects.all())
|
||||||
|
|
||||||
|
context['home'] = 'active'
|
||||||
|
context['highlight'] = posts[0]
|
||||||
|
context['posts'] = posts[1:]
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue