Skip to content

Commit

Permalink
feat(#1): create students view
Browse files Browse the repository at this point in the history
Co-authored-by: Diego Resende <[email protected]>
  • Loading branch information
victorcommite and wdresende committed May 18, 2019
1 parent ecd23ca commit d9dd6c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion perfil/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'students'
]

MIDDLEWARE = [
Expand Down Expand Up @@ -109,7 +110,7 @@

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'
TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

Expand Down
2 changes: 2 additions & 0 deletions perfil/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"""
from django.contrib import admin
from django.urls import path
from .views import create_student

urlpatterns = [
path('admin/', admin.site.urls),
path('new', create_student, name='create_students'),
]
8 changes: 7 additions & 1 deletion students/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from django.shortcuts import render

# Create your views here.
def create_student(request):
form = StudentForm(request.POST or None)

if form.is_valid():
form.save()

return render(request, 'students-form.html', {'form': form})

0 comments on commit d9dd6c9

Please sign in to comment.