Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishna-Baldwa committed Oct 27, 2023
2 parents 01b9e71 + ea2b18e commit d7a42f4
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
google_client_secret.json
new_locations.json
locations.json
chatbot_logs.json
.vscode
Expand Down
30 changes: 30 additions & 0 deletions bans/migrations/0004_auto_20231024_1619.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 3.2.16 on 2023-10-24 10:49

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("users", "0040_remove_userprofile_followed_communities"),
("bans", "0003_alter_ssoban_banned_by"),
]

operations = [
migrations.AddField(
model_name="ssoban",
name="banned_user_ldapid",
field=models.CharField(blank=True, max_length=20, null=True),
),
migrations.AlterField(
model_name="ssoban",
name="banned_user",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="banned_user",
to="users.userprofile",
),
),
]
13 changes: 12 additions & 1 deletion bans/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from uuid import uuid4
from users.models import UserProfile

# Create your models here.

Expand All @@ -25,7 +26,11 @@ class SSOBan(models.Model):

id = models.UUIDField(primary_key=True, default=uuid4, blank=False)
banned_user = models.ForeignKey(
to="users.UserProfile", related_name="banned_user", on_delete=models.CASCADE
to="users.UserProfile",
related_name="banned_user",
on_delete=models.CASCADE,
null=True,
blank=True,
)
time_of_creation = models.DateTimeField(auto_now_add=True)
reason = models.CharField(max_length=30, choices=BAN_REASON_CHOICHES)
Expand All @@ -38,3 +43,9 @@ class SSOBan(models.Model):
null=True,
blank=True,
)
banned_user_ldapid = models.CharField(max_length=20, blank=True, null=True)

def save(self, *args, **kwargs) -> None:
if self.banned_user_ldapid:
self.banned_user = UserProfile.objects.get(ldap_id=self.banned_user_ldapid)
return super().save(*args, **kwargs)
10 changes: 5 additions & 5 deletions buyandsell/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class BuyAndSellViewSet(viewsets.ModelViewSet):

def mail_moderator(self, report: Report):
msg = f"""
{str(report.reporter)} lodged a report against the product {str(report.product)} posted by
{str(report.product.user)}.
{str(report.reporter)} lodged a report against the product
{str(report.product)} posted by {str(report.product.user)}.
Alleged Reason: {report.reason}."""
send_mail(
"New Report", msg, settings.DEFAULT_FROM_EMAIL, [report.moderator_email]
Expand Down Expand Up @@ -161,10 +161,10 @@ def update(self, request, pk):
# product.category.numproducts-=1
# product.category.numproducts-=1
if product.user == UserProfile.objects.get(user=request.user):
# request.data._mutable = True
# request.data._mutable = True
# request.data._mutable = True
# request.data._mutable = True
request = self.update_user_details(request)
# self.update_image_urls(request, product)
# self.update_image_urls(request, product)
return super().update(request, pk)
return Response(ProductSerializer(product).data)

Expand Down
1 change: 1 addition & 0 deletions helpers/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def query_from_num(request, default_num, queryset):
return queryset[from_i : from_i + num]



def query_search( # pylint: disable=too-many-arguments
request, min_length, queryset, fields, collection, order_relevance=False
):
Expand Down
5 changes: 4 additions & 1 deletion locations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
from django.http import HttpRequest
import sys
from rest_framework.decorators import api_view
from locations.management.commands.mapnav import handle_entry, dijkstra
from locations.management.commands.mapnav import (
handle_entry,
dijkstra,
)


class LocationViewSet(viewsets.ModelViewSet):
Expand Down
8 changes: 4 additions & 4 deletions messmenu/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def getUserMess(request):

def binaryDecode(x):
b_x = "{0:b}".format(int(x))
day = int(b_x[len(b_x) - 5 : len(b_x)], 2)
meal = b_x[len(b_x) - 8 : len(b_x) - 5]
time = int(b_x[len(b_x) - 19 : len(b_x) - 8], 2)
hostel = int(b_x[0 : len(b_x) - 19], 2)
day = int(b_x[len(b_x) - 5: len(b_x)], 2)
meal = b_x[len(b_x) - 8: len(b_x) - 5]
time = int(b_x[len(b_x) - 19: len(b_x) - 8], 2)
hostel = int(b_x[0: len(b_x) - 19], 2)
return {"hostel": hostel, "time": time, "meal": meal, "day": day}


Expand Down

0 comments on commit d7a42f4

Please sign in to comment.