diff --git a/db.sqlite3 b/db.sqlite3 index 8f6e661..f352451 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/finance_resources/__pycache__/__init__.cpython-310.pyc b/finance_resources/__pycache__/__init__.cpython-310.pyc index 8a9a899..506a550 100644 Binary files a/finance_resources/__pycache__/__init__.cpython-310.pyc and b/finance_resources/__pycache__/__init__.cpython-310.pyc differ diff --git a/finance_resources/__pycache__/admin.cpython-310.pyc b/finance_resources/__pycache__/admin.cpython-310.pyc index c83aa09..020f0b0 100644 Binary files a/finance_resources/__pycache__/admin.cpython-310.pyc and b/finance_resources/__pycache__/admin.cpython-310.pyc differ diff --git a/finance_resources/__pycache__/apps.cpython-310.pyc b/finance_resources/__pycache__/apps.cpython-310.pyc index e1641a0..f76bfd3 100644 Binary files a/finance_resources/__pycache__/apps.cpython-310.pyc and b/finance_resources/__pycache__/apps.cpython-310.pyc differ diff --git a/finance_resources/__pycache__/models.cpython-310.pyc b/finance_resources/__pycache__/models.cpython-310.pyc index 3573d21..710d6cb 100644 Binary files a/finance_resources/__pycache__/models.cpython-310.pyc and b/finance_resources/__pycache__/models.cpython-310.pyc differ diff --git a/finance_resources/__pycache__/urls.cpython-310.pyc b/finance_resources/__pycache__/urls.cpython-310.pyc index b0798c5..00b7715 100644 Binary files a/finance_resources/__pycache__/urls.cpython-310.pyc and b/finance_resources/__pycache__/urls.cpython-310.pyc differ diff --git a/finance_resources/__pycache__/views.cpython-310.pyc b/finance_resources/__pycache__/views.cpython-310.pyc index 01028ce..40f3a6e 100644 Binary files a/finance_resources/__pycache__/views.cpython-310.pyc and b/finance_resources/__pycache__/views.cpython-310.pyc differ diff --git a/finance_resources/admin.py b/finance_resources/admin.py index 1eada9f..252331a 100644 --- a/finance_resources/admin.py +++ b/finance_resources/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin -from .models import Resource +from .models import Resource, Post admin.site.register(Resource) +admin.site.register(Post) diff --git a/finance_resources/migrations/0003_post.py b/finance_resources/migrations/0003_post.py new file mode 100644 index 0000000..df79a25 --- /dev/null +++ b/finance_resources/migrations/0003_post.py @@ -0,0 +1,25 @@ +# Generated by Django 4.1.5 on 2023-04-30 02:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('finance_resources', '0002_alter_resource_contact_num_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='Post', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='anonymous', max_length=100)), + ('description', models.CharField(max_length=1000)), + ('date_created', models.DateTimeField(auto_now_add=True, null=True)), + ], + options={ + 'ordering': ['date_created'], + }, + ), + ] diff --git a/finance_resources/migrations/0004_post_likes.py b/finance_resources/migrations/0004_post_likes.py new file mode 100644 index 0000000..b0262c8 --- /dev/null +++ b/finance_resources/migrations/0004_post_likes.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.5 on 2023-04-30 04:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('finance_resources', '0003_post'), + ] + + operations = [ + migrations.AddField( + model_name='post', + name='likes', + field=models.PositiveIntegerField(default=0), + ), + ] diff --git a/finance_resources/migrations/__pycache__/0001_initial.cpython-310.pyc b/finance_resources/migrations/__pycache__/0001_initial.cpython-310.pyc index 475051a..5f6e6f0 100644 Binary files a/finance_resources/migrations/__pycache__/0001_initial.cpython-310.pyc and b/finance_resources/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/finance_resources/migrations/__pycache__/0002_alter_resource_contact_num_and_more.cpython-310.pyc b/finance_resources/migrations/__pycache__/0002_alter_resource_contact_num_and_more.cpython-310.pyc index 4bb053a..be18ee9 100644 Binary files a/finance_resources/migrations/__pycache__/0002_alter_resource_contact_num_and_more.cpython-310.pyc and b/finance_resources/migrations/__pycache__/0002_alter_resource_contact_num_and_more.cpython-310.pyc differ diff --git a/finance_resources/migrations/__pycache__/0003_post.cpython-310.pyc b/finance_resources/migrations/__pycache__/0003_post.cpython-310.pyc new file mode 100644 index 0000000..c4310c8 Binary files /dev/null and b/finance_resources/migrations/__pycache__/0003_post.cpython-310.pyc differ diff --git a/finance_resources/migrations/__pycache__/0004_post_likes.cpython-310.pyc b/finance_resources/migrations/__pycache__/0004_post_likes.cpython-310.pyc new file mode 100644 index 0000000..745a73d Binary files /dev/null and b/finance_resources/migrations/__pycache__/0004_post_likes.cpython-310.pyc differ diff --git a/finance_resources/migrations/__pycache__/__init__.cpython-310.pyc b/finance_resources/migrations/__pycache__/__init__.cpython-310.pyc index e0df2fb..23a9f48 100644 Binary files a/finance_resources/migrations/__pycache__/__init__.cpython-310.pyc and b/finance_resources/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/finance_resources/models.py b/finance_resources/models.py index 6cef930..dfd6185 100644 --- a/finance_resources/models.py +++ b/finance_resources/models.py @@ -16,4 +16,16 @@ class Resource(models.Model): description = models.CharField(max_length=1300) def __str__(self): - return self.title \ No newline at end of file + return self.title + +class Post(models.Model): + name=models.CharField(max_length=100,default="anonymous") + description=models.CharField(max_length=1000) + date_created=models.DateTimeField(auto_now_add=True, null=True) + likes=models.PositiveIntegerField(default=0) + + class Meta: + ordering = ['date_created'] + + def __str__(self): + return self.name + " (" + str(self.date_created) + ")" \ No newline at end of file diff --git a/finance_resources/static/profile.jpg b/finance_resources/static/profile.jpg new file mode 100644 index 0000000..eda9050 Binary files /dev/null and b/finance_resources/static/profile.jpg differ diff --git a/finance_resources/static/style.css b/finance_resources/static/style.css index c0907e7..5cd6a19 100644 --- a/finance_resources/static/style.css +++ b/finance_resources/static/style.css @@ -1,4 +1,23 @@ -nav a:hover{ +.nav a:hover{ background-color: #84b4a4; color: #000000; +} + +.modal { + text-align:center; + padding: 0!important; +} + +.modal:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; + margin-right: -4px; +} + + .modal-dialog { + display: inline-block; + text-align: left; + vertical-align: middle; } \ No newline at end of file diff --git a/finance_resources/templates/finance_resources/discussion_forum.html b/finance_resources/templates/finance_resources/discussion_forum.html index 42d61fc..de6f1bd 100644 --- a/finance_resources/templates/finance_resources/discussion_forum.html +++ b/finance_resources/templates/finance_resources/discussion_forum.html @@ -1,5 +1,57 @@ {% extends 'finance_resources/base.html' %} +{% load static %} {% block title %}Discussion Form{% endblock %} -{% block content %}Discussion Forum{% endblock %} \ No newline at end of file +{% block content %} +
+ + + {% for post in posts %} +
+
+ +
+
+

