Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0d53086
let's try.....
arin17bishwa Dec 21, 2022
82c3fd7
updated requirements
arin17bishwa Dec 21, 2022
8b98beb
initial setup for django-prometheus
arin17bishwa Dec 21, 2022
9722583
added to models
arin17bishwa Dec 21, 2022
caf66a6
rebased after making events app live
arin17bishwa Dec 21, 2022
e2cbbcc
updated requirements
arin17bishwa Dec 21, 2022
d9605f6
initial setup for django-prometheus
arin17bishwa Dec 21, 2022
554929c
added to models
arin17bishwa Dec 21, 2022
85a9a65
final(hopefully) merge commit for rebasing
arin17bishwa Dec 23, 2022
8e7633a
modified behaviour of experience update.
arin17bishwa Dec 26, 2022
b9f3856
reformat
arin17bishwa Dec 26, 2022
a424efc
added base API url events
arin17bishwa Dec 26, 2022
2978603
fixed a misplaced ')'
arin17bishwa Dec 26, 2022
956a917
added get_absolute_url method
arin17bishwa Dec 27, 2022
71b24db
created API code
arin17bishwa Dec 27, 2022
54c11f2
added old mailing method(for future benchmarking)
arin17bishwa Dec 27, 2022
75cb8f8
added base URL for Team API
arin17bishwa Dec 27, 2022
3cab03c
added basic API for the team app
arin17bishwa Dec 27, 2022
0f2f354
Merge branch 'RECursion-NITD:testing' into trial_deployment
arin17bishwa Jan 2, 2023
a4a2774
added django-cors-headers and python-dateutil
arin17bishwa Jan 2, 2023
63e152e
added django-cors-headers specific configuration
arin17bishwa Jan 2, 2023
f09e72c
added home_view() for API
arin17bishwa Jan 22, 2023
84fa6db
added url for API home view
arin17bishwa Jan 22, 2023
825a9d2
reduced time range for upcoming_events to 7 days in future
arin17bishwa Jan 22, 2023
8df59ef
corrected authenticated user check
arin17bishwa Jan 22, 2023
8cb669c
increases max_events to 4
arin17bishwa Jan 22, 2023
b3d01dc
added postman API collection link
arin17bishwa Feb 9, 2023
ef33c22
Merge branch 'RECursion-NITD:testing' into trial_deployment
arin17bishwa Feb 12, 2023
133992b
Merge branch 'RECursion-NITD:testing' into trial_deployment
arin17bishwa Jun 5, 2023
bf3a91c
added django-rest-framework API
moinak878 Aug 8, 2023
a0eb788
added apis for content and subtopics
Sivam2313 Sep 28, 2023
bc5a746
[added] API for getting started
moinak878 Sep 29, 2023
c540fe1
api endpoints for google login
Sivam2313 Dec 4, 2023
13ba9e2
Merge branch 'dev-api' of https://github.com/Sivam2313/RECursionNITD-…
Sivam2313 Dec 4, 2023
8b6895e
added api endpoints for google login
Sivam2313 Dec 4, 2023
a9bf675
fixed api and route name
Sivam2313 Dec 6, 2023
c72ef9c
Merge branch 'RECursion-NITD:dev-api' into dev-api
Sivam2313 Dec 6, 2023
e455500
Merge pull request #190 from Sivam2313/dev-api
moinak878 Dec 8, 2023
e33486f
added views for roles and IE reviews filtering
Sivam2313 Mar 3, 2024
e330713
Merge branch 'dev-api' of https://github.com/Sivam2313/RECursionNITD-…
Sivam2313 Mar 3, 2024
429cc6d
changes
Sivam2313 Mar 5, 2024
5bdbd65
Merge pull request #192 from Sivam2313/dev-api
moinak878 Mar 5, 2024
50a6530
fix google login api
moinak878 May 29, 2024
4225ac0
created API to get alumni year wise
Shibshankar0909 Oct 27, 2024
d2d699e
Merge pull request #195 from Shibshankar0909/feature-shib-alumniAPI
Sivam2313 Oct 27, 2024
aa11ca4
deployment changes
apaul2077 Jan 9, 2025
d32babb
changes
apaul2077 Jan 9, 2025
4f08c83
New requirements for 3.11 python added,
apaul2077 Oct 20, 2025
7df4515
Login fixed
apaul2077 Oct 21, 2025
6067caf
changed footer content and fixed profile image problem
apaul2077 Oct 27, 2025
cc4a96f
missing profile picture fixed
apaul2077 Nov 12, 2025
9788dcc
content filter and rate limiting
apaul2077 Nov 29, 2025
7696f5f
Merge pull request #196 from apaul2077/dev-api
apaul2077 Nov 29, 2025
2008def
fixed team member icon hover and layout issue and some other change
apaul2077 Dec 11, 2025
785ee7e
Merge pull request #197 from apaul2077/dev-api
apaul2077 Dec 11, 2025
48f70d1
Made a few backend changes to facilitate registration and user creation
AayushAnand39 Dec 21, 2025
1f3d8fb
Password reset api fixed
ThunderEmperors Dec 24, 2025
e04f1ee
Merge pull request #198 from AayushAnand39/dev-api
apaul2077 Dec 25, 2025
e7ab379
fixed response for invalid password in password reset
ThunderEmperors Dec 25, 2025
d4626a6
fixed events_calendar api to send events in order
ThunderEmperors Dec 25, 2025
ea53ecc
Merge pull request #199 from ThunderEmperors/reset-api
apaul2077 Dec 28, 2025
4ee0fdf
made some changes to interview experience mailing
apaul2077 Jan 6, 2026
3c5766e
deployment changes
apaul2077 Jan 6, 2026
685ac78
Merge pull request #201 from apaul2077/dev-api
apaul2077 Jan 7, 2026
e57d532
fixed google login
apaul2077 Jan 9, 2026
e82af6d
Merge pull request #202 from apaul2077/dev-api
apaul2077 Jan 9, 2026
460d98b
finalised certain login/signup flow APIs, fixed password reset issue,…
apaul2077 Jan 18, 2026
71f8b1d
Merge pull request #203 from apaul2077/dev-api
apaul2077 Jan 18, 2026
008e548
Fix duplicate profile images
Shubham15986 May 3, 2026
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ website/db.sqlit
.env
.venv
env/
myEnv/
myenv/
venv/
ENV/
env.bak/
Expand All @@ -83,4 +85,7 @@ website/events_calendar/migrations/
website/migrations/

