Skip to content

Commit

Permalink
v0.3.4-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
g4n3sha5 committed Mar 29, 2023
1 parent e5d803a commit 0493f5d
Show file tree
Hide file tree
Showing 35 changed files with 253 additions and 151 deletions.
Binary file modified Clubs/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified Clubs/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file modified Clubs/__pycache__/views_schedule.cpython-310.pyc
Binary file not shown.
15 changes: 9 additions & 6 deletions Clubs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ class Request(models.Model):
status = models.CharField(choices=ACCEPTED, max_length=30)

def save(self, *args, **kwargs):
clubID = self.club.id
receiverClub = Club.objects.get(id=clubID)
authorizedMembers = receiverClub.authorizedMembers()
for member in authorizedMembers:
if(self.status == 'NO'):
clubID = self.club.id
receiverClub = Club.objects.get(id=clubID)
authorizedMembers = receiverClub.authorizedMembers()
myNotification = Notification(
message="A user sent a request to join your club!",
userSender=self.user,
)
print("save creates a notification")
myNotification.save()
authorizedUser = User.objects.get(id=member.user_id)
myNotification.userReceiver.add(authorizedUser)

for member in authorizedMembers:
authorizedUser = User.objects.get(id=member.user_id)
myNotification.userReceiver.add(authorizedUser)

super(Request, self).save(*args, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions Clubs/templates/Clubs/clubMembers.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="row p-0 m-0">
<div class="clubsListWrap px-lg-5 px-2 col-12 col-xl-8 h-100 navPadding membersWrap
vh-100 overflow-hidden pb-5">
vh-100 overflow-hidden">
{% if Club.name %}
<span class="text-center">
<h2 class=" font-weight-600">
Expand All @@ -18,7 +18,7 @@ <h3> Members</h3>
</span>
{% endif %}

<div class="clubsListWrapper h-100 d-flex flex-column px-3
<div class="clubsListWrapper d-flex flex-column px-3
align-items-center overflow-auto customScroll">


Expand Down
4 changes: 2 additions & 2 deletions Clubs/templates/Clubs/clubRequests.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ <h2 class="requesth2 memberType">{{ userRequest.0.belt }}</h2>
<th class="requestIcon ">
<form class="d-flex justify-content-around">
{% csrf_token %}
<div id="acceptRequest iconScale h-100"
<div id="acceptRequest hoverScale h-100"
hx-post="{% url 'handleRequest' userRequest.1.id %}"
hx-target="#Clubs_view"
>
<i class="bi px-2 bi-person-check w-100 h-100"></i>
</div>
<div id="rejectRequest iconScale h-100"
<div id="rejectRequest hoverScale h-100"
hx-delete="{% url 'handleRequest' userRequest.1.id %}"
hx-target="#Clubs_view"
>
Expand Down
3 changes: 2 additions & 1 deletion Clubs/templates/Clubs/memberProfileModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<div class="profileModalRemove">


<button type="button"
<button
type="button"
class="btn btn-danger areYouSureBTN">
Remove Member
</button>
Expand Down
27 changes: 14 additions & 13 deletions Clubs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ def userHasClub(request):
except:
return False

def checkRequests():
requests = Request.objects.filter(status = 'YES')
for item in requests:
newMember = UserMembership(user_id=item.user_id,
club_id=item.club_id,
)
newMember.save()
item.delete()

@login_required
def ClubsIndex(request):

Expand Down Expand Up @@ -85,9 +76,12 @@ def ClubsIndex(request):
# profilesDict[profile] = member
#
# return profilesDict




@login_required
def clubMembers(request):
checkRequests()
profilesDict, requestsDict = {}, {}
authorized = False
try:
Expand Down Expand Up @@ -243,10 +237,17 @@ def handleRequest(request, requestID):

if request.method == 'POST':
myrequest.status = 'YES'
myrequest.save()
newMember = UserMembership(user_id=myrequest.user_id,
club_id=myrequest.club_id,
)
newMember.save()
myrequest.delete()

if request.method == 'DELETE':
myrequest.status = 'REJECTED'
myrequest.save()
# myrequest.status = 'REJECTED'
myrequest.delete()



return clubMembers(request)

Expand Down
2 changes: 1 addition & 1 deletion Clubs/views_schedule.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.shortcuts import render, HttpResponseRedirect, reverse
from datetime import datetime, date
from .models import Schedule, UserMembership
from .utilis import Calendar

from django.contrib.auth.decorators import login_required
from main.views import getBaseTemplate
from .forms import ScheduleForm
Expand Down
10 changes: 5 additions & 5 deletions Journal/templates/Journal/create_reloadContent.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
{#</div>#}

{#</div>#}
<div class="row vh-100 m-0 p-0 d-flex overflow-hidden ">
<div class="toDOwrap row min-vh-100 m-0 p-0 d-flex overflow-hidden ">

<div class=" order-2 order-lg-1 col-lg-8 col-12 h-100 justify-content-center d-flex overflow-auto customScroll ">
<div class=" order-2 pb-5 order-lg-1 col-lg-8 col-12 h-100 justify-content-center d-flex overflow-auto customScroll ">
<div id="singleList" class="row d-flex ">
</div>
</div>

<div class="techList order-1 order-lg-2 col-12 col-lg-4 h-100 text-white px-5 overflow-hidden">
<div class="techList order-1 order-lg-2 col-12 col-lg-4 text-white px-5 overflow-hidden">
{% load static %}

<div class="d-flex flex-column">
Expand All @@ -34,7 +34,7 @@ <h1>To do manager</h1>
{# </div>#}


<nav id="navbar" class="nav-menu navbar">
<div class="nav-menu navbar">
<ul class="list-unstyled px-3">
<form method="post" action="/create/">
<div class="input-group mb-3 p-0">
Expand All @@ -60,7 +60,7 @@ <h1>To do manager</h1>
{# <li class="py-3"><a href="#portfolio" class="nav-link scrollto"><i class="bi bi-bullseye px-2"></i> <span>Workout Goals</span></a></li>#}

</ul>
</nav>
</div>


</div>
Expand Down
Binary file removed Notifications/__pycache__/consumers.cpython-310.pyc
Binary file not shown.
Binary file removed Notifications/__pycache__/routing.cpython-310.pyc
Binary file not shown.
Binary file modified Notifications/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file modified Notifications/__pycache__/views.cpython-310.pyc
Binary file not shown.
9 changes: 0 additions & 9 deletions Notifications/consumers.py

This file was deleted.

7 changes: 0 additions & 7 deletions Notifications/routing.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

40 changes: 24 additions & 16 deletions Notifications/templates/Notifications/notificationIcon.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
<div
class="nav-item bellIcon d-flex justify-content-center align-items-center">
<a data-bs-target=".notificationDropdown"
class="nav-item bellIcon mx-lg-5
{% if notifications %}dropdownParent hoverScale {% endif %} ">
<a

{% if notifications %} data-bs-target=".notificationDropdown"
data-bs-toggle="collapse"
aria-haspopup="true"
aria-expanded="false"
hx-trigger="every 800ms"

class=" p-0 dropdown-toggle m-0">
{% endif %}
class=" p-0 {% if notifications %} dropdown-toggle {% endif %} m-0 position-relative">
<i class="bi bi-bell-fill "></i>
<span class="notifyAmount "> {{ notifications | length }}
</span>
</a>

{# <div class="notificationDropdown dropdown-menu ">#}
{# {% if notifications %}#}
{# {% for item in notifications %}#}
{# <h2>{{ item.message }}</h2>#}
{# <h2>{{ item.timestamp }}</h2>#}
<div class="notificationDropdown navDropdown dropdown-menu customScroll ">
<a hx-delete="{% url 'clearNotifications' %}"
hx-target="#notiParent"
class="d-block font-weight-700 my-2 readAll hoverScale mx-5 mx-lg-0 ">Read All</a>

{% if notifications %}
{% for item in notifications %}
<a href="{% url 'clubMembers' %}"
class="notification d-block">{{ item.message }} {{ item.timestamp }}</a>
{# <h2>{{ item.is_read }}</h2>#}
{##}
{# {% endfor %}#}
{# {% endif %}#}
{##}
{# <h4>Show all notifications</h4>#}
{# </div>#}

{% endfor %}
{% endif %}

{# <a href="{% url 'allNotifications' %}">Show all notifications</a>#}
</div>
</div>
4 changes: 3 additions & 1 deletion Notifications/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@


urlpatterns = [
path('notifications/', views.notifications, name="notifications"),
# path('notifications/', views.notifications, name="notifications"),
# path('allNotifications/', views.allNotifications, name="allNotifications"),
path('clearNotifications/', views.clearNotifications, name="clearNotifications"),

]
htmx_urlpatterns = [
Expand Down
24 changes: 18 additions & 6 deletions Notifications/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
from django.shortcuts import render
from .models import Notification


# Create your views here.
def notifications (request):
myNotifications = Notification.objects.filter(userReceiver = request.user.id)


context = {
'notifications' : myNotifications
}
return render
def notifi(request):
return Notification.objects.filter(userReceiver=request.user.id)


def notifications(request):
return {'notifications': notifi(request)}


def clearNotifications(request):
if request.method == 'DELETE':
myset = Notification.objects.filter(userReceiver=request.user)
for x in myset:
x.userReceiver.remove(request.user.id)


return render(request, "Notifications/notificationIcon.html", {'notifications' : notifi(request)})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class=" col-12 col-lg-4 text-white px-3 pb-1 overflow-hidden ">
<div class=" col-12 col-lg-4 text-white px-0 pb-5 overflow-hidden ">
<div class="techList px-2">
<h3 class="text-center"> Techniques List</h3>
<hr class="text-white mx-5 my-3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{% load static %}

<div class="row addSession techniqueType h-100 mb-1 justify-content-lg-between
<div class="row addSession techniqueType h-100
mb-1 justify-content-lg-between
justify-content-center d-flex">
<h2 class="typeH2 text-white text-center pb-3">Technique type</h2>
{% for choice in TechForm.type %}

<div class="count_icon col-4 col-lg-2 h-100 mb-4 mb-lg-0 mx-1">
<div class="count_icon col-3 col-md-2 h-100 mb-4 mb-lg-0 mx-1">
<div class="h-100 ">
<div class="caption"> {{ choice.choice_label }}</div>
<label>
Expand Down
2 changes: 2 additions & 0 deletions account_register/templates/myaccount/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

{% load static %}
{% block content %}

<div class="AccountContentWrapper h-100 w-100">
{% include 'common/messages.html' %}
{% include 'myaccount/profile_reloadContent.html' %}
</div>
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load static %}

<div class="accountcontent d-flex flex-column w-100 h-100 flex-wrap ">
<div class="personalInfo position-relative h-100 ">

Expand Down
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified main/__pycache__/settings.cpython-310.pyc
Binary file not shown.
3 changes: 1 addition & 2 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
]

MIDDLEWARE = [


'django.middleware.security.SecurityMiddleware',
"whitenoise.middleware.WhiteNoiseMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware',
Expand All @@ -105,6 +103,7 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'Notifications.views.notifications'
],
},
},
Expand Down
Loading

0 comments on commit 0493f5d

Please sign in to comment.