Skip to content

Commit

Permalink
Add achievements models
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Nayak <[email protected]>
  • Loading branch information
nishant-nayak committed Jan 19, 2024
1 parent d82df72 commit de7779e
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
hooks:
- id: reorder-python-imports

# Use the following hooks locally to check for issues. These will mostly always fail on CI.
# # Use the following hooks locally to check for issues. These will mostly always fail on CI.
# - repo: https://github.com/PyCQA/bandit
# rev: 1.7.5
# hooks:
Expand All @@ -58,7 +58,7 @@ repos:
# hooks:
# - id: shellcheck

- repo: https://github.com/ecugol/pre-commit-hooks-django
rev: v0.4.0 # Use the ref you want to point at
hooks:
- id: check-untracked-migrations
# - repo: https://github.com/ecugol/pre-commit-hooks-django
# rev: v0.4.0
# hooks:
# - id: check-untracked-migrations
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 4.2.7 on 2024-01-19 16:59
import datetime

from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

dependencies = [
("accounts", "0002_alter_user_email_alter_user_phone_no_executivemember"),
]

operations = [
migrations.AlterField(
model_name="executivemember",
name="date_joined",
field=models.DateTimeField(
default=datetime.datetime(2024, 1, 19, 22, 29, 26, 499748),
verbose_name="Date Joined",
),
),
migrations.AlterField(
model_name="executivemember",
name="github",
field=models.CharField(
blank=True, max_length=39, null=True, verbose_name="GitHub Username"
),
),
]
4 changes: 3 additions & 1 deletion corpus/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ class ExecutiveMember(models.Model):
)

# TODO: Phase out with GitHub OAuth details
github = models.CharField(blank=True, null=True, verbose_name="GitHub Username")
github = models.CharField(
max_length=39, 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"
Expand Down
110 changes: 110 additions & 0 deletions corpus/pages/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Generated by Django 4.2.7 on 2024-01-19 16:59
import django.db.models.deletion
from django.conf import settings
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name="Achievement",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=128, verbose_name="Title")),
("date", models.DateField(verbose_name="Date of Achievement")),
(
"url",
models.URLField(blank=True, null=True, verbose_name="Related URL"),
),
("description", models.TextField(verbose_name="Description")),
(
"user",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
verbose_name="Related User",
),
),
],
),
migrations.CreateModel(
name="Tag",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"tag",
models.CharField(
choices=[
("GSOC", "Google Summer of Code"),
("IAS SRFP", "IAS Summer Research Fellowship Program"),
("SB", "Student Branch Award"),
],
max_length=32,
verbose_name="Tag",
),
),
(
"achievement",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="pages.achievement",
verbose_name="Achievement",
),
),
],
),
migrations.CreateModel(
name="Publication",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=256, verbose_name="Title")),
("date", models.DateField(verbose_name="Publish Date")),
("url", models.URLField(verbose_name="URL")),
("authors", models.CharField(max_length=256, verbose_name="Authors")),
(
"user",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
verbose_name="Related User",
),
),
],
),
]
50 changes: 50 additions & 0 deletions corpus/pages/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from accounts.models import User
from django.db import models


class Achievement(models.Model):
title = models.CharField(max_length=128, verbose_name="Title")
date = models.DateField(verbose_name="Date of Achievement")
url = models.URLField(blank=True, null=True, verbose_name="Related URL")
user = models.ForeignKey(
User,
on_delete=models.CASCADE,
verbose_name="Related User",
blank=True,
null=True,
)
description = models.TextField(verbose_name="Description")

def __str__(self):
return self.title


class Tag(models.Model):
TAGS = [
("GSOC", "Google Summer of Code"),
("IAS SRFP", "IAS Summer Research Fellowship Program"),
("SB", "Student Branch Award"),
# TODO: Add more tags
]

tag = models.CharField(max_length=32, choices=TAGS, verbose_name="Tag")
achievement = models.ForeignKey(
Achievement, on_delete=models.CASCADE, verbose_name="Achievement"
)


class Publication(models.Model):
title = models.CharField(max_length=256, verbose_name="Title")
date = models.DateField(verbose_name="Publish Date")
url = models.URLField(verbose_name="URL")
authors = models.CharField(max_length=256, verbose_name="Authors")
user = models.ForeignKey(
User,
on_delete=models.CASCADE,
verbose_name="Related User",
blank=True,
null=True,
)

def __str__(self):
return self.title

0 comments on commit de7779e

Please sign in to comment.