Edit css properites

This commit is contained in:
Piotr Szkudlarek 2024-01-07 00:24:35 +01:00
parent d23cdff3af
commit 4bba2f5b75
15 changed files with 44 additions and 27 deletions

View File

@ -6,6 +6,7 @@ class PostForm(forms.ModelForm):
class Meta: class Meta:
model = Post model = Post
fields = ["title", "content"] fields = ["title", "content"]
labels = {"content": "Body"}
class CommentForm(forms.ModelForm): class CommentForm(forms.ModelForm):

View File

@ -8,9 +8,6 @@ from .models import Post, Comment
from .froms import PostForm, CommentForm from .froms import PostForm, CommentForm
# Create your views here.
class ListPosts(ListView): class ListPosts(ListView):
model = Post model = Post
template_name = "list_posts.html" template_name = "list_posts.html"
@ -26,9 +23,6 @@ class PostDetails(DetailView, FormMixin):
template_name = "post_details.html" template_name = "post_details.html"
form_class = CommentForm form_class = CommentForm
# def get_queryset(self) -> QuerySet[Any]:
# queryset = Post.objects.get(pk=self.request.GET.get("pk"))
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.object = self.get_object() self.object = self.get_object()
form = self.get_form() form = self.get_form()

View File

@ -40,6 +40,7 @@ INSTALLED_APPS = [
"django.contrib.staticfiles", "django.contrib.staticfiles",
"DetectionApp", "DetectionApp",
"Community", "Community",
"ckeditor",
] ]
MIDDLEWARE = [ MIDDLEWARE = [

Binary file not shown.

View File

@ -0,0 +1,25 @@
#add_post{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#add_post p{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
#submit{
background-color: chartreuse;
border-radius: 25px;
border: 2px solid black;
font-size: 20px;
text-decoration: none;
color:black;
font-family: Arial;
text-align: center;
}

View File

@ -3,7 +3,6 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 100%;
} }
h2{ h2{

View File

@ -1,7 +1,3 @@
body, html{
height: unset;
}
.page-container{ .page-container{
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -1,7 +1,6 @@
body, html{ body{
height:100%; min-height: 100vh;
min-height: 100%; margin:0;
margin: 35px 0px 0px 0px;
display:flex; display:flex;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
@ -33,8 +32,6 @@ body, html{
.footer{ .footer{
display:flex; display:flex;
position:relative;
bottom: 0;
width: 100%; width: 100%;
flex-direction: row; flex-direction: row;
background-color: lightgray; background-color: lightgray;
@ -43,3 +40,11 @@ body, html{
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: center;
} }
.root{
padding:60px 0px 20px 0px;
flex:1;
display: flex;
justify-content: center;
align-items: stretch;
}

View File

@ -3,7 +3,6 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 100%;
} }
h2{ h2{

View File

@ -1,5 +1,4 @@
.form_div{ .form_div{
height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -1,10 +1,8 @@
form{ form{
height:100%;
width:100%; width:100%;
display:flex; display:flex;
flex-direction:row; flex-direction:row;
margin:auto;
overflow:hidden; overflow:hidden;
} }

View File

@ -1,10 +1,8 @@
form{ form{
height:100%;
width:100%; width:100%;
display:flex; display:flex;
flex-direction:row; flex-direction:row;
margin:auto;
overflow: hidden; overflow: hidden;
} }

View File

@ -4,9 +4,9 @@
<link rel="stylesheet" href="{% static 'Community/css/add_post.css' %}"> <link rel="stylesheet" href="{% static 'Community/css/add_post.css' %}">
{%endblock extracss%} {%endblock extracss%}
{%block content%} {%block content%}
<form method="post"> <form method="POST" id="add_post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Add post"> <input type="submit" value="Add post" id="submit">
</form> </form>
{%endblock content%} {%endblock content%}

View File

@ -23,7 +23,9 @@
<a href="{% url 'login' %}?next={{request.path}}">Login</a> <a href="{% url 'login' %}?next={{request.path}}">Login</a>
{%endif%} {%endif%}
</div> </div>
<div class="root">
{%block content%}{%endblock content%} {%block content%}{%endblock content%}
</div>
<footer class="footer"> <footer class="footer">
<p>Footer</p> <p>Footer</p>
</footer> </footer>

View File

@ -14,14 +14,14 @@
<p id="author">{{object.author}}</p> <p id="author">{{object.author}}</p>
</div> </div>
</div> </div>
<div id="add_comment"> <p id="comment-label">Comments:</p>
<div id="add_comment">
<form method="POST" id="comment_form"> <form method="POST" id="comment_form">
{%csrf_token%} {%csrf_token%}
{{form}} {{form}}
<input type="submit" id="submit" value="Add comment"> <input type="submit" id="submit" value="Add comment">
</form> </form>
</div> </div>
<p id="comment-label">Comments:</p>
<div class="comments"> <div class="comments">
{%for comment in object.sorted_comments%} {%for comment in object.sorted_comments%}
<div class="single-comment"> <div class="single-comment">