Skip to content

Commit

Permalink
Merge branch 'ao994:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ak2466 authored Apr 22, 2024
2 parents fe628c4 + 14b3c37 commit 533f47e
Show file tree
Hide file tree
Showing 24 changed files with 396 additions and 92 deletions.
3 changes: 2 additions & 1 deletion Code/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ echo "Changing directory"
cd plant-pals

echo "Apply database migrations"
python manage.py migrate
python manage.py makemigrations
python manage.py migrate --run-syncdb

echo "Starting server"
python manage.py runserver 0.0.0.0:80
Expand Down
Binary file removed Code/plant-pals/media/default/user.png
Binary file not shown.
8 changes: 1 addition & 7 deletions Code/plant-pals/profile_of_user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# profile model
class Profile(models.Model):
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
user = models.OneToOneField(User, null=True, blank=True, unique = True, on_delete=models.CASCADE)
# for user avatar images
avatar = models.ImageField(upload_to="images", default="default/user.png")

Expand Down Expand Up @@ -90,9 +90,3 @@ def __str__(self):
def delete(self, using=None, keep_parents=False):
self.image.delete()
super().delete()

##############################################################################
# Search function model
##############################################################################


2 changes: 1 addition & 1 deletion Code/plant-pals/profile_of_user/templates/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<body>
<header>
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" style="background-color: #483C32;">
<nav class="navbar navbar-expand-lg navbar-dark fixed-top px-3" style="background-color: #483C32;">

<div class="navbar-brand">
<a href="/"><span>&#127804</span> PlantPals <span>&#127804</span> </a>
Expand Down
90 changes: 63 additions & 27 deletions Code/plant-pals/profile_of_user/templates/discussion.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,79 @@
{% load static %}
<link rel="stylesheet" href="{% static 'profile_of_user/discussion.css' %}">

<br>

<!-- Main Header -->
<div class="container-fluid mt-5">
<div class="col-md-12">
<div class="card mb-4">
<div class="card-header">
<img src="/media/{{post.image}}"
class="d-block ui-w-40 rounded-circle" alt="" width="40px" height="40px">
<div class="media-body ml-3" style="text-transform: uppercase;"> <a data-abc="true">{{post.user1}}</a>
<div class="col-md-12">
<div class="card mb-4">

<!-- Post Header -->
<div class="card-header main-post-header justify-content-between">
<div class ="d-flex align-items-center"> <!-- Picture/Username -->
<!-- User Profile Picture -->
<img src="/media/{{post.image}}" class="d-block ui-w-40 rounded-circle" alt="Profile Picture" width="40px" height="40px">
<!-- Username -->
<div class="media-body ml-3 username">
<a data-abc="true">{{post.user1}}</a>
</div>
<div class="text-muted small ml-3">
<div>Date and Time Of Post:</div>
<div><strong>{{post.timestamp}}</strong></div>
</div>
</div>
<div class="card-body">
<p>{{post.post_content}}</p>
</div>
<div class="card-footer d-flex flex-wrap justify-content-between align-items-center px-0 pt-0 pb-3">
<div class="px-4 pt-3"> <button type="button" class="btn btn-primary" data-target="#reply" data-toggle="modal"><i
class="ion ion-md-create"></i>&nbsp; Reply</button> </div>
</div>
<!-- Post Timestamp -->
<div class="text-muted small ml-3">
<div>Date and Time Of Post:</div>
<div>
<strong>{{post.timestamp}}</strong>
</div>
</div>
</div> <!-- end header div -->

<!-- Post Body -->
<div class="card-body main-post-body">
<p>{{post.post_content}}</p>
</div>

<!-- Post Footer (with reply button) -->
<div class="card-footer d-flex flex-wrap justify-content-between align-items-center px-0 pt-0 pb-3">
<div class="px-4 pt-3">
<button type="button" class="btn btn-primary" data-target="#reply" data-toggle="modal">
<i class="ion ion-md-create"></i>
Reply
</button>
</div>
</div> <!-- End footer div -->
</div>
</div>
</div>
</div> <!-- End Main post div -->


