Skip to content
Snippets Groups Projects
Commit a6e8836e authored by florimondmanca's avatar florimondmanca
Browse files

fix rest_framework urls, other quick fixes

parent 97606db0
Branches
No related tags found
No related merge requests found
"""API routers.""" """API routers."""
from django.urls import path, include
from rest_framework import routers from rest_framework import routers
from .views import users, tutoring from .views import users, tutoring
app_name = 'api' app_name = 'api'
urlpatterns = [ urlpatterns = []
path('api-auth/', include(
'rest_framework.urls', namespace='rest_framework')),
]
# Create your routes here # Create your routes here
......
...@@ -24,5 +24,7 @@ urlpatterns = [ ...@@ -24,5 +24,7 @@ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^api/', include('api.urls')), url(r'^api/', include('api.urls')),
url(r'^api/docs/', include_docs_urls(title='OSER_CS API')), url(r'^api/docs/', include_docs_urls(title='OSER_CS API')),
url('api-auth/', include(
'rest_framework.urls', namespace='rest_framework')),
url(r'^$', TemplateView.as_view(template_name='index.html')), url(r'^$', TemplateView.as_view(template_name='index.html')),
] ]
...@@ -9,7 +9,6 @@ from .models import User, Profile ...@@ -9,7 +9,6 @@ from .models import User, Profile
@receiver(post_save, sender=User) @receiver(post_save, sender=User)
def create_profile_for_new_user(sender, created, instance, **kwargs): def create_profile_for_new_user(sender, created, instance, **kwargs):
"""Automatically creates a new profile for a newly created user.""" """Automatically creates a new profile for a newly created user."""
if created: if created and instance.profile_type:
if instance.profile_type:
model = Profile.get_model(instance.profile_type) model = Profile.get_model(instance.profile_type)
model.objects.create(user=instance) model.objects.create(user=instance)
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
def modify_fields(**kwargs): def modify_fields(**kwargs):
"""Modify the fields of a superclass. """Modify the fields of an inherited model.
Caution: will affect the superclass' fields too. It is preferable to Caution: will affect the inherited model's fields too. It is preferable to
restrict the usage to cases when the superclass is abstract. restrict the usage to cases when the inherited model is abstract.
Example Example
------- -------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment