Commit 917803c2 authored by Christian Sarabia's avatar Christian Sarabia

Updated visual elements and CSS

parent e4182b16
from django import forms
from homepage.models import WidgetUser
from .models import Post
class AddForm(forms.ModelForm):
class Meta:
model = Post
fields = "__all__"
# post_title = forms.CharField(label='Title', max_length=50)
# post_body = forms.CharField(label='Body', max_length=1500, widget=forms.Textarea)
# # pub_date = models.DateTimeField("date published")
# author = forms.ModelChoiceField(label='Author', queryset=WidgetUser.objects.all())
# post_image = forms.ImageField(required=False)
\ No newline at end of file
fields = "__all__"
\ No newline at end of file
......@@ -12,6 +12,9 @@ class Post(models.Model):
def __str__(self):
return self.post_title
def get_absolute_url(self):
return u'%d/details' % self.pk
class Reply(models.Model):
post = models.ForeignKey(Post, on_delete=models.CASCADE)
......
......@@ -18,7 +18,7 @@
{% else %}
<p>There is no post.</p>
{% endif %}
<li><a href="/forum/add">Write a new forum post...</a></li>
<button onclick="window.location.href='/forum/add'"">Write a new forum post</button>
</ul>
</div>
{% endblock %}
\ No newline at end of file
......@@ -36,8 +36,12 @@ class AddView(View):
if form.is_valid():
print(form.cleaned_data['post_title'])
form.save()
post = Post.objects.latest('id')
replies = Reply.objects.filter(post=post).order_by("-pub_date")
context = {'form' : form}
return render(request, 'forum/add.html', context)
context = {
"post": post,
"replies": replies
}
return render(request, "forum/detail.html", context)
from statistics import mode
from django import forms
from .models import WidgetUser
class WidgetUserForm(forms.ModelForm):
class Meta:
model = WidgetUser
fields = ['last_name', 'first_name', 'middle_name', 'id_num', 'email', 'department', 'image']
\ No newline at end of file
......@@ -7,12 +7,6 @@
{% block title %}{{object.pk}}{% endblock %}
{% block content %}
<nav class="topnav">
<a href="{% url 'homepage:indexHomepage' %}">Homepage</a>
<a href="{% url 'announcements:indexAnnouncements' %}">Announcements</a>
<a href="{% url 'forum:indexForum' %}">Forum</a>
<a href="{% url 'assignments:indexAssignments' %}">Assignments</a>
</nav>
<div class="flex-container">
<div class="user-card">
......
......@@ -5,15 +5,8 @@
<link rel="stylesheet" type="text/css" href="{% static 'homepage/style.css' %}">
{% endblock %}
{% block title %}{{object.pk}}{% endblock %}
{% block title %}New Widget User{% endblock %}
{% block content %}
<nav class="topnav">
<a href="{% url 'homepage:indexHomepage' %}">Homepage</a>
<a href="{% url 'announcements:indexAnnouncements' %}">Announcements</a>
<a href="{% url 'forum:indexForum' %}">Forum</a>
<a href="{% url 'assignments:indexAssignments' %}">Assignments</a>
</nav>
<div class="flex-container">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
......
......@@ -2,12 +2,14 @@ body {
font-family: sans-serif, Arial, Helvetica;
color:#035700;
line-height: 2;
background-color:rgb(230, 253, 228);
}
div {
margin: auto;
width: 50%;
border: 3px solid rgb(194, 7, 169);
border-radius: 10px;
padding: 30px 40px 40px 40px;
}
......@@ -50,4 +52,27 @@ img {
a {
color:#891fa3;
}
input[type=submit], button {
width: 40%;
background-color: #ff91f0;
padding: 5px;
margin: 25px 0px 0px 0px;
border: none;
border-radius: 18px;
cursor: pointer;
font-family: sans-serif, Arial, Helvetica;
font-size: 18px;
color:#2d384e;
line-height: 2;
float: right;
}
input[type=submit]:hover , button:hover{
background-color: #fcaef1;
}
textarea, input {
border-radius: 5px;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment