Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events #525

Merged
merged 47 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
340fb98
ADD: Verify Event Permission for Event Moderators
taruspande Dec 11, 2023
5c47fd3
ADD: email_body and email_verified in events.models
taruspande Dec 11, 2023
558696e
Added verify email and smtp for sending mails
amitmalakariitb Dec 12, 2023
ee34182
UPDATE: retrieve api updated to check for user privilege and show lon…
taruspande Dec 12, 2023
5c262b4
FIX: retrieve now checks for privileges for all bodies associated wit…
taruspande Dec 12, 2023
20c2b76
ADD: longdescription in EventSerializer
taruspande Dec 12, 2023
abdcc4a
ADD: enum containing council_ids, ADD: A MultiSelectField verificatio…
taruspande Dec 13, 2023
cc62328
ADD: verification_body to EventSerializer and EventFullSerializer
taruspande Dec 13, 2023
1910e1b
Updated the verify and send mail api
amitmalakariitb Dec 13, 2023
165cbd4
ADD : Check for verification body in request if long description is p…
SanskarGosavi2003 Dec 14, 2023
f06b158
Updated the push mail api
amitmalakariitb Dec 14, 2023
878c1e2
Updated the verify mail api and separted into approve and reject mail
amitmalakariitb Dec 14, 2023
3b29c50
ADD: LongDescription in EventSerializer
Dec 15, 2023
09eaa67
ADD: Verifivation Bodies in models.py
Dec 29, 2023
609e014
FIX: Fixed Serializer of Events
Dec 29, 2023
a6fca42
FIX: Push Mail
Dec 30, 2023
847f4a3
Removed my mail credentials
Dec 30, 2023
aa96f51
FIX: fixed mail issues
Jan 1, 2024
b0b545c
fixed merge conflicts
Jan 1, 2024
7bd4f5d
FIX : Merge Conflicts
Jan 1, 2024
14e001a
FIX : Merge Conflicts
Jan 1, 2024
cadff06
FIX : Merge Conflicts
Jan 1, 2024
0e8d085
FIX : Merge Conflicts
Jan 1, 2024
2d70cb2
Delete .DS_Store
PSYCHNERD2512 Jan 1, 2024
e9c14cd
Delete .DS_Store
PSYCHNERD2512 Jan 1, 2024
6be7e5e
fixed .ds_store issue
Jan 1, 2024
d90fdfa
Merge branch 'events' of https://github.com/taruspande/instiapp-api i…
Jan 1, 2024
4a4a267
Merge branch 'events' of https://github.com/taruspande/instiapp-api i…
Jan 2, 2024
09efb84
fix(events): import settings using django.conf
Jan 2, 2024
54ea7aa
ADD : Venues filter to events
SanskarGosavi2003 Jan 2, 2024
477c7e6
Merge branch 'events' of https://github.com/taruspande/instiapp-api i…
Jan 2, 2024
3d5bfae
Added auth_user and password
amitmalakariitb Jan 10, 2024
2983bf3
Uncommented tests for events
taruspande Jan 22, 2024
99fd97e
syncing upstream/master with events
taruspande Jan 22, 2024
aa01a95
Resolved Merge Conflicts
taruspande Jan 22, 2024
0451a92
FIX: Lint
taruspande Jan 22, 2024
f43c8b4
FIX: LINT
taruspande Jan 23, 2024
c519b6e
FIX: LINT
taruspande Jan 23, 2024
42bef41
FIX: LINT
taruspande Jan 23, 2024
9b3b05e
FIX: LINT
taruspande Jan 24, 2024
06a6189
Added the verification body fetching api
amitmalakariitb Feb 7, 2024
0867cfb
Updated the bodies-with-privilege API
amitmalakariitb Feb 9, 2024
878859d
Updated the bodies-with-privilege api
amitmalakariitb Feb 18, 2024
98d0ed3
reuired false for email_verified
amitmalakariitb Aug 11, 2024
211f2da
Merge pull request #522 from taruspande/events-new
amitmalakariitb Aug 11, 2024
7f6ec90
Host email for event changed
amitmalakariitb Aug 11, 2024
d0a7a10
Merge pull request #523 from taruspande/events-new
amitmalakariitb Aug 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
exclude = .git,__pycache__,backend/settings*,*/migrations/*,venv,.venv
ignore = E302,E731,W503
max-complexity = 15
max-line-length = 120
max-complexity = 25
max-line-length = 150
10 changes: 8 additions & 2 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
# SSO Config
SSO_TOKEN_URL = "https://gymkhana.iitb.ac.in/sso/oauth/token/"
SSO_PROFILE_URL = "https://gymkhana.iitb.ac.in/sso/user/api/user/?fields=first_name,last_name,type,profile_picture,sex,username,email,program,contacts,insti_address,secondary_emails,mobile,roll_number"
SSO_CLIENT_ID = "HeKlfCluQLxa5cG5c4yHYiAEFZynroiKwylpiwNV"
SSO_CLIENT_ID_SECRET_BASE64 = "SGVLbGZDbHVRTHhhNWNHNWM0eUhZaUFFRlp5bnJvaUt3eWxwaXdOVjpYbDg4OHNaOWFhbVVmV1FMR0Y3SjI1MU5taUFYeHRtdzRtM3pHejJLUVQ1d3M0b3hTRGNCTnhSNWw4SXpYbHNDTVVWVHh3MUE0VXRnRU5YZ1FpWlFDZ1RUcERoVHFXeUZmckhLdDhadU5SQk9SY2Q3Z2ZmWjNXUzQ5bGxCMXNBUg=="
SSO_CLIENT_ID = "0vptOdXpmB8MIGhV6ZeADQxNQ7xuaa3ntITZwqPX"
SSO_CLIENT_ID_SECRET_BASE64 = "MHZwdE9kWHBtQjhNSUdoVjZaZUFEUXhOUTd4dWFhM250SVRad3FQWDpsanRQbVN2WGZVTnlXZEVRTWQ1aElaYUNXRXZyVFRXTllTU0p3cExwbUhTZ1pTRXI5WUdZWm40SHFOczZlWHBhQjBlSXhzV3p2UlJSSTRoM3FreDJlbmFrSzczUXhPRldiVFh6RkRuUFk4aVdNeERuZndXdU8yOEg0eVloSlpWZw=="

# Password Login
SSO_DEFAULT_REDIR = "https://insti.app/login"
Expand Down Expand Up @@ -72,4 +72,10 @@
EMAIL_HOST = "smtp.gmail.com"
EMAIL_PORT = "587"
EMAIL_HOST_USER = ""
EMAIL_HOST_PASSWORD = ""
EMAIL_EVENT_HOST_USER = ""
EMAIL_USE_TLS = True
RECIPIENT_LIST = ['[email protected]', '[email protected]']
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
AUTH_USER = ""
2 changes: 1 addition & 1 deletion bans/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from uuid import uuid4
from django.db import models
from users.models import UserProfile

# Create your models here.
Expand Down
19 changes: 7 additions & 12 deletions bans/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ def list(self, request):
queryset = self.get_queryset()
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)
else:
return forbidden_no_privileges()
return forbidden_no_privileges()

@login_required_ajax
def retrieve(self, request, pk):
if user_has_insti_privilege(request.user.profile, "RoleB"):
instance = get_object_or_404(self.queryset, pk=pk)
serializer = self.get_serializer(instance)
return Response(serializer.data)
else:
return forbidden_no_privileges()
return forbidden_no_privileges()

@login_required_ajax
def create(self, request):
Expand Down Expand Up @@ -69,11 +67,10 @@ def create(self, request):
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
else:
return forbidden_no_privileges()
return forbidden_no_privileges()

@login_required_ajax
def update(self, request, pk=None, *args, **kwargs):
def update(self, request, *args, pk=None, **kwargs):
if user_has_insti_privilege(request.user.profile, "RoleB"):
instance = get_object_or_404(self.queryset, pk=pk)
serializer = self.get_serializer(instance, data=request.data, partial=True)
Expand All @@ -84,14 +81,12 @@ def update(self, request, pk=None, *args, **kwargs):
return Response(serializer.data)

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
else:
return forbidden_no_privileges()
return forbidden_no_privileges()

@login_required_ajax
def destroy(self, request, pk=None, *args, **kwargs):
def destroy(self, request, *args, pk=None, **kwargs):
if user_has_insti_privilege(request.user.profile, "RoleB"):
instance = get_object_or_404(self.queryset, pk=pk)
instance.delete()
return Response(status=status.HTTP_204_NO_CONTENT)
else:
return forbidden_no_privileges()
return forbidden_no_privileges()
2 changes: 1 addition & 1 deletion buyandsell/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from uuid import uuid4
from django.db.models.deletion import SET
from django.db.models.fields.related import ForeignKey
from django.db import models
from uuid import uuid4
from helpers.misc import get_url_friendly

PDT_NAME_MAX_LENGTH = 60
Expand Down
8 changes: 4 additions & 4 deletions buyandsell/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"""Views for BuyAndSell."""
import json
from django.conf import settings
from django.core.mail import send_mail
from rest_framework.response import Response
from rest_framework import viewsets
from django.shortcuts import get_object_or_404
from django.db.models import Q
from django.utils import timezone
from roles.helpers import login_required_ajax
from buyandsell.models import Ban, Category, ImageURL, Limit, Product, Report
from buyandsell.serializers import ProductSerializer
from helpers.misc import query_search
from users.models import UserProfile
from django.db.models import Q
import json
from django.utils import timezone

REPORTS_THRES = 3

Expand Down Expand Up @@ -93,7 +93,7 @@ def list(self, request):
data = ProductSerializer(queryset, many=True).data
return Response(data)

def get_contact_details(userpro: UserProfile):
def get_contact_details(self, userpro: UserProfile):
return f"""
Phone: {userpro.contact_no}
Email: {userpro.email}"""
Expand Down
3 changes: 1 addition & 2 deletions community/serializer_min.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def get_posted_by(self, obj):
pb.name = "Anonymous"
pb.id = "null"
pb.ldap_id = "null"
pb.profile_pic = \
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSM9q9XJKxlskry5gXTz1OXUyem5Ap59lcEGg&usqp=CAU'
pb.profile_pic = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSM9q9XJKxlskry5gXTz1OXUyem5Ap59lcEGg&usqp=CAU"
elif (
obj.anonymous
and "return_for_mod" in self.context
Expand Down
3 changes: 1 addition & 2 deletions community/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def get_posted_by(self, obj):
pb.name = "Anonymous"
pb.id = "null"
pb.ldap_id = "null"
pb.profile_pic = \
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSM9q9XJKxlskry5gXTz1OXUyem5Ap59lcEGg&usqp=CAU'
pb.profile_pic = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSM9q9XJKxlskry5gXTz1OXUyem5Ap59lcEGg&usqp=CAU"
elif (
obj.anonymous
and "return_for_mod" in self.context
Expand Down
4 changes: 3 additions & 1 deletion community/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def test_communitypost_yourlist(self):
self.assertEqual(
response.data["count"],
CommunityPost.objects.filter(
thread_rank=1, posted_by=self.user1.profile, community=self.test_community_1
thread_rank=1,
posted_by=self.user1.profile,
community=self.test_community_1,
).count(),
)
self.assertListEqual(
Expand Down
1 change: 1 addition & 0 deletions events/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class EventAdmin(admin.ModelAdmin):
list_filter = (
"start_time",
"bodies",
"venues",
)
list_display = (
"name",
Expand Down
22 changes: 22 additions & 0 deletions events/migrations/0032_auto_20231211_2316.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.2.16 on 2023-12-11 17:46

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("events", "0031_alter_event_event_interest"),
]

operations = [
migrations.AddField(
model_name="event",
name="email_body",
field=models.TextField(default=""),
),
migrations.AddField(
model_name="event",
name="email_verified",
field=models.BooleanField(default=False),
),
]
17 changes: 17 additions & 0 deletions events/migrations/0033_rename_email_body_event_longdescription.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.16 on 2023-12-12 10:01

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("events", "0032_auto_20231211_2316"),
]

operations = [
migrations.RenameField(
model_name="event",
old_name="email_body",
new_name="longdescription",
),
]
37 changes: 37 additions & 0 deletions events/migrations/0034_event_verification_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 3.2.16 on 2023-12-13 13:01

from django.db import migrations
import multiselectfield.db.fields


class Migration(migrations.Migration):
dependencies = [
("events", "0033_rename_email_body_event_longdescription"),
]

operations = [
migrations.AddField(
model_name="event",
name="verification_body",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
(
"91199c20-7488-41c5-9f6b-6f6c7c5b897d",
"Institute Cultural Council",
),
(
"81e05a1a-7fd1-45b5-84f6-074e52c0f085",
"Institute Technical Council",
),
(
"a9f81e69-fcc9-4fe3-b261-9e5e7a13f898",
"Institute Sports Council",
),
("f3ae5230-4441-4586-81a8-bf75a2e47318", "Hostel Affairs"),
],
default="91199c20-7488-41c5-9f6b-6f6c7c5b897d",
max_length=147,
),
preserve_default=False,
),
]
35 changes: 35 additions & 0 deletions events/migrations/0035_alter_event_verification_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 3.2.16 on 2023-12-14 04:48

from django.db import migrations
import multiselectfield.db.fields


class Migration(migrations.Migration):
dependencies = [
("events", "0034_event_verification_body"),
]

operations = [
migrations.AlterField(
model_name="event",
name="verification_body",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
(
"d920d898-0998-4ed9-8fb8-f270310b2bec",
"Institute Cultural Council",
),
(
"ae084ebb-6009-4095-a774-44ad0f107bc0",
"Institute Technical Council",
),
(
"0aa10bcc-f08f-44c6-bf50-1ce9b5c2f0f0",
"Institute Sports Council",
),
("6c43632e-de1f-4088-8e77-60af60139e91", "Hostel Affairs"),
],
max_length=147,
),
),
]
35 changes: 35 additions & 0 deletions events/migrations/0036_alter_event_verification_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 3.2.16 on 2023-12-14 07:32

from django.db import migrations
import multiselectfield.db.fields


class Migration(migrations.Migration):
dependencies = [
("events", "0035_alter_event_verification_body"),
]

operations = [
migrations.AlterField(
model_name="event",
name="verification_body",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
(
"Institute Cultural Council",
"d920d898-0998-4ed9-8fb8-f270310b2bec",
),
(
"ae084ebb-6009-4095-a774-44ad0f107bc0",
"Institute Technical Council",
),
(
"0aa10bcc-f08f-44c6-bf50-1ce9b5c2f0f0",
"Institute Sports Council",
),
("6c43632e-de1f-4088-8e77-60af60139e91", "Hostel Affairs"),
],
max_length=137,
),
),
]
35 changes: 35 additions & 0 deletions events/migrations/0037_alter_event_verification_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 3.2.16 on 2023-12-14 07:34

from django.db import migrations
import multiselectfield.db.fields


class Migration(migrations.Migration):
dependencies = [
("events", "0036_alter_event_verification_body"),
]

operations = [
migrations.AlterField(
model_name="event",
name="verification_body",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
(
"d920d898-0998-4ed9-8fb8-f270310b2bec",
"Institute Cultural Council",
),
(
"ae084ebb-6009-4095-a774-44ad0f107bc0",
"Institute Technical Council",
),
(
"0aa10bcc-f08f-44c6-bf50-1ce9b5c2f0f0",
"Institute Sports Council",
),
("6c43632e-de1f-4088-8e77-60af60139e91", "Hostel Affairs"),
],
max_length=147,
),
),
]
35 changes: 35 additions & 0 deletions events/migrations/0038_alter_event_verification_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 3.2.16 on 2023-12-14 10:06

from django.db import migrations
import multiselectfield.db.fields


class Migration(migrations.Migration):
dependencies = [
("events", "0037_alter_event_verification_body"),
]

operations = [
migrations.AlterField(
model_name="event",
name="verification_body",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
(
"91199c20-7488-41c5-9f6b-6f6c7c5b897d",
"Institute Cultural Council",
),
(
"81e05a1a-7fd1-45b5-84f6-074e52c0f085",
"Institute Technical Council",
),
(
"a9f81e69-fcc9-4fe3-b261-9e5e7a13f898",
"Institute Sports Council",
),
("f3ae5230-4441-4586-81a8-bf75a2e47318", "Hostel Affairs"),
],
max_length=147,
),
),
]
Loading
Loading