Commit 4097a5ae authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Rename of the poc module



I renamed the poc module into main for clarity.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 67d99d30
......@@ -2,7 +2,7 @@ from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from poc.models import AllgoUser
from main.models import AllgoUser
# Define an inline admin descriptor for Employee model
......
from django.apps import AppConfig
class PocConfig(AppConfig):
name = 'poc'
class MainConfig(AppConfig):
name = 'main'
from django.conf.urls import url, include
# from django.contrib.auth import views as auth_views
from . import views
app_name = 'main'
......@@ -13,7 +12,13 @@ urlpatterns = [
name='webapp_detail'),
url(r'^jobs/$', views.JobList.as_view(), name='job_list'),
# Settings
url(
r'^settings/$',
views.UserUpdateView.as_view(),
name='user_settings'),
# Registration
url('^auth/', include('django.contrib.auth.urls')),
url(r'^auth/', include('django.contrib.auth.urls')),
url(r'^auth/signup/$', views.SignUp.as_view(), name='signup'),
]
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render
from django.urls import reverse_lazy
from django.views.generic import CreateView, ListView, DetailView
from django.urls import reverse_lazy, reverse
from django.views.generic import (
CreateView,
ListView,
DetailView,
UpdateView,
)
from .models import Webapp, Job
from .models import Webapp, Job, AllgoUser
def index(request):
......@@ -18,7 +23,7 @@ class WebappList(ListView):
**Context**
``Webapp``
An instance of :model:`poc.Webapp`
An instance of :model:`main.Webapp`
**Template:**
:template:`templates/webapp_list.html`
......@@ -53,7 +58,22 @@ class JobList(LoginRequiredMixin, ListView):
return queryset
class UserUpdateView(LoginRequiredMixin, UpdateView):
fields = ['name', ]
model = AllgoUser
def get_success_url(self):
return reverse(
'main:user_settings',
kwargs={'username': self.request.user.username})
def get_object(self):
# Only get the User record for the user making the request
return AllgoUser.objects.get(user__username=self.request.user.username)
class SignUp(CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
success_url = reverse_lazy('main:login')
template_name = 'registration/signup.html'
......@@ -59,7 +59,7 @@ DJANGO_APPS = [
'django.contrib.staticfiles',
]
LOCAL_APPS = [
'poc',
'main',
]
if "ALLGO_ADDITIONAL_APPS" in os.environ:
......
......@@ -9,14 +9,20 @@ urlpatterns = [
url(settings.ADMIN_URL, admin.site.urls),
# Allgo stuff here
url(r'', include('poc.urls')),
url(r'', include('main.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG:
urlpatterns += [
url(r'^400/$', default_views.bad_request, kwargs={'exception': Exception('Bad Request!')}),
url(r'^403/$', default_views.permission_denied, kwargs={'exception': Exception('Permission denied!')}),
url(r'^404/$', default_views.page_not_found, kwargs={'exception': Exception('Page not found!')}),
url(r'^400/$',
default_views.bad_request,
kwargs={'exception': Exception('Bad Request!')}),
url(r'^403/$',
default_views.permission_denied,
kwargs={'exception': Exception('Permission denied!')}),
url(r'^404/$',
default_views.page_not_found,
kwargs={'exception': Exception('Page not found!')}),
url(r'^500/$', default_views.server_error),
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment