Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django: static file not found
Running Debian on Virtual Machine guest inside Windows host. Set Bridged for adapter-type. Installed Django on the guest and using build-in runserver and built-in database for testing purposes. Having simple files structure: ``` .. templates base.html static css base.css manage.py setting.py .. ``` File settings.py: STATIC_URL = '/static/' File base.html: {% load static %} ... <link rel="stylesheet" href="{% static 'css/base.css' %}"> Getting error, not found: GET http://192.168.XX.XX:8000/static/css/base.css Debug in settings.py is set to true (means static files should be surved). The link looks correct. Now why doesn't this work? -
customize Django CMS Navigation
Now I want to create a website by Django CMS,but I am the first time to use Django CMS,and I don not have any Django knowlege(I am learning). I want to customize the Navigation bar like the picture,what should I do,install a plugins or write the code by myself. Please tell me.Thank you very much. -
Django select_related filter
I have the following Django models. class A(models.Model): tmp = models.ForeignKey(B) active = models.BooleanField() class B(models.Model): active = models.BooleanField() archived = models.BooleanField() Now I have the following query. A.objects.select_related(B).filter(active=True) Now this fetches all the objects of B. Now how can I include a filter of active=True and archived=False in the select_related clause for model B. -
how can save a field many to many at create view from a model an other model of django
class registro_respuesta(CreateView): template_name = 'app_examen/respuesta.html' model = respuesta fields = ['pregun','nombre','correcta'] def post(self, request, *args, **kwargs): ctx = {} flag = False p = respuesta() c = pregunta_respuesta() pe = pregunta.objects.get(id=request.POST['pregun']) p.pregun = pe p.nombre = request.POST['nombre'] p.correcta = request.POST.get('correcta','') p.save() c.id_pregunta = p.pregun c.id_respuesta = p.nombre #the error is here c.save() return render(request,'app_examen/respuesta.html') def get_context_data(self, **kwargs): ctx = super(registro_respuesta,self).get_context_data(**kwargs) ctx['preguntas'] = pregunta.objects.all() return ctx -
No module named Django:
I want to deploy my Django project in windows environment.I'm using:- Windows7 64bit Apache2 python2.7 Django 1.8 VCforPython And after installing all required Dependencies I have set my Environment Variables for:- Variable name:PATH variable value:my python path variable name: DJANGO_SETTINGS_MODULE variable value:project.settings And my httpd.conf:- <VirtualHost *:80> ServerName http://localhost WSGIScriptAlias / C:\Apache2\htdocs\project\project\wsgi.py <Directory "C:\Apache2\htdocs\project"> Require all granted </Directory> </VirtualHost> But when i try to view my project in localhost/ i got "no module named Django" What did miss?? -
python social auth openid connect : AuthCanceled Authentication process canceled error
http://localhost:8000/complete/dh-oidc/?state=B4CqttCYsajNTxqQg4Jx37fOgZYHkrUN&code=4/KPae2R9LI2VxRyYZ4YPCWR78_91E8AooHcr1SoO3AjM&authuser=0&hd=abc.com&session_state=02b7ff10b89a6a59d7c1854211a689e166238313..7eef&prompt=none# My code: how can we integrate any SSO provider using python social auth openid connect? {"error_message": "AuthCanceled\nAuthentication process canceled\n\n", "error_code": 409, "error_track": "TRACEBACK:\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/django/core/handlers/base.py\", line 132, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/django/views/decorators/cache.py\", line 57, in _wrapped_view_func\n response = view_func(request, *args, **kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/django/views/decorators/csrf.py\", line 58, in wrapped_view\n return view_func(*args, **kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/social/apps/django_app/utils.py\", line 51, in wrapper\n return func(request, backend, *args, **kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/social/apps/django_app/views.py\", line 28, in complete\n redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/social/actions.py\", line 44, in do_complete\n user = backend.complete(user=user, *args, **kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/social/backends/base.py\", line 41, in complete\n return self.auth_complete(*args, **kwargs)\n\n File \"/Users/ranvijay.s/.virtualenvs/env/lib/python2.7/site-packages/social/utils.py\", line 249, in wrapper\n raise AuthCanceled(args[0], response=err.response)\n\n"} -
Python TCP server && website
I was wondering what is the best way to connect Python TCP server with website. I need running all the time TCP server (I thought python would be best choice) which will be sending info about new connection to my website. When new connection arrives I would like to, for example, show button with socket-descriptor of connected user. I do not need code, I can do it by myself, what I need from you is help to figure out what is best way of doing this. Should I use php? JQuery? Ajax? Django? If so, how to connect my script to send info to website? Thanks in advance. -
Django “TypeError: list() got an unexpected keyword argument 'id''” error
I am trying to redirect to a page I intend to implement as an object's homepage after creation of one. views.py from django.shortcuts import render, get_object_or_404 from f.models import Post def list(request): post = Post.objects.all() context = { 'post': post, } return render(request, 'list.html', context) def detail(request, id=None): Post = get_object_or_404(post, id=id) context = { 'Post': Post, } return render(request, 'detail.html', context) url.py urlpatterns = [ url(r'^$', views.list, name='list'), url(r'^(?P<id>[0-9]{1,3})$', views.list, name='detail'), ] and my error Django Version: 1.9.10 Exception Type: TypeError Exception Value: list() got an unexpected keyword argument 'id' Python Version: 3.5.2 -
Django select one row from related model set
Lets say, i have the following model configurations in models.py: class ModelA(models.Model): columnA = models.ForeignKey(ModelZ) created = models.DateTimeField(auto_now_add=True) class ModelB(models.Model): columnB = models.ForeignKey(ModelA, related_name='modelsets') is_open = models.BooleanField() created = models.DateTimeField(auto_now_add=True) I know i can select all the ModelA objects and all the related ModelB objects using prefetch_related operation. But in my use case, i wanted to select all the obejects from ModelA and only one(or some) related row from ModelB objects which satisfies certain conditions. For example: ModelA.objects.prefetch_related('modelB_set') where modelB__is_open = True something like that. The expected output is: [{ columnA : 1 created : 'time' modelsets :[{ columnB : 1 is_open = True created = 'time' },{ columnB : 2 is_open = True created = 'time' } },{ columnA : 2 created : 'time' modelsets :[{ columnB : 3 is_open = True created = 'time' } }] I'm tired of googling about this, any links for the better understanding of Django ORM querying would be much appreciable. Thanks! -
Django runserver giving AttributeError after installing django-debug-toolbar
I have virtual environment where I run my DJango projecct. I tried to install Django-debug-toolbar. But after installation, when I run the server, I am getting the following error. Unhandled exception in thread started by <function wrapper at 0x7f6cec222578> Traceback (most recent call last): File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run autoreload.raise_last_exception() File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception six.reraise(*_exception) File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django_nose/__init__.py", line 7, in <module> from django_nose.runner import * File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django_nose/runner.py", line 264, in <module> class BaseRunner(DiscoverRunner): File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django_nose/runner.py", line 266, in BaseRunner options = _get_options() File "/home/ubuntu/Envs/vhaptikenv/local/lib/python2.7/site-packages/django_nose/runner.py", line 142, in _get_options django_opts = [opt.dest for opt in BaseCommand.option_list] + ['version'] AttributeError: type object 'BaseCommand' has no attribute 'option_list' Now even after uninstalling that package, I am still getting that error. Any ways to fix this issue? -
django.db.utils.OperationalError: (1054, "Unknown column 'django_content_type.name' in 'field list'")
I updated the models in models.py, but the migrations tell me no changes detected. so i cleaned up all of the data in the table 'django_migrations'. and droped the model table. Then i migrated an empty migrations, it is no problems. But the terminal show '1054 error' when i migrate a new makemigrations. What the hell about the django migrations? class Platform(models.Model): name = models.CharField(max_length=60, blank=True, null=False) token = models.CharField(max_length=30, blank=True, null=False) hostname = models.CharField(max_length=20, blank=True, null=False) # stationmac = models.CharField(max_length=20, blank=True, null=False) # stationip = models.CharField(max_length=20, blank=True, null=False) class Meta: managed = True class Reservation(models.Model): user = models.ForeignKey(User) platform = models.ForeignKey(Platform) title = models.CharField(max_length=50, blank=True) starttime = models.DateTimeField(auto_now=False, blank=True, null=False) endtime = models.DateTimeField(auto_now=False, blank=True, null=False) createtime = models.DateTimeField(auto_now=True, blank=True, null=False) isstop = models.BooleanField(default=False, null=False) class Meta: managed = True @property def isexpire(self): return timezone.now() > self.endtime @property def isactive(self): return self.starttime <= timezone.now() <= self.endtime @property def status(self): if self.isstop: return "Stop" elif self.isactive: return "Progress" elif self.isactive is False and self.isexpire is False: return 'Waiting' else: return 'Finished' -
How do Django map urls to class based view functions?
In a class based view, HTTP methods map to class method names. Below, defined a handler for GET requests with the get method and url called get method. My question is how did the url map to the get method? url(r'^hello-world/$', TestView.as_view(), name='hello_world'), class MyView(View): def get(self, request, *args, **kwargs): return HttpResponse("Hello, World") -
Migrating from Elgg to custom developed application
I have a social networking platform, which has been built using Elgg. I am now thinking of migrating the application from Elgg to Ruby on Rails/Django. So for this purpose, I have to do the data migration also. I need some idea, about how should i proceed on this. Thanks, -
Can Dajngo F function bulk update random number?
I want to update field:number with 'current number + random number' : Here is my code, I have 650 games in database,and it need almost 8 seconds to update it objs = Game.objects.all() for obj in objs: Game.objects.filter(name=obj.name).update(number=F('number') + random.randint(1,100)) If I use F function, the the code below will have a problem : the random.randint(1,100) is the same for all rows , Can I random different number with F funciton? Or Is there some method I can speed up my query?? Game.objects.all().update(number=F('number') + random.randint(1,100)) -
Django import-export: importing dependent ForeignKey
I would like import Stock model via csv. I am using Django Import-Export 5.0.1. # model.py class Make(models.Model): name = models.CharField(max_length=30) class Model(models.Model): name = models.CharField(max_length=30) make = models.ForeignKey(Make) def __str__(self): return '{} {}'.format(self.make.name, self.name) # admin.py ForeignKeyWidget does not help because my in my csv file model name is written including make name like (str call) model = fields.Field(column_name='model', attribute='model', widget=ForeignKeyWidget(Model, 'name')) This code in resource does not work, because it will compare model name to csv model name which includes also make name. How to solve this issue. Appreciate any advice. -
webpack loader not working in production nginx django gunicorn
I'm using webpack to bundle my files and it works perfectly in development, but on production it doesn't. I just see {% load render_bundle from webpack_loader %} {% render_bundle 'main' 'js' %} on my site because for some reason they're treated as strings. When I look at the network tab, it doesn't load bundle.js even though it's in my application after I ran npm run build. -
Transforming a SQL query into Django QuerySet operations
Having the following two Django models: class A(models.Model): # Some fields here class B(models.Model): a = models.ForeignKey(A) status = models.PositiveSmallIntegerField() created_at = models.DateTimeField() And the following SQL query (targeting MySQL): Select A1.id, B1.id, B1.weight From A as A1 JOIN ( Select B2.id, B2.a_id, B2.status, CASE WHEN B2.`status` = 5 THEN 2 WHEN B2.`status` = 4 THEN 2 WHEN B2.`status` = 6 THEN 1 WHEN B2.`status` = 7 THEN 1 WHEN B2.`status` = 3 THEN 1 ELSE NULL END AS `weight` From B as B2 Group By B2.a_id, B2.id Order by B2.created_at DESC) as B1 On A1.id = B1.a_id Order by B1.status DESC What is the proper way to transform the SQL query into regular Django QuerySet operations using as little as possible of RawSQL? -
Can't connect to MySQL database when running "python manage.py runserver"
After entering the following: (djangoEnv) manwe:djangofriends scott$ python manage.py runserver I get the following traceback error: Performing system checks... Unhandled exception in thread started by Traceback (most recent call last): File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run self.check(display_num_errors=True) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/core/management/base.py", line 374, in check include_deployment_checks=include_deployment_checks, File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/core/management/base.py", line 361, in _run_checks return checks.run_checks(**kwargs) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 30, in check_all_models errors.extend(model.check(**kwargs)) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/models/base.py", line 1266, in check errors.extend(cls._check_fields(**kwargs)) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/models/base.py", line 1337, in _check_fields errors.extend(field.check(**kwargs)) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/models/fields/init.py", line 893, in check errors = super(AutoField, self).check(**kwargs) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/models/fields/init.py", line 208, in check errors.extend(self._check_backend_specific_checks(**kwargs)) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/models/fields/init.py", line 311, in _check_backend_specific_checks return connections[db].validation.check_field(self, **kwargs) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/backends/mysql/validation.py", line 41, in check_field field_type = field.db_type(connection) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/models/fields/init.py", line 629, in db_type return connection.data_types[self.get_internal_type()] % data File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/init.py", line 33, in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in get res = instance.dict[self.name] = self.func(instance) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 183, in data_types if self.features.supports_microsecond_precision: File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in get res = instance.dict[self.name] = self.func(instance) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/db/backends/mysql/features.py", line 54, in supports_microsecond_precision return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5) File "/Users/scott/projects/CodingDojo/PythonDjango/djangoEnv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in get res = … -
Django Rest Framework: Dynamic choices in Foreignkey Field
I have just started learning Django Rest Framework and trying to make a simple API using Django rest Framework. This is my models.py from __future__ import unicode_literals from django.db import models class Student(models.Model): created = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=150, blank=False) student_id = models.CharField(max_length=20, primary_key=True) father_name = models.CharField(max_length=150) mother_name = models.CharField(max_length=150) class Meta: ordering = ('student_id',) class Subject(models.Model): created = models.DateTimeField(auto_now_add=True) subject_id = models.CharField(max_length=20, primary_key=True) name = models.CharField(max_length=150) class Meta: ordering = ('subject_id',) class Result(models.Model): created = models.DateTimeField(auto_now_add=True) grade = models.DecimalField(max_digits=5, decimal_places=3, blank=False) student_id = models.ForeignKey(Student, on_delete=models.CASCADE) subject_id = models.ForeignKey(Subject, on_delete=models.CASCADE) class Meta: ordering = ('created',) And this is my serializers.py from rest_framework import serializers from models import * class StudentSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Student fields = ('student_id', 'name', 'father_name', 'mother_name') class SubjectSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Subject fields = ('subject_id', 'name') class ResultSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Result fields = ('grade', 'student_id', 'subject_id') In my "Result" model, I have two foreign keys; student_id and subject_id. This is how it looks like: My questions is, how can I show the "name" field in the drop down menu in stead of showing "Student Object" and "Subject Object"? I have tried with STUDENT_CHOICES = [(each.student_id, each.name) for each in Student.objects.all()] SUBJECT_CHOICES = … -
Instantiate object only once in django
I'm interested to use this lib to discovery working days based on a data file. In this lib, I instantiate a Calendar object to use the methods. Where is the recommended place to instantiate this? I don't want to instanciate every time I use, but if I need, I want to be able to reload that file and recreate the instance. -
Django using uuid as primary key, receive AttributeError during createsuperuser
I am surprised I didn't find any similar post regarding this error, especially when I consider my approach very intuitive. I am using uuid as the primary key for my CustomerUser model which is to override the default django user. I got an AttributeError when trying to run ./manage.py createsuperuser Here is my model. class CustomUser(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) user_type = models.CharField(max_length=1, choices=TYPE_USER, default='U') is_deleted = models.BooleanField(_('deleted'), default=False) Software version: django version 1.10.2 and python version 2.7.10 And this is the exception value = uuid.UUID(value) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/uuid.py", line 131, in __init__ hex = hex.replace('urn:', '').replace('uuid:', '') AttributeError: 'long' object has no attribute 'replace' Any advice on helping to resolve the issue is greatly appreciated. -
merge table with Django-mptt
I am using Django-mptt module for tree structure in my database. I could understand fundamental theory of MPTT thanks to this link. But I have struggle to make merge table with this MPTT model. for example, I have this tree structure thanks to Django-mptt module like below and then, I want to show this structure in table on template like below. Well, I thought of making array and show merge table on table with mptt left value and right vlaue somehow. But I couldn't figure out how to do that with mptt structure. I feel like there would be simple or easy way to build merge table with mptt module dynamically. Any Idea? I add one more image file for someone who wants to know data in a DB table. -
Log collector with Django
I am working on creating a website which allows students to submit course reviews and also search courses based on certain attributes. Am using AWS, Django, PostgreSQL, Elasticsearch. I am trying to figure out components to solve for the following 2 use cases: Use case 1 Search logging - Need to log every search coming in. Planning to use Celery(supports asynchronous logging) + logstash/fluentd + S3/webhdfs Use case 2 Update elasticsearch index with new course data from PostgreSQL backend. Planning to use logstash/fluentd + elasticsearch Which one of logstash / fluentd / any other data collector would work well with AWS + Django combination? Appreciate inputs from someone who has experience with a similar setup. -
NoReverseMatch where trying pass javascript varaible to url tag
My urls look like: url(r'^box_detail/', BoxJson.as_view(), name='box_details'), url( r'^box_detail/(?P<box_id>\d+)/', BOXJson.as_view(), name='box_details' ) and in js when i'm trying this: var id = 5; "{% url 'box_details' id %}" I get Reverse for 'box_details' with arguments '('',)' and keyword arguments '{}' not found. 2 pattern(s) tried: ['api/box_detail/(?P<box_id>\\d+)/', 'api/box_detail/'] I must use this: "{% url 'box_details' %}" + id but this looks not good, is there any option to do this? Django 1.10.3 -
POST not working Django Rest Framework
I find message return in google, not find. Whats my code not post values correct? I need help for solution correct. As use form based generic views? Im desenv an restAPI, i not understanding problem in my code, i running and return: I retrieve message, flow. views.py : from snippets.models import Equipamento, Colaborador from snippets.serializers import EquipamentoSerializer, ColaboradorSerializer from rest_framework import mixins from rest_framework import generics class EquipamentoList(generics.ListCreateAPIView): serializer_class = EquipamentoSerializer def get_queryset(self): queryset = Equipamento.objects.all() id = self.request.query_params.get('id', None) if id is not None: queryset = queryset.filter(id=id) return queryset # class ColaboradorList(generics.CreateAPIView): # queryset = Colaborador.objects.all() # serializer_class = ColaboradorSerializer # def get_queryset(self): # queryset = Colaborador.objects.all() # id = self.request.query_params.get('id', None) # if id is not None: # queryset = queryset.filter(pk=pk) # return queryset # def create(self, request, pk): # queryset = Colaborador.objects.all() # return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) # class ColaboradorDetail(generics.RetrieveUpdateDestroyAPIView): # queryset = Colaborador.objects.all() # serializer_class = ColaboradorSerializer class ColaboradorList(mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView): queryset = Colaborador.objects.all() serializer_class = ColaboradorSerializer def get(self, request, *args, **kwargs): return self.list(request, *args, **kwargs) def post(self, request, *args, **kwargs): return self.create(request, *args, **kwargs) class ColaboradorDetail(mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin, generics.GenericAPIView): queryset = Colaborador.objects.all() serializer_class = ColaboradorSerializer def get(self, request, *args, **kwargs): return self.retrieve(request, *args, **kwargs) def put(self, …