# Media files
media/
media/

staticfiles/
.agent/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET='googleSECRET'
4. run ```python manage.py makemigrations```
5. run ```python manage.py migrate```
6. run ```python manage.py runserver```

POSTMAN API
COLLECTION: [REC DRF](https://postman.com/rec-drf-backend-00/workspace/recursion-drf-port-backend/api/3ccf67a5-e059-4d31-8d22-8f3302f94876/version/b021621d-8a18-4f86-aede-8e2737156e9c)
Binary file added old_requirements.txt
Binary file not shown.
Binary file modified requirements.txt
Binary file not shown.
7 changes: 0 additions & 7 deletions website/.env.example

This file was deleted.

73 changes: 41 additions & 32 deletions website/blog/templates/blog/blog_list.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% load static %}
{% load blog_tags %}

{% for post in posts %}
<li class="col-sm-12 col-lg-12 ques_div mt-2 mb-1" id="content">
<ul id="attributeList">
Expand All @@ -7,56 +9,63 @@
<div class="col-sm-1 col-lg-1 mr-2">
{% for p in profile %}
{% if p.user == post.user_id %}
<img src="{{ p.image.url }}" class="rounded-circle mt-2 mb-1" width="55px" height="55px" alt="img">
{% if p.image %}
<img src="{{ p.image.url }}" class="rounded-circle mt-2 mb-1" width="55px" height="55px" alt="img">
{% else %}
<img src="{% static 'image/profile_pic/default.png' %}" class="rounded-circle mt-2 mb-1" width="55px" height="55px" alt="default">
{% endif %}
{% endif %}
{% endfor %}
</div>

<div class="col-lg-6 col-sm-12">
<div>
<a id="questionDetail" href="{% url 'blog:detail_blogs' post.id %}">
<a id="questionDetail" href="{% url 'blog:detail_blogs' post.id %}">
<strong>{{ post.title }}</strong>
</a>
<br>
</div>

<div id="addedBy" class="text-muted">
<li>Posted by <a href="{% url 'user_profile:view_profile' post.user_id.id %}">{{post.user_id}}</a> on</li>
<li>Posted by <a href="{% url 'user_profile:view_profile' post.user_id.id %}">{{ post.user_id }}</a> on</li>
</div>
<li id="postedOn" class="text-muted">{{post.created_at}}</li>

<li id="postedOn" class="text-muted">{{ post.created_at }}</li>
<br>

