Fix migrations or something
This commit is contained in:
parent
5d5dd4febd
commit
87845eea66
6 changed files with 13 additions and 28 deletions
|
@ -1,5 +1,6 @@
|
||||||
# Generated by Django 3.0.8 on 2020-07-22 02:18
|
# Generated by Django 3.0.8 on 2020-07-22 02:25
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
@ -9,6 +10,7 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -27,6 +29,7 @@ class Migration(migrations.Migration):
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('state', models.CharField(choices=[('I', 'Interested'), ('A', 'Admitted'), ('D', 'Denied')], max_length=1)),
|
('state', models.CharField(choices=[('I', 'Interested'), ('A', 'Admitted'), ('D', 'Denied')], max_length=1)),
|
||||||
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.Event')),
|
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.Event')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# Generated by Django 3.0.8 on 2020-07-22 02:18
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
('events', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='eventregistration',
|
|
||||||
name='user',
|
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -43,7 +43,7 @@ def register_callback(req: HttpRequest):
|
||||||
raise OAuthException(f'username and id are expected values: {user}')
|
raise OAuthException(f'username and id are expected values: {user}')
|
||||||
else:
|
else:
|
||||||
logger.debug(f'Succesfully authenticated user: {user["username"]} with id: {user["id"]}')
|
logger.debug(f'Succesfully authenticated user: {user["username"]} with id: {user["id"]}')
|
||||||
validated_user = validate_user(user['zeus_id'], user['username'])
|
validated_user = validate_user(user['id'], user['username'])
|
||||||
login(req, validated_user)
|
login(req, validated_user)
|
||||||
redirect('/')
|
redirect('/')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 3.0.8 on 2020-07-22 02:18
|
# Generated by Django 3.0.8 on 2020-07-22 02:25
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
<title>Profile</title>
|
<title>Profile</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<p>{{ username }}</p>
|
||||||
|
{% else %}
|
||||||
|
<p>Not logged in</p>
|
||||||
|
<a href="/login/zeus/register">Login</a>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -3,4 +3,4 @@ from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
def profile(request):
|
def profile(request):
|
||||||
render(request, "profile.html", {"username": request.user.username})
|
return render(request, "profile.html", {"username": request.user.username})
|
||||||
|
|
Loading…
Reference in a new issue