-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
25bce95
commit 20983f1
Showing
25 changed files
with
162 additions
and
146 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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 |
---|---|---|
|
@@ -7,10 +7,12 @@ class Migration(migrations.Migration): | |
|
||
dependencies = [ | ||
('projboard', '0003_alter_article_subject_id'), | ||
('projboard', '0009_user_user1'), | ||
] | ||
|
||
def generate_user_data(apps, schema_editor): | ||
from projboard.models.user import User | ||
from django.contrib.auth.models import User as Custom_user | ||
|
||
test_data = [ | ||
['[email protected]', '123456', 'John Doe', 'User1'], | ||
|
@@ -20,7 +22,8 @@ def generate_user_data(apps, schema_editor): | |
] | ||
with transaction.atomic(): | ||
for u in test_data: | ||
User(email=u[0], password=u[1], name=u[2], nickname=u[3]).save() | ||
user = Custom_user.objects.create_user(username=u[3], password=u[1]) | ||
User(email=u[0], password=u[1], name=u[2], nickname=u[3], user1=user).save() | ||
|
||
operations = [ | ||
migrations.RunPython(generate_user_data), | ||
|
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,22 @@ | ||
# Generated by Django 4.1.3 on 2023-01-19 17:20 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('projboard', '0003_alter_article_subject_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='user', | ||
name='user1', | ||
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.db.models.signals import post_save | ||
from django.contrib.auth.models import User as Custom_user | ||
from django.dispatch import receiver | ||
from models.user import User | ||
|
||
|
||
@receiver(post_save, sender=Custom_user) | ||
def create_custom_user(sender, instance, created, **kwargs): | ||
if created: | ||
User.objects.create(user=instance) | ||
|
||
|
||
@receiver(post_save, sender=Custom_user) | ||
def save_custom_user(sender, instance, **kwargs): | ||
instance.User.save() |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{% extends 'base.html' %} | ||
{% load static %} | ||
<link rel="stylesheet" type="text/css" href="{% static 'css/authentication.css' %}"> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous"> | ||
{% block content %} | ||
<div class="container h-100"> | ||
<div class="d-flex justify-content-center h-100"> | ||
<div class="user_card"> | ||
<div class="d-flex justify-content-center"> | ||
<h1 id="form-title">LOGIN</h1> | ||
</div> | ||
<div class="d-flex justify-content-center form_container"> | ||
<form method="POST" action=""> | ||
{% csrf_token %} | ||
<div class="input-group mb-3"> | ||
<div class="input-group-append"> | ||
<span class="input-group-text"><i class="fas fa-user"></i></span> | ||
</div> | ||
<input type="text" name="username" placeholder="Username..." class="form-control"> | ||
</div> | ||
<div class="input-group mb-2"> | ||
<div class="input-group-append"> | ||
<span class="input-group-text"><i class="fas fa-key"></i></span> | ||
</div> | ||
<input type="password" name="password" placeholder="Password..." class="form-control" > | ||
</div> | ||
{% for message in messages %} | ||
<p id="messages">{{ message }}</p> | ||
{% endfor %} | ||
<div class="d-flex justify-content-center mt-3 login_container"> | ||
<input class="btn login_btn" type="submit" value="Login"> | ||
</div> | ||
</form> | ||
|
||
</div> | ||
<div class="mt-4"> | ||
<div class="d-flex justify-content-center links"> | ||
Don't have an account? <a href="#" class="ml-2">Sign Up</a> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
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
Oops, something went wrong.