<li id="tagList">
<ul>
{% for tagging in taggings %}
{% if tagging.post == post %}
{% for tag in tags %}
{% if tagging.tag == tag %}
{% comment %} <li class="tagName" class="font-italic text-muted">{{tag.name}}</li> {% endcomment %}
<li style="display:inline-block;"><a class="tagName" href="{% url 'blog:filter_blog' tag.id %}">{{ tag.name }}</a></li>
{% endif %}
{% endfor %}
{%endif%}
{% for tagging in taggings %}
{% if tagging.post == post %}
{% for tag in tags %}
{% if tagging.tag == tag %}
<li style="display:inline-block;">
<a class="tagName" href="{% url 'blog:filter_blog' tag.id %}">{{ tag.name }}</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</ul>
</li>
</div>
<!-- <div id="AnswerFollow_block" style="display: inline-block;"> -->
<div class="col-sm-5 col-md-3 col-lg-3 mt-auto mb-auto" id="answerBox" style="display: inline-block;">
<div class="row">
<div class="col-sm-6">
{%if post.reply_set.count == 1 %}
<span id="followValue" style="font-size:70%;">{{ post.reply_set.count }} comment
{%else %}
<span id="followValue" style="font-size:70%;">{{ post.reply_set.count }} comments
{%endif%}
</span>
</div>
<div class="col-sm-5 col-md-3 col-lg-6" id="followBox" style="display: inline-block;">
<span id="followValue" style="font-size:70%;">{{post.id|postlike_count}} vote(s)</span>
</div>
</div>

<div class="col-sm-5 col-md-3 col-lg-3 mt-auto mb-auto" id="answerBox" style="display:inline-block;">
<div class="row">
<div class="col-sm-6">
{% if post.reply_set.count == 1 %}
<span id="followValue" style="font-size:70%;">{{ post.reply_set.count }} comment</span>
{% else %}
<span id="followValue" style="font-size:70%;">{{ post.reply_set.count }} comments</span>
{% endif %}
</div>
<!-- </div> -->
</div>
<div class="col-sm-5 col-md-3 col-lg-6" id="followBox" style="display:inline-block;">
<span id="followValue" style="font-size:70%;">{{ post.id|postlike_count }} vote(s)</span>
</div>
</div>
</div>
</div>
</ul>
</li>
<hr>
{% endfor %}
<hr>
{% endfor %}
24 changes: 16 additions & 8 deletions website/blog/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.shortcuts import render, redirect,get_object_or_404, get_list_or_404
from utils.content_filter import check_content_safety
from django_ratelimit.decorators import ratelimit
from .models import *
from user_profile.models import *
from events.models import *
Expand Down Expand Up @@ -78,13 +80,19 @@ def valid_url_extension(url, extension_list=VALID_IMAGE_EXTENSIONS):
return type

@login_required
@ratelimit(key='user', rate='1/10m', method='POST', block=True)
def add_blog(request):
form = Postform(request.POST or None)

