From 11588aa61d7253af16d305481bdf1898b319d8b8 Mon Sep 17 00:00:00 2001 From: Muhammed Zafar Date: Sun, 29 Oct 2023 20:13:56 +0530 Subject: [PATCH 1/3] [STYLE] prevent pycharm formatting db --- db/hackathon.py | 1 + db/integrations.py | 2 ++ db/learning_circle.py | 4 +++- db/notification.py | 4 +++- db/organization.py | 2 ++ db/task.py | 4 ++-- db/url_shortener.py | 1 + db/user.py | 1 + 8 files changed, 15 insertions(+), 4 deletions(-) diff --git a/db/hackathon.py b/db/hackathon.py index 05285fbb..a7b07e4f 100644 --- a/db/hackathon.py +++ b/db/hackathon.py @@ -4,6 +4,7 @@ from db.user import User # fmt: off +# noinspection PyPep8 class Hackathon(models.Model): id = models.CharField(primary_key=True, max_length=36) diff --git a/db/integrations.py b/db/integrations.py index 7e487bbf..849d2649 100644 --- a/db/integrations.py +++ b/db/integrations.py @@ -3,7 +3,9 @@ from django.db import models from db.user import User + # fmt: off +# noinspection PyPep8 class Integration(models.Model): id = models.CharField(primary_key=True, default=uuid.uuid4, max_length=36) diff --git a/db/learning_circle.py b/db/learning_circle.py index fe74d4d1..6ea2c3f0 100644 --- a/db/learning_circle.py +++ b/db/learning_circle.py @@ -2,7 +2,9 @@ from db.task import InterestGroup, Organization from db.user import User + # fmt: off +# noinspection PyPep8 class LearningCircle(models.Model): id = models.CharField(primary_key=True, max_length=36) @@ -36,4 +38,4 @@ class UserCircleLink(models.Model): class Meta: managed = False - db_table = "user_circle_link" \ No newline at end of file + db_table = "user_circle_link" diff --git a/db/notification.py b/db/notification.py index ba677108..5655dace 100644 --- a/db/notification.py +++ b/db/notification.py @@ -3,7 +3,9 @@ from django.db import models from db.user import User + # fmt: off +# noinspection PyPep8 class Notification(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) @@ -18,4 +20,4 @@ class Notification(models.Model): class Meta: managed = False db_table = "notification" - ordering = ["created_at"] \ No newline at end of file + ordering = ["created_at"] diff --git a/db/organization.py b/db/organization.py index d63c3b57..3dd5d509 100644 --- a/db/organization.py +++ b/db/organization.py @@ -3,7 +3,9 @@ from django.db import models from .user import User + # fmt: off +# noinspection PyPep8 class Country(models.Model): id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) diff --git a/db/task.py b/db/task.py index 22db519d..375f9b76 100644 --- a/db/task.py +++ b/db/task.py @@ -6,7 +6,7 @@ from .user import User # fmt: off - +# noinspection PyPep8 class Channel(models.Model): id = models.CharField(primary_key=True, max_length=36) @@ -212,4 +212,4 @@ class VoucherLog(models.Model): class Meta: managed = False - db_table = "voucher_log" \ No newline at end of file + db_table = "voucher_log" diff --git a/db/url_shortener.py b/db/url_shortener.py index 8b7c5ac7..7bc3facc 100644 --- a/db/url_shortener.py +++ b/db/url_shortener.py @@ -3,6 +3,7 @@ from db.user import User # fmt: off +# noinspection PyPep8 class UrlShortener(models.Model): id = models.CharField(primary_key=True, max_length=36) diff --git a/db/user.py b/db/user.py index e6536118..e37fcffa 100644 --- a/db/user.py +++ b/db/user.py @@ -4,6 +4,7 @@ # fmt: off +# noinspection PyPep8 class User(models.Model): id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) From 1a14db5771105264ed8f9b3df51c1cedc37d2ec4 Mon Sep 17 00:00:00 2001 From: Muhammed Zafar Date: Sun, 29 Oct 2023 20:18:16 +0530 Subject: [PATCH 2/3] [STYLE] DB remove pycharm formatting --- db/user.py | 164 ++++++++++++++++++++++++----------------------------- 1 file changed, 74 insertions(+), 90 deletions(-) diff --git a/db/user.py b/db/user.py index e37fcffa..76f03305 100644 --- a/db/user.py +++ b/db/user.py @@ -2,27 +2,25 @@ from django.db import models - # fmt: off # noinspection PyPep8 class User(models.Model): - id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) - discord_id = models.CharField(unique=True, max_length=36, blank=True, null=True) - muid = models.CharField(unique=True, max_length=100) - first_name = models.CharField(max_length=75) - last_name = models.CharField(max_length=75, blank=True, null=True) - email = models.EmailField(unique=True, max_length=200) - password = models.CharField(max_length=200, blank=True, null=True) - mobile = models.CharField(unique=True, max_length=15) - district = models.ForeignKey("district", models.DO_NOTHING, blank=True, null=True) - gender = models.CharField(max_length=10, blank=True, null=True, choices=[("Male", "Male"), ("Female", "Female")]) - dob = models.DateField(blank=True, null=True) - admin = models.BooleanField(default=False) - active = models.BooleanField(default=True) + id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) + discord_id = models.CharField(unique=True, max_length=36, blank=True, null=True) + muid = models.CharField(unique=True, max_length=100) + first_name = models.CharField(max_length=75) + last_name = models.CharField(max_length=75, blank=True, null=True) + email = models.EmailField(unique=True, max_length=200) + password = models.CharField(max_length=200, blank=True, null=True) + mobile = models.CharField(unique=True, max_length=15) + gender = models.CharField(max_length=10, blank=True, null=True, choices=[("Male", "Male"),("Female", "Female")]) + dob = models.DateField(blank=True, null=True) + admin = models.BooleanField(default=False) + active = models.BooleanField(default=True) exist_in_guild = models.BooleanField(default=False) - profile_pic = models.CharField(max_length=200, blank=True, null=True) - created_at = models.DateTimeField(auto_now_add=True) + profile_pic = models.CharField(max_length=200, blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -37,16 +35,14 @@ def fullname(self): class UserReferralLink(models.Model): - id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) - user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_user') - referral = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_referral') - is_coin = models.BooleanField(default=False) - updated_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_updated_by', - db_column='updated_by') - updated_at = models.DateTimeField(auto_now=True) - created_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_created_by', - db_column='created_by') - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) + user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_user') + referral = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_referral') + is_coin = models.BooleanField(default=False) + updated_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_updated_by', db_column='updated_by') + updated_at = models.DateTimeField(auto_now=True) + created_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_referral_link_created_by', db_column='created_by') + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -54,15 +50,13 @@ class Meta: class Role(models.Model): - id = models.CharField(primary_key=True, max_length=36) - title = models.CharField(max_length=75) - description = models.CharField(max_length=300, blank=True, null=True) - updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', - related_name='role_updated_by') - updated_at = models.DateTimeField(auto_now=True) - created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', - related_name='role_created_by') - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36) + title = models.CharField(max_length=75) + description = models.CharField(max_length=300, blank=True, null=True) + updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', related_name='role_updated_by') + updated_at = models.DateTimeField(auto_now=True) + created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', related_name='role_created_by') + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -70,13 +64,12 @@ class Meta: class UserRoleLink(models.Model): - id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) - user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_role_link_user') - role = models.ForeignKey(Role, on_delete=models.CASCADE) - verified = models.BooleanField(default=False) - created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', - related_name='user_role_link_created_by') - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) + user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_role_link_user') + role = models.ForeignKey(Role, on_delete=models.CASCADE) + verified = models.BooleanField(default=False) + created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', related_name='user_role_link_created_by') + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -84,23 +77,20 @@ class Meta: class Socials(models.Model): - id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) - user = models.ForeignKey(User, on_delete=models.CASCADE) - github = models.CharField(max_length=60, blank=True, null=True) - facebook = models.CharField(max_length=60, blank=True, null=True) - instagram = models.CharField(max_length=60, blank=True, null=True) - linkedin = models.CharField(max_length=60, blank=True, null=True) - dribble = models.CharField(max_length=60, blank=True, null=True) - behance = models.CharField(max_length=60, blank=True, null=True) - stackoverflow = models.CharField(max_length=60, blank=True, null=True) - medium = models.CharField(max_length=60, blank=True, null=True) - hackerrank = models.CharField(max_length=60, blank=True, null=True) - created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', - related_name='socials_created_by') - updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', - related_name='socials_updated_by') - created_at = models.DateTimeField(auto_now_add=True) - updated_at = models.DateTimeField(blank=True, null=True, auto_now=True) + id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) + user = models.ForeignKey(User, on_delete=models.CASCADE) + github = models.CharField(max_length=60, blank=True, null=True) + facebook = models.CharField(max_length=60, blank=True, null=True) + instagram = models.CharField(max_length=60, blank=True, null=True) + linkedin = models.CharField(max_length=60, blank=True, null=True) + dribble = models.CharField(max_length=60, blank=True, null=True) + behance = models.CharField(max_length=60, blank=True, null=True) + stackoverflow = models.CharField(max_length=60, blank=True, null=True) + medium = models.CharField(max_length=60, blank=True, null=True) + created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', related_name='socials_created_by') + updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', related_name='socials_updated_by') + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(blank=True, null=True, auto_now=True) class Meta: managed = False @@ -108,10 +98,10 @@ class Meta: class ForgotPassword(models.Model): - id = models.CharField(primary_key=True, max_length=36) - user = models.ForeignKey(User, on_delete=models.CASCADE) - expiry = models.DateTimeField() - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36) + user = models.ForeignKey(User, on_delete=models.CASCADE) + expiry = models.DateTimeField() + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -119,15 +109,13 @@ class Meta: class UserSettings(models.Model): - id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) - user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="user_settings_user") - is_public = models.BooleanField(default=False) - updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', - related_name='user_settings_updated_by') - updated_at = models.DateTimeField(auto_now=True) - created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', - related_name='user_settings_created_by') - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36, default=uuid.uuid4) + user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="user_settings_user") + is_public = models.BooleanField(default=False) + updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', related_name='user_settings_updated_by') + updated_at = models.DateTimeField(auto_now=True) + created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', related_name='user_settings_created_by') + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -135,15 +123,13 @@ class Meta: class DynamicRole(models.Model): - id = models.CharField(primary_key=True, max_length=36) - type = models.CharField(max_length=50) - role = models.ForeignKey(Role, on_delete=models.CASCADE, db_column='role', related_name='dynamic_role_role') - updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', - related_name='dynamic_role_updated_by') - updated_at = models.DateTimeField(auto_now=True) - created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', - related_name='dynamic_role_created_by') - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36) + type = models.CharField(max_length=50) + role = models.ForeignKey(Role, on_delete=models.CASCADE, db_column='role', related_name='dynamic_role_role') + updated_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='updated_by', related_name='dynamic_role_updated_by') + updated_at = models.DateTimeField(auto_now=True) + created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_column='created_by', related_name='dynamic_role_created_by') + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False @@ -151,15 +137,13 @@ class Meta: class DynamicUser(models.Model): - id = models.CharField(primary_key=True, max_length=36) - type = models.CharField(max_length=50) - user = models.ForeignKey('User', on_delete=models.CASCADE, related_name='dynamic_user_user') - updated_by = models.ForeignKey('User', on_delete=models.CASCADE, db_column='updated_by', - related_name='dynamic_user_updated_by') - updated_at = models.DateTimeField(auto_now=True) - created_by = models.ForeignKey('User', on_delete=models.CASCADE, db_column='created_by', - related_name='dynamic_user_created_by') - created_at = models.DateTimeField(auto_now_add=True) + id = models.CharField(primary_key=True, max_length=36) + type = models.CharField(max_length=50) + user = models.ForeignKey('User', on_delete=models.CASCADE, related_name='dynamic_user_user') + updated_by = models.ForeignKey('User', on_delete=models.CASCADE, db_column='updated_by', related_name='dynamic_user_updated_by') + updated_at = models.DateTimeField(auto_now=True) + created_by = models.ForeignKey('User', on_delete=models.CASCADE, db_column='created_by', related_name='dynamic_user_created_by') + created_at = models.DateTimeField(auto_now_add=True) class Meta: managed = False From 986be422a7a741aa9a6c992d8ef6c26fe8799085 Mon Sep 17 00:00:00 2001 From: Muhammed Zafar Date: Sun, 29 Oct 2023 21:15:43 +0530 Subject: [PATCH 3/3] [MINOR] Patch in dev --- api/dashboard/task/dash_task_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/dashboard/task/dash_task_view.py b/api/dashboard/task/dash_task_view.py index 63087314..74531ead 100644 --- a/api/dashboard/task/dash_task_view.py +++ b/api/dashboard/task/dash_task_view.py @@ -30,7 +30,7 @@ def get(self, request): task_queryset = TaskList.objects.select_related( "created_by", "updated_by", - "channels", + "channel", "type", "level", "ig",