{{ post.name }}

+

{{ post.date_created|date:"m/d/Y g:iA" }}

+

{{ post.description }}

+ {{ post.likes }} + + + +
+
+ +
+
+
+ {% endfor %} +
+{% endblock %} diff --git a/finance_resources/urls.py b/finance_resources/urls.py index ef8efcb..cea846a 100644 --- a/finance_resources/urls.py +++ b/finance_resources/urls.py @@ -6,4 +6,6 @@ path('find_matches', views.find_matches, name='find_matches'), path('all_resources', views.all_resources, name='all_resources'), path('discussion_forum', views.discussion_forum, name='discussion_forum'), + path('newPost', views.newPost, name='newPost'), + path('likePost/', views.likePost, name='likePost') ] \ No newline at end of file diff --git a/finance_resources/views.py b/finance_resources/views.py index 4da5668..d266800 100644 --- a/finance_resources/views.py +++ b/finance_resources/views.py @@ -1,5 +1,5 @@ -from django.shortcuts import render -from .models import Resource +from django.shortcuts import render, redirect +from .models import Resource, Post from django.http import HttpResponse def home(response): @@ -13,4 +13,21 @@ def all_resources(response): return render(response, "finance_resources/all_resources.html", {"resources": resources}) def discussion_forum(response): - return render(response, "finance_resources/discussion_forum.html") \ No newline at end of file + posts = Post.objects.all() + return render(response, "finance_resources/discussion_forum.html", {"posts": posts}) + +def newPost(response): + if response.method == "POST": + if response.POST.get("name"): + person = response.POST.get('name') + if response.POST.get('comment'): + comment = response.POST.get('comment') + p = Post.objects.create(name=person, description=comment) + p.save() + return redirect(discussion_forum) + +def likePost(response, id): + p = Post.objects.get(id=id) + p.likes += 1 + p.save() + return redirect(discussion_forum) \ No newline at end of file diff --git a/henhacks/__pycache__/__init__.cpython-310.pyc b/henhacks/__pycache__/__init__.cpython-310.pyc index d47b2f8..9c0a3bc 100644 Binary files a/henhacks/__pycache__/__init__.cpython-310.pyc and b/henhacks/__pycache__/__init__.cpython-310.pyc differ diff --git a/henhacks/__pycache__/settings.cpython-310.pyc b/henhacks/__pycache__/settings.cpython-310.pyc index 150506f..b117724 100644 Binary files a/henhacks/__pycache__/settings.cpython-310.pyc and b/henhacks/__pycache__/settings.cpython-310.pyc differ diff --git a/henhacks/__pycache__/urls.cpython-310.pyc b/henhacks/__pycache__/urls.cpython-310.pyc index cf41fd3..0474ae2 100644 Binary files a/henhacks/__pycache__/urls.cpython-310.pyc and b/henhacks/__pycache__/urls.cpython-310.pyc differ diff --git a/henhacks/__pycache__/wsgi.cpython-310.pyc b/henhacks/__pycache__/wsgi.cpython-310.pyc index f0ab915..630b5d0 100644 Binary files a/henhacks/__pycache__/wsgi.cpython-310.pyc and b/henhacks/__pycache__/wsgi.cpython-310.pyc differ diff --git a/henhacks/settings.py b/henhacks/settings.py index 9c3b82d..1d6f784 100644 --- a/henhacks/settings.py +++ b/henhacks/settings.py @@ -111,7 +111,7 @@ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = 'America/New_York' USE_I18N = True