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 #518

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 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
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
2 changes: 1 addition & 1 deletion .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
ignore = E302,E731,W503,C901,E501
max-complexity = 15
max-line-length = 120
8 changes: 6 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 = "YcMlptYelEtlzhEZutZKHeXfyqkjghiU3FVZBQPn"
SSO_CLIENT_ID_SECRET_BASE64 = "WWNNbHB0WWVsRXRsemhFWnV0WktIZVhmeXFramdoaVUzRlZaQlFQbjpIQjU2VkZybHExODZ0NWpLSFgyV3E2SnhhblBNcTVGRDJwTE9XUHNqb0ZqUU5HOEFTUEJ2cnN4elZHVmozTEFBYmdtRE5sVWZPRGdtSUl1SnhSeGFzcVRWcjhJOXlMUElsUGJYVGtnc0toZ04zdGJpWnRJbk84QXZ1bUFGa3NkQw=="

# Password Login
SSO_DEFAULT_REDIR = "https://insti.app/login"
Expand Down Expand Up @@ -72,4 +72,8 @@
EMAIL_HOST = "smtp.gmail.com"
EMAIL_PORT = "587"
EMAIL_HOST_USER = ""
EMAIL_HOST_PASSWORD = ""
EMAIL_USE_TLS = True
RECIPIENT_LIST = [""]
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
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
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,
),
),
]
29 changes: 29 additions & 0 deletions events/migrations/0039_alter_event_verification_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.16 on 2023-12-29 15:25

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


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

operations = [
migrations.AlterField(
model_name="event",
name="verification_body",
field=multiselectfield.db.fields.MultiSelectField(
choices=[
("", "Institute Cultural Council"),
(
"06868e3e-773e-43d1-8bbb-efe17bb67ed1",
"Institute Technical Council",
),
("", "Institute Sports Council"),
("", "Hostel Affairs"),
],
max_length=39,
),
),
]
24 changes: 24 additions & 0 deletions events/migrations/0040_auto_20231229_2134.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 3.2.16 on 2023-12-29 16:04

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("bodies", "0023_body_canonical_name"),
("events", "0039_alter_event_verification_body"),
]

operations = [
migrations.RemoveField(
model_name="event",
name="verification_body",
),
migrations.AddField(
model_name="event",
name="verification_bodies",
field=models.ManyToManyField(
blank=True, related_name="verEvents", to="bodies.Body"
),
),
]
5 changes: 5 additions & 0 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ class Event(models.Model):

name = models.CharField(max_length=60)
description = models.TextField(blank=True)
longdescription = models.TextField(default="")
email_verified = models.BooleanField(default=False)
bodies = models.ManyToManyField("bodies.Body", related_name="events", blank=True)
verification_bodies = models.ManyToManyField(
"bodies.Body", blank=True, related_name="verEvents"
)
image_url = models.URLField(blank=True, null=True)
website_url = models.URLField(blank=True, null=True)
start_time = models.DateTimeField()
Expand Down
14 changes: 14 additions & 0 deletions events/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class EventSerializer(serializers.ModelSerializer):
each category, i.e. interested and going and minimal
venue info. Use `EventFullSerializer` if you want information
on individual users and venues.

Basically this is the serializzer used in the min view for the event that passes only a few fields
"""

# pylint: disable=C0415
Expand Down Expand Up @@ -62,6 +64,7 @@ class Meta:
"str_id",
"name",
"description",
"longdescription",
"image_url",
"start_time",
"end_time",
Expand Down Expand Up @@ -151,6 +154,13 @@ def get_going(self, obj):
bodies_id = serializers.PrimaryKeyRelatedField(
many=True, read_only=False, queryset=Body.objects.all(), source="bodies"
)
verification_bodies = BodySerializerMin(many=True, read_only=True)
verification_bodies_id = serializers.PrimaryKeyRelatedField(
many=True,
read_only=False,
queryset=Body.objects.all(),
source="verification_bodies",
)

user_tags = serializers.PrimaryKeyRelatedField(
many=True, read_only=False, queryset=UserTag.objects.all(), default=[]
Expand All @@ -173,6 +183,10 @@ class Meta:
"str_id",
"name",
"description",
"longdescription",
"email_verified",
"verification_bodies",
"verification_bodies_id",
"image_url",
"start_time",
"end_time",
Expand Down
Loading
Loading