-
Notifications
You must be signed in to change notification settings - Fork 4
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
Added Teams Page #134
Added Teams Page #134
Changes from all commits
9c4098e
ccd4530
e76ad81
3fbe833
1c52b05
3da4e98
a4f0904
a6c0b67
880b625
9fb8c57
f856a07
33c47bd
4cd43dd
4de896a
c364ec3
75c2922
57f503f
34c08e3
9e153fd
fc8ffe3
4643f52
b04c662
7dec563
0ee74d1
34e21c0
29acc3f
6ad1640
c967b3c
0fe008b
0834376
61aba1f
829451d
d514b78
802807e
f411c87
7ee3770
d767f9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Generated by Django 4.2.7 on 2024-02-29 12:37 | ||
import datetime | ||
|
||
import django.db.models.deletion | ||
import django.utils.timezone | ||
from django.conf import settings | ||
from django.db import migrations | ||
from django.db import models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("config", "0004_sig_society_sigs"), | ||
("accounts", "0002_alter_user_email_alter_user_phone_no_executivemember"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="executivemember", | ||
name="profile_picture", | ||
field=models.ImageField( | ||
blank=True, null=True, upload_to="execmember/profile_picture" | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="executivemember", | ||
name="date_joined", | ||
field=models.DateTimeField( | ||
default=datetime.datetime(2024, 2, 29, 18, 7, 3, 350454), | ||
verbose_name="Date Joined", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="executivemember", | ||
name="github", | ||
field=models.CharField( | ||
blank=True, max_length=200, null=True, verbose_name="GitHub Username" | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="Faculty", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("post", models.CharField(max_length=100)), | ||
("term_start", models.DateField(default=django.utils.timezone.now)), | ||
("term_end", models.DateField(null=True)), | ||
( | ||
"sig", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="config.sig" | ||
), | ||
), | ||
( | ||
"user", | ||
models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name_plural": "faculties", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="Core", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("post", models.CharField(max_length=100)), | ||
("term_start", models.DateField(default=django.utils.timezone.now)), | ||
("term_end", models.DateField(null=True)), | ||
( | ||
"sig", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="config.sig" | ||
), | ||
), | ||
( | ||
"user", | ||
models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
), | ||
] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
from django.contrib.auth.base_user import BaseUserManager | ||
from django.contrib.auth.models import AbstractUser | ||
from django.db import models | ||
from django.utils.timezone import now | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from .validators import validate_ieee_email | ||
|
@@ -135,13 +136,16 @@ class ExecutiveMember(models.Model): | |
blank=True, null=True, verbose_name="Linkedin Profile URL" | ||
) | ||
|
||
profile_picture = models.ImageField( | ||
blank=True, null=True, upload_to="accounts/executivemember/profile_picture" | ||
) | ||
# TODO: Phase out with GitHub OAuth details | ||
github = models.CharField( | ||
max_length=200, blank=True, null=True, verbose_name="GitHub Username" | ||
) | ||
is_nep = models.BooleanField(default=False, verbose_name="Is NEP Member?") | ||
date_joined = models.DateTimeField( | ||
default=datetime.now(), verbose_name="Date Joined" | ||
verbose_name="Date Joined", default=datetime.now() | ||
) | ||
|
||
def save(self, *args, **kwargs): | ||
|
@@ -151,3 +155,22 @@ def save(self, *args, **kwargs): | |
|
||
def __str__(self): | ||
return f"{self.user.first_name} {self.user.last_name} [{self.sig.name}]" | ||
|
||
|
||
class Core(models.Model): | ||
user = models.OneToOneField(User, null=False, on_delete=models.CASCADE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're decoupling Core and Faculty, I think this can be a OneToOne to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey I tried doing that but now I have this issue when I try to makemigrations
I tried deleting all pre-existing model instances from the db and it still throws the error. How can I fix this? It has bugged me a lot in the past too lol. Further, I cannot open the Core model menu in the django-admin site. It throws this error page at me: Plx help There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do the following:
Note that this will nuke your existing data in the DB. If you've created temp users and other things, maybe try to dump the data using dumpdata |
||
post = models.CharField(max_length=100, null=False) | ||
yukitya-1811 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sig = models.ForeignKey(SIG, null=False, on_delete=models.CASCADE) | ||
term_start = models.DateField(default=now, null=False) | ||
yukitya-1811 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
term_end = models.DateField(null=True) | ||
yukitya-1811 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class Faculty(models.Model): | ||
yukitya-1811 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
class Meta: | ||
verbose_name_plural = "faculties" | ||
|
||
user = models.OneToOneField(User, null=False, on_delete=models.CASCADE) | ||
sig = models.ForeignKey(SIG, null=False, on_delete=models.CASCADE) | ||
post = models.CharField(max_length=100, null=False) | ||
yukitya-1811 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
term_start = models.DateField(default=now, null=False) | ||
yukitya-1811 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
term_end = models.DateField(null=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the
django.utils.timezone.now()
function here instead?