mirror of
https://github.com/kristoferssolo/FOSSDB.git
synced 2025-10-21 17:50:35 +00:00
Deleted account
This commit is contained in:
parent
2528d7d7ad
commit
fa40a0acc8
@ -1,6 +0,0 @@
|
|||||||
from django.apps import AppConfig
|
|
||||||
|
|
||||||
|
|
||||||
class AccountConfig(AppConfig):
|
|
||||||
default_auto_field = "django.db.models.BigAutoField"
|
|
||||||
name = "account"
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
from django import forms
|
|
||||||
from django.contrib.auth.forms import UserCreationForm
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
|
|
||||||
class RegisterForm(UserCreationForm):
|
|
||||||
email = forms.EmailField(required=True)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = User
|
|
||||||
fields = ["username", "email", "password1", "password2"]
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
from django.urls import path
|
|
||||||
|
|
||||||
from . import views
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path("", views.sign_up, name="singup"),
|
|
||||||
path("signup", views.sign_up, name="signup"),
|
|
||||||
path("login", views.login_, name="login"),
|
|
||||||
]
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
from django.contrib.auth import login
|
|
||||||
from django.shortcuts import redirect, render
|
|
||||||
|
|
||||||
from .forms import RegisterForm
|
|
||||||
|
|
||||||
|
|
||||||
def sign_up(request):
|
|
||||||
if request.method == "POST":
|
|
||||||
form = RegisterForm(request.POST)
|
|
||||||
if form.is_valid():
|
|
||||||
user = form.save()
|
|
||||||
login(request, user)
|
|
||||||
return redirect("")
|
|
||||||
else:
|
|
||||||
form = RegisterForm()
|
|
||||||
return render(request, "registration/sign_up.html", {"title": "Sign Up", "form": form})
|
|
||||||
|
|
||||||
|
|
||||||
def login_(request):
|
|
||||||
return render(request, "registration/login.html", {"title": "Login"})
|
|
||||||
@ -1,18 +1,16 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from .license.models import License
|
from .license.models import License
|
||||||
from .operating_system.models import OperatingSystemVersion
|
from .operating_system.models import OperatingSystemVersion
|
||||||
from .tag.models import Tag
|
from .tag.models import Tag
|
||||||
|
|
||||||
User = settings.AUTH_USER_MODEL
|
|
||||||
|
|
||||||
|
|
||||||
class Project(models.Model):
|
class Project(models.Model):
|
||||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, verbose_name="ID")
|
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, verbose_name="ID")
|
||||||
owner = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
|
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
description = models.TextField(blank=True, default="")
|
description = models.TextField(blank=True, default="")
|
||||||
license = models.ManyToManyField(License, blank=True)
|
license = models.ManyToManyField(License, blank=True)
|
||||||
@ -29,8 +27,3 @@ class Project(models.Model):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.owner} | {self.name}"
|
return f"{self.owner} | {self.name}"
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
|
||||||
if not self.uuid:
|
|
||||||
self.uuid = uuid.uuid3(uuid.uuid4(), f"{self.owner.username}-{self.name}")
|
|
||||||
super().save(*args, **kwargs)
|
|
||||||
|
|||||||
@ -35,7 +35,6 @@ DEBUG = config["DEBUG"]
|
|||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
"account",
|
|
||||||
"fossdb",
|
"fossdb",
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
"django.contrib.auth",
|
"django.contrib.auth",
|
||||||
@ -134,6 +133,7 @@ MEDIA_ROOT = BASE_PATH.joinpath("media")
|
|||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
|
# LOGIN_URL = "login/"
|
||||||
LOGIN_REDIRECT_URL = "/"
|
LOGIN_REDIRECT_URL = "/"
|
||||||
LOGOUT_REDIRECT_URL = "/"
|
LOGOUT_REDIRECT_URL = "/"
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,6 @@ from django.urls import include, path
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", include("fossdb.urls")),
|
path("", include("fossdb.urls")),
|
||||||
path("", include("account.urls")),
|
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
path("", include("django.contrib.auth.urls")),
|
path("", include("django.contrib.auth.urls")),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
{% extends "layout.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
|
||||||
{% block meta %}{% endblock %}
|
|
||||||
{% block content %}
|
|
||||||
<form method="post">
|
|
||||||
{% csrf_token %}{{ form }}
|
|
||||||
<p>
|
|
||||||
Don't have an account? Create one <a href="{% url 'signup' %}">Here</a>!
|
|
||||||
</p>
|
|
||||||
<button type="submit">Login</button>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
{% extends "layout.html" %}
|
|
||||||
{% block title %}Sign Up{% endblock %}
|
|
||||||
{% block content %}
|
|
||||||
<form method="post">
|
|
||||||
{% csrf_token %}{{ form }}
|
|
||||||
<p>
|
|
||||||
Have an account? Login <a href="{% url 'login' %}">Here</a>!
|
|
||||||
</p>
|
|
||||||
<button type="submit">Register</button>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
||||||
Loading…
Reference in New Issue
Block a user