mirror of
https://github.com/retspen/webvirtcloud
synced 2026-03-23 11:04:49 +00:00
Added V2 from scratch
This commit is contained in:
parent
5c2232f4e8
commit
6c2925a35d
478 changed files with 21437 additions and 134206 deletions
0
backend/user/__init__.py
Normal file
0
backend/user/__init__.py
Normal file
3
backend/user/admin.py
Normal file
3
backend/user/admin.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
backend/user/apps.py
Normal file
5
backend/user/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class UserConfig(AppConfig):
|
||||
name = 'user'
|
||||
0
backend/user/migrations/__init__.py
Normal file
0
backend/user/migrations/__init__.py
Normal file
3
backend/user/models.py
Normal file
3
backend/user/models.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
10
backend/user/serializers.py
Normal file
10
backend/user/serializers.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
class UserSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
fields = ('id', 'email', 'username', 'first_name', 'last_name', 'date_joined', 'last_login', 'is_active')
|
||||
model = User
|
||||
3
backend/user/tests.py
Normal file
3
backend/user/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
7
backend/user/urls.py
Normal file
7
backend/user/urls.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from django.urls import path
|
||||
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
path('', UserView.as_view(), name="user_view"),
|
||||
]
|
||||
13
backend/user/views.py
Normal file
13
backend/user/views.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from rest_framework.generics import RetrieveUpdateAPIView
|
||||
from .serializers import UserSerializer
|
||||
|
||||
class UserView(RetrieveUpdateAPIView):
|
||||
serializer_class = UserSerializer
|
||||
queryset = User.objects.all()
|
||||
|
||||
def get_object(self):
|
||||
return self.queryset.get(pk=self.request.user.id)
|
||||
Loading…
Add table
Add a link
Reference in a new issue