Skip to content
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

Add Achievements Module #104

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
2 changes: 1 addition & 1 deletion corpus/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CorpusUserAdmin(UserAdmin):

class ExecutiveMemberAdmin(admin.ModelAdmin):
fieldsets = (
(None, {"fields": ("user", "sig")}),
(None, {"fields": ("user", "sig", "date_joined")}),
(
"NITK Related Details",
{
Expand Down
16 changes: 14 additions & 2 deletions corpus/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ def __init__(self, *args, **kwargs):
for visible in self.visible_fields():
visible.field.widget.attrs[
"class"
] = "mt-1 block w-full rounded-md border-base-800 text-black shadow-sm focus:border-primary focus:ring focus:ring-primary-200 focus:ring-opacity-50" # noqa: E501
] = "mt-1 w-full rounded-md shadow-sm" # noqa: E501
if visible.field.widget.input_type in ["text", "password", "email"]:
visible.field.widget.attrs[
"class"
] += " input input-bordered focus:input-primary"
elif visible.field.widget.input_type == "select":
visible.field.widget.attrs[
"class"
] += " select select-bordered focus:select-primary"


class CorpusChangeForm(UserChangeForm):
Expand All @@ -54,7 +62,11 @@ def __init__(self, *args, **kwargs):
for visible in self.visible_fields():
visible.field.widget.attrs[
"class"
] = "mt-1 block w-full rounded-md border-base-800 text-black shadow-sm focus:border-primary focus:ring focus:ring-primary-200 focus:ring-opacity-50" # noqa: E501
] = "mt-1 w-full rounded-md shadow-sm" # noqa: E501
if visible.field.widget.input_type in ["text", "password", "email"]:
visible.field.widget.attrs[
"class"
] += " input input-bordered focus:input-primary"

def clean_username(self):
username = self.cleaned_data.get("username")
Expand Down
237 changes: 237 additions & 0 deletions corpus/dev_accounts_db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
[
{
"fields": {
"date_joined": "2024-02-25T15:58:04Z",
"email": "admin@example.com",
"first_name": "Admin",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": true,
"is_superuser": true,
"last_login": "2024-02-25T16:00:26Z",
"last_name": "Example",
"password": "pbkdf2_sha256$600000$fcABeeEsmGM15Dd4lG7WiW$9G/1iMoCAGb4whUweOPTRyCpLy6IMY8Pmu1zg7zi27c=",
"phone_no": "1234567890",
"user_permissions": []
},
"model": "accounts.user",
"pk": 1
},
{
"fields": {
"date_joined": "2024-02-25T16:09:40Z",
"email": "user1@example.com",
"first_name": "User",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": false,
"is_superuser": false,
"last_login": null,
"last_name": "One",
"password": "pbkdf2_sha256$600000$Cwv74DWoks3V5dS0dQnP1a$7VX3L74bdTOEgwabvhSU+JuOPCvoFtNC/vIMYP/SfTo=",
"phone_no": "1234567891",
"user_permissions": []
},
"model": "accounts.user",
"pk": 2
},
{
"fields": {
"date_joined": "2024-02-25T16:11:26Z",
"email": "user2@example.com",
"first_name": "User",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": false,
"is_superuser": false,
"last_login": null,
"last_name": "Two",
"password": "pbkdf2_sha256$600000$gL00s5frbSpEo4YXULxMXX$NOYvJ9dtdbI/5JkjRwMC+JAcGlftqinNXqkyaTGLroo=",
"phone_no": "1234567892",
"user_permissions": []
},
"model": "accounts.user",
"pk": 4
},
{
"fields": {
"date_joined": "2024-02-25T16:12:05Z",
"email": "user3@example.com",
"first_name": "User",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": false,
"is_superuser": false,
"last_login": null,
"last_name": "Three",
"password": "pbkdf2_sha256$600000$Uez7rmaWTOC8H6w7f5G4XA$f9m+LV1q6rpucl45hRMyEK7Lw61nxy+hxS7TUfhwwqM=",
"phone_no": "1234567893",
"user_permissions": []
},
"model": "accounts.user",
"pk": 5
},
{
"fields": {
"date_joined": "2024-02-25T16:13:01Z",
"email": "user4@example.com",
"first_name": "User",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": false,
"is_superuser": false,
"last_login": null,
"last_name": "Four",
"password": "pbkdf2_sha256$600000$4R9AoWCJlh5aEjreZQ0jVr$G2z4zf69SkLbKt+dbjGgasj/0LdvSK8Q5hm9jQIi9Ro=",
"phone_no": "1234567894",
"user_permissions": []
},
"model": "accounts.user",
"pk": 6
},
{
"fields": {
"date_joined": "2024-02-25T16:13:47Z",
"email": "user5@example.com",
"first_name": "User",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": false,
"is_superuser": false,
"last_login": null,
"last_name": "Five",
"password": "pbkdf2_sha256$600000$278aPjc0My2xPLEwb9Vy4E$K4xSetizP3uXDyITBDvWMly3ZjoETgugL0mRxmFlF+U=",
"phone_no": "1234567895",
"user_permissions": []
},
"model": "accounts.user",
"pk": 7
},
{
"fields": {
"date_joined": "2024-02-25T16:14:32Z",
"email": "user6@example.com",
"first_name": "User",
"gender": "N",
"groups": [],
"is_active": true,
"is_staff": false,
"is_superuser": false,
"last_login": null,
"last_name": "Six",
"password": "pbkdf2_sha256$600000$ealY6zpHM8mFG7rU5XD4Kv$OpV5Hxbk7FBx4rnlLG8s+aRG+byAXvSIAdtj+fAZmUk=",
"phone_no": "1234567896",
"user_permissions": []
},
"model": "accounts.user",
"pk": 8
},
{
"fields": {
"date_joined": "2024-02-25",
"edu_email": "user1@nitk.edu.in",
"github": "user1",
"ieee_email": "user1@ieee.org",
"ieee_number": "12345671",
"is_nep": true,
"linkedin": "https://www.linkedin.com/in/user1/",
"minor_branch": "CS",
"reg_number": "123001",
"roll_number": "123XX001",
"sig": 1
},
"model": "accounts.executivemember",
"pk": 2
},
{
"fields": {
"date_joined": "2024-02-25",
"edu_email": "user2@nitk.edu.in",
"github": "user2",
"ieee_email": "user2@ieee.org",
"ieee_number": "12345672",
"is_nep": true,
"linkedin": null,
"minor_branch": null,
"reg_number": "123002",
"roll_number": "123XX002",
"sig": 2
},
"model": "accounts.executivemember",
"pk": 4
},
{
"fields": {
"date_joined": "2024-02-25",
"edu_email": "user3@nitk.edu.in",
"github": null,
"ieee_email": null,
"ieee_number": null,
"is_nep": false,
"linkedin": "https://www.linkedin.com/in/user3/",
"minor_branch": "PS",
"reg_number": "123003",
"roll_number": "123XX003",
"sig": 3
},
"model": "accounts.executivemember",
"pk": 5
},
{
"fields": {
"date_joined": "2024-02-25",
"edu_email": "user4@nitk.edu.in",
"github": "user4",
"ieee_email": null,
"ieee_number": "12345674",
"is_nep": false,
"linkedin": null,
"minor_branch": "IT",
"reg_number": "123004",
"roll_number": "123XX004",
"sig": 1
},
"model": "accounts.executivemember",
"pk": 6
},
{
"fields": {
"date_joined": "2024-02-25",
"edu_email": "user5@nitk.edu.in",
"github": null,
"ieee_email": "user5@ieee.org",
"ieee_number": null,
"is_nep": true,
"linkedin": null,
"minor_branch": "EC",
"reg_number": "123005",
"roll_number": "123XX005",
"sig": 2
},
"model": "accounts.executivemember",
"pk": 7
},
{
"fields": {
"date_joined": "2024-02-25",
"edu_email": "user6@nitk.edu.in",
"github": null,
"ieee_email": null,
"ieee_number": null,
"is_nep": false,
"linkedin": null,
"minor_branch": null,
"reg_number": "123006",
"roll_number": "123XX006",
"sig": 3
},
"model": "accounts.executivemember",
"pk": 8
}
]
71 changes: 71 additions & 0 deletions corpus/dev_pages_db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[
{
"fields": {
"date": "2023-03-01",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In volutpat pretium imperdiet. Donec sit amet orci dignissim, commodo odio in.",
"title": "Example Achievement 1",
"url": "https://www.example.com/",
"user": 2
},
"model": "pages.achievement",
"pk": 1
},
{
"fields": {
"date": "2023-10-04",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet cursus ligula, sit amet semper nisi. Sed ut ex.",
"title": "Example Achievement 2",
"url": null,
"user": null
},
"model": "pages.achievement",
"pk": 2
},
{
"fields": {
"date": "2022-11-30",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse purus urna, interdum ut diam eu, venenatis tristique augue. Praesent eu.",
"title": "Example Achievement 3",
"url": null,
"user": null
},
"model": "pages.achievement",
"pk": 3
},
{
"fields": {
"achievement": 1,
"tag": "GSOC"
},
"model": "pages.tag",
"pk": 1
},
{
"fields": {
"achievement": 3,
"tag": "IAS SRFP"
},
"model": "pages.tag",
"pk": 2
},
{
"fields": {
"achievement": 3,
"tag": "SB"
},
"model": "pages.tag",
"pk": 3
},
{
"fields": {
"authors": "John Doe, Jane Doe, Someone Else",
"date": "2023-05-10",
"source": "Journal of Example",
"title": "Example Publication 1",
"url": "https://www.example.com/",
"user": null
},
"model": "pages.publication",
"pk": 1
}
]
1 change: 0 additions & 1 deletion corpus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"daisyui": "^4.4.24",
"tailwindcss": "^3.4.0"
Expand Down
9 changes: 9 additions & 0 deletions corpus/pages/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.contrib import admin

from .models import Achievement
from .models import Publication
from .models import Tag

admin.site.register(Achievement)
admin.site.register(Publication)
admin.site.register(Tag)
Loading
Loading