Direct login after registration
This commit is contained in:
parent
f0d3823e15
commit
ad8eeeb955
3
TODO
3
TODO
|
@ -1,5 +1,3 @@
|
||||||
- after registration direct login!
|
|
||||||
|
|
||||||
- bastla will die passwort regeln einfacher haben
|
- bastla will die passwort regeln einfacher haben
|
||||||
- beim qso log kann noch vorne die uhrzeit dran
|
- beim qso log kann noch vorne die uhrzeit dran
|
||||||
|
|
||||||
|
@ -14,6 +12,7 @@
|
||||||
- forms müssen crispy! oderso. sollen schöner
|
- forms müssen crispy! oderso. sollen schöner
|
||||||
- call dupe check mit tastypie based on call+band
|
- call dupe check mit tastypie based on call+band
|
||||||
- qsoform muss den report richtig parsen, gucken ob es [0-5][0-9] ist (blöden validator adden)
|
- qsoform muss den report richtig parsen, gucken ob es [0-5][0-9] ist (blöden validator adden)
|
||||||
|
- after registration direct login!
|
||||||
|
|
||||||
Glaube nich, dass ich das mache
|
Glaube nich, dass ich das mache
|
||||||
- call dupe validation könnte ins model wandern
|
- call dupe validation könnte ins model wandern
|
||||||
|
|
|
@ -7,11 +7,12 @@ from django.contrib.auth.forms import AuthenticationForm
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.contrib.auth import login as auth_login
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from .models import User, Contest, Frequency, Reference, QSO
|
from .models import User, Contest, Frequency, Reference, QSO
|
||||||
from .forms import UpdateRefForm, QSOForm, QSOFormWithTime
|
from .forms import UpdateRefForm, QSOForm, QSOFormWithTime, CustomUserCreationForm
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
|
@ -142,4 +143,16 @@ def overview(request):
|
||||||
return render(request, 'contest/overview.html', {'contest': c, 'qrgs': qrgs})
|
return render(request, 'contest/overview.html', {'contest': c, 'qrgs': qrgs})
|
||||||
|
|
||||||
def register(request):
|
def register(request):
|
||||||
return render(request, 'registration/register.html', {})
|
form = None
|
||||||
|
if request.method == 'POST':
|
||||||
|
form = CustomUserCreationForm(data=request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
form.instance.save()
|
||||||
|
auth_login(request, form.instance)
|
||||||
|
messages.info(request, "Registration as user %s successfull!" % form.instance.username)
|
||||||
|
|
||||||
|
return HttpResponseRedirect(reverse("contest:index"))
|
||||||
|
else:
|
||||||
|
form = CustomUserCreationForm()
|
||||||
|
|
||||||
|
return render(request, 'registration/register.html', {"form": form})
|
||||||
|
|
18
cqtu/urls.py
18
cqtu/urls.py
|
@ -17,11 +17,11 @@ from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
from django.views.generic.edit import CreateView
|
#from django.views.generic.edit import CreateView
|
||||||
#from django.contrib.auth.forms import UserCreationForm
|
#from django.contrib.auth.forms import UserCreationForm
|
||||||
|
|
||||||
from contest.forms import CustomUserCreationForm
|
#from contest.forms import CustomUserCreationForm
|
||||||
from contest.views import index
|
from contest.views import index, register
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@ urlpatterns = [
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^admin/', admin.site.urls),
|
||||||
url(r'^login/$', auth_views.login, name='login'),
|
url(r'^login/$', auth_views.login, name='login'),
|
||||||
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
|
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
|
||||||
#url(r'^register/$', register, name='register'),
|
url(r'^register/$', register, name='register'),
|
||||||
url(r'^register/$', CreateView.as_view(
|
#url(r'^register/$', CreateView.as_view(
|
||||||
template_name='registration/register.html',
|
# template_name='registration/register.html',
|
||||||
form_class=CustomUserCreationForm,
|
# form_class=CustomUserCreationForm,
|
||||||
success_url='/',
|
# success_url='/',
|
||||||
), name='register'),
|
#), name='register'),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue