-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
118 changed files
with
320 additions
and
252 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,44 +14,9 @@ | |
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.conf import settings | ||
from django.conf.urls.static import static | ||
from django.contrib import admin | ||
from django.urls import include, path | ||
from drf_yasg import openapi | ||
from drf_yasg.views import get_schema_view | ||
from rest_framework import permissions | ||
|
||
schema_view = get_schema_view( | ||
openapi.Info( | ||
title="SoC Portal API", | ||
default_version="v1", | ||
description="Test description", | ||
terms_of_service="https://www.google.com/policies/terms/", | ||
contact=openapi.Contact(email="[email protected]"), | ||
license=openapi.License(name="BSD License"), | ||
), | ||
permission_classes=[], | ||
public=True, | ||
) | ||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("api/accounts/", include("accounts.urls")), | ||
path("api/dashboard/", include("dashboard.urls")), | ||
path("api/projects/", include("projects.urls")), | ||
] | ||
|
||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||
urlpatterns += [ | ||
path( | ||
"swagger<format>/", schema_view.without_ui(cache_timeout=0), name="schema-json" | ||
), | ||
path( | ||
"swagger/", | ||
schema_view.with_ui("swagger", cache_timeout=0), | ||
name="schema-swagger-ui", | ||
), | ||
path("redoc/", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"), | ||
] | ||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.apps import apps | ||
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager | ||
from django.contrib.auth.hashers import make_password | ||
from django.contrib.auth.models import PermissionsMixin, User | ||
from django.core.mail import send_mail | ||
from django.db import models | ||
from django.utils import timezone | ||
|
||
|
||
class User(models.Model): | ||
""" | ||
An extension of | ||
roll_number and password are required. Other fields are optional. | ||
""" | ||
|
||
user = models.OneToOneField(User, on_delete=models.CASCADE) | ||
roll_number = models.CharField( | ||
"roll number", | ||
max_length=20, | ||
unique=True, | ||
help_text="Required. 20 characters or fewer.", | ||
error_messages={ | ||
"unique": "A user with that roll number already exists.", | ||
}, | ||
) | ||
|
||
def clean(self): | ||
super().clean() | ||
self.email = self.__class__.objects.normalize_email(self.email) | ||
|
||
def get_full_name(self): | ||
""" | ||
Return the first_name plus the last_name, with a space in between. | ||
""" | ||
full_name = "%s %s" % (self.first_name, self.last_name) | ||
return full_name.strip() | ||
|
||
def get_short_name(self): | ||
"""Return the short name for the user.""" | ||
return self.first_name | ||
|
||
def email_user(self, subject, message, from_email=None, **kwargs): | ||
"""Send an email to this user.""" | ||
send_mail(subject, message, from_email, [self.email], **kwargs) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for backend project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings") | ||
|
||
application = get_asgi_application() |
Oops, something went wrong.