{% for reply in replies %}
<br>
<div class="container">
<div class="media">
<img class="mr-3 rounded-circle" src="/media/{{reply.image}}" alt="." width="30px" height="30px">
<div class="media-body">
<h4 class="mt-0">{{reply.user}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span><small style="font-size: 13px;">({{reply.timestamp}})</small></span></h4>
<h5>{{reply.reply_content}}</h5>
<!-- Reply div -->
<div class="container"> <!-- NOTE: consider changing to container fluid (compare resizing of reply to main post to see difference), added class .reply-class -->
<div class="d-flex col-md-12 card"> <!-- NOTE:changed class to .d-flex (was .media) -->
<div class = "card-header reply-class justify-content-between"> <!-- start header of reply -->
<div class = "d-flex align-items-center"> <!-- start image and username of reply -->
<img class="mr-3 rounded-circle profile-pic" src="/media/{{reply.image}}" alt="Profile Picture" width="30px" height="30px">
<h4 class="card-title">
{{reply.user}}
</h4>
</div>
<div class = "reply-timestamp"><!-- start timestamp of reply -->
({{reply.timestamp}})
</div>
</div> <!-- end header of reply -->

<div class="card-body reply-class">
<h5>
{{reply.reply_content}}
</h5>
</div>

</div>
</div>
</div>
</div> <!-- end reply div -->
{% endfor %}



<!-- modal -->
<div class="modal fade" id="reply" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
Expand Down
28 changes: 18 additions & 10 deletions Code/plant-pals/profile_of_user/templates/forum.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,34 @@ <h1 class="display-4">PlantPals!</h1>
<p>You can also reply to others post by clicking on their post and replying them.</p>
<button class="btn btn-primary btn-lg" data-target="#questions" data-toggle="modal" role="button">Add Post</button>
</div>

<!-- Post outline -->
{% for post in posts %}
<div class="container-fluid mt-10">
<div class="row">
<div class="col-md-12">
<div class="card mb-4">
<div class="card-header">
<div class="media flex-wrap w-100 align-items-center"> <img src="/media/{{post.image}}"
class="d-block ui-w-40 rounded-circle" alt="">
<div class="media-body ml-3"> <a href="/discussion/{{post.id}}" data-abc="true">{{post.user1}}</a>
</div>
<div class="text-muted small ml-3">
<div class="px-4 pt-3">{{post.timestamp}} </div>
</div>
</div>
</div>

<div class="card-header justify-content-between">
<div class="d-flex align-items-center w-100">
<img src="/media/{{post.image}}" class="d-block ui-w-40 rounded-circle" alt="" width="40px" height="40px">
<div class="media-body ml-3">
<a href="/discussion/{{post.id}}" data-abc="true">{{post.user1}}</a>
</div>
</div>
<div class="text-muted small ml-3">
<div class="px-4 pt-3">{{post.timestamp}} </div>
</div>

</div>

<div class="card-body">
<p>{{post.post_content}}</p>
</div>

<div class="card-footer d-flex flex-wrap justify-content-between align-items-center px-0 pt-0 pb-3">
</div>

</div>
</div>
</div>
Expand Down
19 changes: 11 additions & 8 deletions Code/plant-pals/profile_of_user/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

{% block title %} Log In {% endblock %}
{% block loginactive %} active {% endblock loginactive %}
{% block css %}



<!-- start of code -->
{% endblock %}

{% block body %}
<br>
<!-- load css stylesheet -->
{% load static %}
<link rel="stylesheet" href="{% static '/profile_of_user/sign_in.css' %}">

<!-- the actual login -->
<div class="background"></div>

<!-- display all messages; this is from the django.contrib library. For how to use (add a message),
see views.py. There are some exampels in there that use it. More info can also be found here:
Expand All @@ -22,11 +28,8 @@
</div>
{% endfor %}

{% load static %}
<link rel="stylesheet" href="{% static '/profile_of_user/sign_in.css' %}">

<!-- the actual login -->
<div class="background"></div>

<div id="login-box">
<div class="items">
<h1>Log In</h1>
Expand All @@ -44,4 +47,4 @@ <h1>Log In</h1>
</div>
</div>

{% endblock %}
{% endblock %}
2 changes: 0 additions & 2 deletions Code/plant-pals/profile_of_user/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
{% block profileactive %} active {% endblock profileactive %}

{% block body %}
<!-- add space to the top to stop weird overlap -->
<div style="height: 50px;"></div>

<!-- display all messages -->
{% for message in messages %}
Expand Down
15 changes: 8 additions & 7 deletions Code/plant-pals/profile_of_user/templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

{% block title %} Register {% endblock %}
{% block registeractive %} active {% endblock registeractive %}
{% block css %}

<!-- start of website code -->
{% endblock %}
{% block body %}

<br>
{% block body %}

{% load static %}
<link rel="stylesheet" href="{% static '/profile_of_user/sign_up.css' %}">


<div class="background"></div>

<!-- display all messages; this is from the django.contrib library. For how to use (add a message),
see views.py. There are some exampels in there that use it. More info can also be found here:
https://docs.djangoproject.com/en/5.0/ref/contrib/messages/
Expand All @@ -23,9 +26,7 @@
</div>
{% endfor %}

{% load static %}
<link rel="stylesheet" href="{% static '/profile_of_user/sign_up.css' %}">


<div id="login-box">
<div class="items">
<h1>Register</h1>
Expand Down
4 changes: 3 additions & 1 deletion Code/plant-pals/profile_of_user/templates/search_result.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

{% block body %}
<link rel="stylesheet" href="{% static '/profile_of_user/search_result.css' %}">

<div class = 'results'>

<p>Scientific Name: {{ plant.scientific_name }}</p>
<p>Common Name: {{ plant.common_name }}</p>
<p>Growth Habit: {{ plant.growth_habit }}</p>
Expand All @@ -16,6 +17,7 @@
<p>High Tempurature Threshold (F):{{ plant.temp_high_F }}</p>
<p>{{ plant.image }}</p>

</div>



Expand Down
Loading

0 comments on commit 533f47e

Please sign in to comment.