Tagform = modelformset_factory(Tags, fields=('name',), extra=5)
if request.method=='POST':
form2 = Tagform(request.POST)
if form.is_valid() and form2.is_valid():
description = form.cleaned_data.get('description')
title = form.cleaned_data.get('title')
if not check_content_safety(description, title):
form.add_error('description', "Your post contains irrelevant/inappropriate content and cannot be published.")
return render(request, 'blog/blog_form.html', {'form': form,'form2':form2,})
f = form.save(commit=False)
f.user_id = request.user
form.save()
Expand Down Expand Up @@ -112,7 +120,7 @@ def add_blog(request):
'domain': current_site.domain,
'post' : Posts.objects.get(pk=f.id),
})
msg=(subject, message, 'webmaster@localhost', [user.email])
msg=(subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
result = send_mass_mail(messages, fail_silently=False)
return redirect('blog:list_blogs')
Expand Down Expand Up @@ -263,7 +271,7 @@ def update_blogs(request, id):
'domain': current_site.domain,
'post': post,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down Expand Up @@ -324,7 +332,7 @@ def add_reply(request, id):
'domain': current_site.domain,
'post': post,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down Expand Up @@ -386,7 +394,7 @@ def update_reply(request, id):
'domain': current_site.domain,
'post': post,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down Expand Up @@ -436,7 +444,7 @@ def add_comment(request, id):
'domain': current_site.domain,
'post': post,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down Expand Up @@ -488,7 +496,7 @@ def update_comment(request, id):
'domain': current_site.domain,
'post': post,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down Expand Up @@ -750,7 +758,7 @@ def add_comment_reply(request, id):
'domain': current_site.domain,
'post': reply.post_id,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down Expand Up @@ -801,7 +809,7 @@ def update_comment_reply(request, id):
'domain': current_site.domain,
'post': reply.post_id,
})
msg = (subject, message, 'webmaster@localhost', [user.email])
msg = (subject, message, settings.SERVER_EMAIL, [user.email])
messages += (msg,)
'''for follow in follows:
user = follow.user
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions website/events_calendar/api/filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django_filters import rest_framework as filters
from events_calendar.models import Events_Calendar


class EventsFilter(filters.FilterSet):
event_type = filters.ChoiceFilter(field_name='event_type', choices=Events_Calendar.event_choices)
target_year = filters.ChoiceFilter(field_name='target_year', choices=Events_Calendar.year_choices)

class Meta:
model = Events_Calendar
fields = {
'start_time': ['gte', 'lte'],
'end_time': ['gte', 'lte'],
}
22 changes: 22 additions & 0 deletions website/events_calendar/api/permissions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from rest_framework.permissions import IsAuthenticatedOrReadOnly, BasePermission, SAFE_METHODS


class EventsListCreatePermission(BasePermission):
def has_permission(self, request, view):
if request.method in SAFE_METHODS:
return True
if not request.user.is_authenticated:
return False
role = request.user.profile.role
return role in ('1', '2')


class EventRetrieveUpdateDestroyPermission(IsAuthenticatedOrReadOnly):
def has_object_permission(self, request, view, obj):
if request.method in SAFE_METHODS:
return True
if not bool(request.user and request.user.is_authenticated):
return False
role = request.user.profile.role
return role in ('1', '2')

16 changes: 16 additions & 0 deletions website/events_calendar/api/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from rest_framework import serializers

from events_calendar.models import Events_Calendar
from user_profile.api.serializers import UserSerializer


class EventsSerializer(serializers.ModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name='events_api:events_detail', lookup_field='id',
lookup_url_kwarg='slug')
user = UserSerializer(read_only=True)

class Meta:
model = Events_Calendar
# exclude = ['id', ]
fields = '__all__'
read_only_fields = ['user', 'url', 'duration', ]
14 changes: 14 additions & 0 deletions website/events_calendar/api/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.urls import path

from .views import (
EventsListCreateView,
EventsRetrieveUpdateDestroyView,

)

app_name = 'events_api'

urlpatterns = [
path('', EventsListCreateView.as_view(), name='events_list'),
path('<int:slug>/', EventsRetrieveUpdateDestroyView.as_view(), name='events_detail'),
]
45 changes: 45 additions & 0 deletions website/events_calendar/api/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from django_filters import rest_framework as filters

from rest_framework.filters import SearchFilter, OrderingFilter
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from events_calendar.models import Events_Calendar
from events_calendar.views import get_event_duration
from .serializers import EventsSerializer
from .permissions import EventsListCreatePermission, EventRetrieveUpdateDestroyPermission
from .filters import EventsFilter


# HIGH POTENTIAL FOR CACHING

class EventsListCreateView(ListCreateAPIView):
serializer_class = EventsSerializer
permission_classes = (EventsListCreatePermission,)
filter_backends = (filters.DjangoFilterBackend, SearchFilter, OrderingFilter)
filterset_class = EventsFilter
search_fields = ['title', 'description', 'venue']
ordering_fields = ['start_time', 'end_time', 'updated_at', 'duration']

def get_queryset(self):
return Events_Calendar.objects.all().order_by('-start_time')

def perform_create(self, serializer):
start_time, end_time = serializer.validated_data.get('start_time'), serializer.validated_data.get('end_time')
serializer.save(user=self.request.user, duration=get_event_duration(start_time, end_time))


class EventsRetrieveUpdateDestroyView(RetrieveUpdateDestroyAPIView):
serializer_class = EventsSerializer
permission_classes = (EventRetrieveUpdateDestroyPermission,)
lookup_field = 'id'
lookup_url_kwarg = 'slug'

def get_queryset(self):
return Events_Calendar.objects.select_related('user').all()

def perform_update(self, serializer):
# Saving twice. Need to find a better way to do it
# Preferably using pre_save signals
event = serializer.save()
event.duration = get_event_duration(event.start_time, event.end_time)
event.save()
Loading