Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django, drop tables in migrations
In migrations I want to define a code to check if table exist drop it and then create a new table. I have this : from django.db import connection class Migration(migrations.Migration): if 'users' in connection.introspection.table_names(connection.cursor()): delete table I dont know what to do in "delete table" to drop table -
How To solve Postgres psycopg2 migrate manage.py error?
Recently started learning django .when i'm running python manage.py runserver(for checking manage.py) and python manage.py migrate command i'm getting this error,please suggest some solution.thanks in advance python manage.py migrate django.db.utils.OperationalError: FATAL: password authentication failed for user "Mohit" -
Combining more than one slug in the url
I'm trying to use two slug for generate the urls of a type of post. My site is divided in category and everyone of these have one or more post. views.py def singlePost(request, slug_post): blogpost = get_object_or_404(BlogPost, slug_post=slug_post) context = {"blogpost": blogpost} return render(request, "blog/single_post.html", context) def singleCategory_postList(request, slug_category): category = get_object_or_404(Category, slug_category=slug_category) blogpost = BlogPost.objects.filter(category=category) context = { "category": category, "blogpost": blogpost, } return render(request, "blog/single_category.html", context) urls.py that I use path("category/<slug:slug_category>/", views.singleCategory_postList, name="single_category"), path("<slug:slug_post>/", views.singlePost, name='single_blog_post'), urls.py that I would like to use path("<slug:slug_category>/", views.singleCategory_postList, name="single_category"), path("<slug:slug_category>/<slug:slug>/", views.singlePost, name='single_blog_post'), When I use the second couple of path it's shown to me this: NoReverseMatch at /blog/gis/ Reverse for 'single_blog_post' with keyword arguments '{'slug_post': 'rete-dei-sottoservizi-quadro-normativo'}' not found. 1 pattern(s) tried: ['blog\/(?P[-a-zA-Z0-9_]+)\/(?P[-a-zA-Z0-9_]+)\/$'] models.py class Category(models.Model): category_name = models.CharField( max_length=50, verbose_name="Categorie", help_text="Every category must be not longer then 50 characters", unique=True, ) slug_category = models.SlugField( verbose_name="Slug", unique=True, help_text="Slug is a field in autocomplete mode, but if you want you can modify its contents", ) .... def __str__(self): return self.category_name def get_absolute_url(self): return reverse("single_category", kwargs={"slug_category": self.slug_category}) class BlogPost(ModelPost, TimeManager): category = models.ForeignKey( Category, on_delete=models.CASCADE, related_name="category_set", verbose_name="Categorie", help_text="Select a category for this article.You can select only one category.", ) keyconcepts = models.ManyToManyField( KeyConcept, related_name="keyconcept_blog_set", … -
NS_ERROR_XPC_SECURITY_MANAGER_VETO Happening with Ajax and Django
I am really stuck with this. I get the error NS_ERROR_XPC_SECURITY_MANAGER_VETO when I have an Ajax call to my view in Django. The view takes the post data and returns the HTML as a string. Under the success part of the Ajax call, I get this error when trying to alert the data. The JS code looks as below: function viewConnections(routeids) { $.ajax({ type: "POST", url: "/planner/viewconnections/", data: { csrfmiddlewaretoken:'{{ csrf_token }}', routeids : routeids.toString() }, success: function(data) { alert(data); } }); return false; } -
Django - Populate model instance related field from cached query
Same situation as Django prefetch_related children of children but different question: I have a model Node that looks something like that: class Node(models.Model): parent = models.ForeignKey('self', related_name='children', on_delete=models.CASCADE) A Node can have several children, and each of these children can have its own children. I would like to do something like that: def cache_children(node): for child in node.children.all(): cache_children(child) root_node = Node.objects.prefetch_related('children').get(pk=my_node_id) all_nodes = Node.objects.all() # get all the nodes in a single query # Currently: hit database for every loop # Would like: to somehow use the already loaded data from all_nodes cache_children(root_node) As I already grabbed all the nodes in the all_nodes query, I would like to reuse the cached data from this query instead of performing a new one each time. Is there any way to achieve that? -
python manage.py createsuperuser showing IndexError: list index out of range
I am actually made a django project with build in database. But, now I am trying to use MySQL and I already installed it. But in creating super I faced these error... when I putting my username, email, password it shows these error -
Checking if a user is the author
It seems logic that any author of an article, can delete his own post. But I don't really know how to check if a user is the current author of a post. Here is my code : {% extends 'base.html' %} {% block title %} Details | {{article.title}} {% endblock title %} {% block content %} <div class="starter-template" style="text-align: center; margin: 2% 0"> <h1>{{object.title.capitalize}}</h1> <p>{{object.body}}</p> <p style="font-style: italic">{{object.author}}</p> <p>{{object.date}}</p> {% if object.author == user.username %} <p> <a href="{% url 'delete_post' object.pk %}">Delete</a> <a href="{% url 'edit_post' object.pk%}"> Edit</a> </p> {% endif %} </div> {% endblock content %} "object.author == user.username " is returning False. Why is that ? Thanks :) -
Issue with certbot ssl installation with django application
I am trying to install SSL certificate using certbot. I have an Django application running on Google Cloud Platform Compute Engine. I have followed this documentation on how to get ssl for django application but I get an error certbot: error: unrecognized arguments: --certbot-django-auth-key-directory ~/.ssh/certbot/ I have done everything this documentation says but still I do not know what i am doing wrong. Please help me. -
Getting a queryset using a foreign key field in the "other side" of a foreign key relation
Forgive me if the question does not make sense, trying to teach myself django. I've been trying to search how to do this but i'm not sure if i'm using the right words in my search. I have the following models. class Category(models.Model): code = models.CharField(max_length=10, unique=True) description = models.CharField(max_length=50) class UserGroupHeader(models.Model): code = models.CharField(max_length=10, unique=True) description = models.CharField(max_length=50) class UserGroupDetail(models.Model): usergroupheader = models.ForeignKey(UserGroupHeader, on_delete=models.CASCADE) category = models.ForeignKey(Category, on_delete=models.PROTECT) How do i get a query set from the Category model using the UserGroupHeader? so far what i've got is something like this UserGroupHeader.objects.get(pk=9).usergroupdetail_set.all(), now from the result of this how do i get the Category model? -
Django validate user request
Im only a student and currently studying django. I have this in my Users/models.py class Membership(models.Model): membership_type = models.CharField(max_length=50) price = models.IntegerField(default=100) description = models.CharField(max_length=200) def __str__(self): return self.membership_type class Customer(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) membership = models.ForeignKey(Membership, on_delete=models.CASCADE,null=True) reference = models.CharField(max_length=50, null=True) def __str__(self): return self.user.email how do I validate the user in my book_detail.html {% if user != Customer %} <button class="site-btn" disabled="disabled">Read</button> {% else %} {% for content in book.pages %} <a href="{{ content.get_absolute_url }}" class="site-btn">Read</a> {% endfor %} {% endif %} -
How to create few models with a single query depending on the selected items from the multiple select?
There are 2 models - "RelationType" and "RequestRelation". The second model is connected with the first through MTM field. There is a multiple select form based on a list of “relationship types”. Need to create several models of when "RequestRelation" submitting, depending on the selected items of the multi-select? F.e., if "husband / wife / son" is chosen, need to create 3 models accordingly. Distinctive in them are only the types of relationships. The form is valid, the correct values come. But so far, only one model is created, with lists of all selected relationship types. Also in my code there is a bug. The model is created immediately when the page is loaded, not when it is submitted. Thank you in advance. models.py class RelationType(models.Model): title = models.CharField(max_length=40) def __unicode__(self): return self.title class RelationRequest(models.Model): creator = models.ForeignKey(User, related_name='creator') relation = models.ForeignKey(User, related_name='relation') type_of_relation = models.ManyToManyField(RelationType, related_name='type_relation', verbose_name=_('type_relation')) status = models.BooleanField(_('status'), default=False) created = models.DateTimeField(_('created'), auto_now_add=True) updated = models.DateTimeField(_('updated'), auto_now=True) html <form action="" method="POST" multiple="multiple"> {% csrf_token %} {{ relation_form.type_of_relation }} <input type='submit' value='ok'> </form> forms.py class RelationRequestForm(forms.ModelForm): class Meta: model = RelationRequest fields = ('type_of_relation',) widgets = { 'type_of_relation': forms.SelectMultiple( attrs={ 'class': 'select2', 'style': 'width: 235px', } ), } … -
Unable retain select option value after submit in django
I'm trying to retain select option value after submit in django but unable to do. When I submit the button the select box disappeared. Any suggestions? forms.py class WardForm(forms.Form): ward_no = forms.ChoiceField(choices=[(x, x) for x in ['All', '1', '2', '3','4','5','6','7','8','9','10','11','12','13','14','15']]) Views.py def post(request, template_name='report.html'): if request.method == 'POST': form=WardForm(request.POST) return render(request, template_name, context, {'form': form}) reports.html {{ form.as_p}} -
Instance of 'OneToOneField' has no 'username' member
I got the following error when I created Profile model Instance of 'OneToOneField' has no 'username' member This is the snippet of the code I created from django.db import models from django.contrib.auth.models import User class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(default="default.jpg", upload_to="profile_pics") def __str__(self): return f"{self.user.username} Profile" previously it was working fine. Now, all of a sudden I am getting this error.I didn't understand the meaning of this error. How do I solve it? Thank you -
Getting error while playing uploaded audio file in Django
Here is the trace back of the error occurred [17/Mar/2019 11:15:26] "GET /media/songs/Three_Days_Grace_-_Break.mp3 HTTP/1.1" 200 4579328 Traceback (most recent call last): File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "C:\Python36\lib\wsgiref\handlers.py", line 279, in write self._write(data) File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write result = self.stdout.write(data) File "C:\Python36\lib\socketserver.py", line 800, in write self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine [17/Mar/2019 11:15:26] "GET /media/songs/Three_Days_Grace_-_Break.mp3 HTTP/1.1" 500 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 54509) Traceback (most recent call last): File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "C:\Python36\lib\wsgiref\handlers.py", line 279, in write self._write(data) File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write result = self.stdout.write(data) File "C:\Python36\lib\socketserver.py", line 800, in write self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python36\lib\wsgiref\handlers.py", line 141, in run self.handle_error() File "D:\Django Projects\Virtual Envs\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error super().handle_error() File "C:\Python36\lib\wsgiref\handlers.py", line 368, in handle_error self.finish_response() File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response self.write(data) File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write self.send_headers() File "C:\Python36\lib\wsgiref\handlers.py", … -
Unable to redirect Django form
I am trying to build a simple blog with a basic post function through a very simple form. The function I am trying to accomplish is: if the new post POSTs (no errors etc.) save to the database and redirect to the newly created post_details page. Otherwise I want it to re render the post form again. I keep getting the error NoReverseMatch at /post/pk and I cannot find my error. I am obviously not understanding something properly. The related code is below: views.py def post_new(request): if request.method == "POST": form = PostForm(request.POST) if form.is_valid(): post = form.save(commit=False) post.author = request.user post.published_date = timezone.now() post.save() return redirect('post_detail', pk=post.pk) else: form = PostForm() return render(request, 'blog/post_edit.html', {'form': form}) post_edit.html {% extends 'blog/base.html' %} {% block content %} <h2>New post</h2> <form method="POST" class="post-form">{% csrf_token %} {{ form.as_p }} <button type="submit" class="save btn btn-default">Save</button> </form> {% endblock %} urls.py from django.urls import path from . import views urlpatterns = [ path('', views.post_list, name='post_list'), path('post/<int:pk>/', views.post_detail, name='post_detail'), path('post/new/', views.post_new, name='post_new'), ] -
Nginx Base Auth
I work with Django and Nginx I added the following entry to my config to restrict access to example.com/admin/ location /admin/ { auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; } The function asks for a password, and everything works, but after that, as I get a 404 Not Found error from Nginx I do not understand what the problem is -
Reverse for 'post-detail' with keyword arguments '{'kwargs': {'slug': 'long-establis
I am trying to add comment fields to my post-detail view. But as soon i add redirect url after calling save(). This gives me error something like this. Reverse for 'post-detail' with keyword arguments '{'kwargs': {'slug': 'long-established-fact-that-a-reader-will'}}' not found. 1 pattern(s) tried: ['post/(?P[^/]+)/$'] this is my code posts/views.py @login_required def postDetail(request, slug): post = get_object_or_404(Post, slug=slug) latest_post = Post.objects.order_by('-timestamp')[0:4] form = CommentForm(request.POST or None) if request.method == 'POST': if form.is_valid(): form.instance.user = request.user form.instance.post = post form.save() return redirect('post-detail', kwargs = { 'slug': post.slug }) context ={ 'form': form, 'post': post, 'latest_post': latest_post } return render(request, 'posts/post_detail.html', context) posts/urls.py from django.urls import path, include from django.conf.urls.static import static from posts.views import index,postDetail, categoryDetail, blog, search urlpatterns = [ path('', index, name="home"), path('blog/', blog, name="blog"), path('search/', search, name='search'), path('post/<str:slug>/', postDetail, name='post-detail'), path('category/<slug>/', categoryDetail, name='category-detail'), ] -
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'webservice_again.CustomUser' that has not been installed
Complete Error: "AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'webservice_again.CustomUser' that has not been installed model.py from builtins import ValueError from datetime import date import django from django.contrib.auth.base_user import BaseUserManager from django.contrib.auth.models import AbstractBaseUser from django.db import models class CustomUserManager(BaseUserManager): def create_user(self, email, password= None, full_name="ABC",type = 0): if not email: raise ValueError("Email Required.") if not password: raise ValueError("Password Required.") user_obj =self.model( self.normalize_email(email) ) user_obj.set_password(password) user_obj.full_name = full_name user_obj.type = type user_obj.save(using = self._db) return user_obj class CustomUser(AbstractBaseUser): email =models.EmailField(unique=True, max_length=255) full_name = models.CharField(max_length=255, blank=False) dob = models.DateField(default=date.today) type = models.IntegerField(default=0) create_time = models.DateTimeField(auto_now_add=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['full_name'] objects = CustomUserManager() def get_full_name(self): return self.full_name def __str__(self): return self.full_name settings.py INSTALLED_APPS = [ 'webservice_again', 'web_service', 'rest_framework', 'rest_framework.authtoken', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] AUTH_USER_MODEL = "webservice_again.CustomUser" Guys, I know this question is duplicate, but after going through all the provided solutions, i am asking this solution. Any help is appreciated. -
How to correctly set up Django + MS SQL + Docker on a mac?
Why this particular combination? need to create a website that talks to a MS SQL database (and the db is created by proprietary software used by the company, so switching to another kind of database is not an option) I've been learning Django & Python for the past few months (via official documentation, online courses, personal projects), and since I'm starting to understand things, I don't think I should all of a sudden switch to .NET or Node.JS, just because the set-up is still a bit of a mystery I'm working on a macbook, so Docker is the only way to install MS SQL Server (as far as I know). I do have a decent PC a friend gave me though (just need to set it up), and if anyone thinks this will solve all my problems, I will go ahead and switch. What I've done/figured out so far (perhaps this would be helpful to someone going through the same process): there are plenty of guides and tutorials that explain how to use Django with Postgre, SQLite, etc. -- it all looks very straight-forward, so all I really need to get is the set-up I've got SQL Server up and … -
Django: how to create models that are computed from other models?
I have expense and income models. These two models should be the base for other model called balance. Where balance.income = sum(incomes) balance.expense = sum(expenses) balance.rest = sum(incomes) - sum(expenses) How to implement this balance model in Django? The expectation is, whenever income and expense models get new data from user, balance will compute automatically. Below is the implementation I have for those models, but the Balance model need to be revised (here just to give the idea about the structure). from django.db import models class User(models.Model): user_id = models.AutoField(primary_key=True) firstname = models.CharField(max_length=20) lastname = models.CharField(max_length=20) def __str__(self): return self.firstname class Balance(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) currency = models.CharField(max_length=3, default='$') income = models.IntegerField(default=0) expense = models.IntegerField(default=0) rest = models.IntegerField(default=0) saving = models.IntegerField(default=0) def __str__(self): return str(self.rest) class Expense(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) date = models.DateField() category = models.TextField(default='') detail = models.TextField(default='') place = models.TextField(default='') amount = models.FloatField(default=0.0) def __str__(self): return self.detail class Income(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) date = models.DateField() detail = models.TextField(default='') amount = models.FloatField(default=0.0) def __str__(self): return self.detail -
Django - How do i update object with current form?
So I’m building a My Account page on my project and I currently have a form on myaccount_edit.html that creates a new object on every submit. I need this form to update the object instead of creating new ones every time the current logged in user submits this form. How can I do that with my current code? Any help is gladly appreciated. Cheers user_profile/views.py from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponseNotFound from django.shortcuts import get_object_or_404 from django.shortcuts import render, redirect from django.conf import settings from .forms import HomeForm from users.forms import CustomUserCreationForm, CustomUserChangeForm from .models import User_Info from users.models import CustomUser def account_view_myaccount_edit(request): form = HomeForm(request.POST or None, request.FILES or None,) user_profile = User_Info.objects.all() user = request.user if request.method == "POST": if form.is_valid(): listing_instance = form.save(commit=False) listing_instance.user = user # user = request.user.pk listing_instance.save() return redirect("myaccount_edit") context = { 'form': form, 'user_profile': user_profile } return render(request, "myaccount_edit.html", context) user_profile/urls.py from django.conf.urls import url from django.urls import path, include from django.conf import settings from . import views from .views import account_view_myaccount, account_view_myaccount_edit urlpatterns = [ path('myaccount/', account_view_myaccount, name='myaccount'), path('myaccount_edit/', account_view_myaccount_edit, name='myaccount_edit'), ] user_profile/models.py from django.contrib import auth from django.db import models from django.urls import reverse from django.contrib.auth.models import … -
delting image from a child element is deleting it from the parent
I have 2 models Post and event Below is my post model class Post(models.Model): user = models.ForeignKey(User, related_name='posts') title = models.CharField(max_length=250, unique=True) slug = models.SlugField(allow_unicode=True, unique=True, max_length=450) message = models.TextField(max_length=3000) post_image = models.ImageField(upload_to='post_images/') and then I have a Events model class Event(models.Model): user = models.ForeignKey(User, related_name='cook') post = models.ForeignKey(Post, related_name='recipe') date = models.DateField() image = models.ImageField(blank=True, null=True) Now in below is the CreateView for my Event class CreateEvent(IsVerifiedMixin, CreateView): model = Event form_class = EventForm template_name = 'event/event_form.html' def form_valid(self, form, *args, **kwargs): self.object = form.save(commit=False) event = self.object user = self.request.user today = datetime.date.today() if today + datetime.timedelta(days=3) <= event.date <= today + datetime.timedelta(days=30): event.user = user slug = self.kwargs['slug'] post = get_object_or_404(Post, slug=slug) event.post = post event.image = post.post_image ###########THIS IS WHERE THE EVENT GETS ITS IMAGE event.save() else: form.add_error(field="date", error="The date has to be more than or equal to 3 days and less than 30 days") return super().form_invalid(form) def get_success_url(self, *args, **kwargs): slug = self.kwargs['slug'] obj = get_object_or_404(Post, slug=slug) url_ = obj.get_absolute_url() user = self.request.user if user.is_authenticated(): return url_ Now the problem is when I delete a event. It is deleting the post_image. Why is this happening. How Can I stop this from happening -
Django: ManyToMany through intermediate, using the __in operator
We have the following models (fields not concerning the relationships are omitted): class Subscription(BaseModel): profile = models.ForeignKey('accounts.UserProfile', on_delete=models.CASCADE, related_query_name='subscriptions') artist = models.ForeignKey('core.Artist', on_delete=models.CASCADE) class Artist(BaseModel): users = models.ManyToManyField('accounts.UserProfile', through="Subscription") class UserProfile(BaseModel): user = models.OneToOneField(User, related_name="user_profile", on_delete=models.CASCADE) Basically, I want to get all UserProfiles that have a subscription from a filtered lists of Subscriptions, but I can't get it to work: # this is a flitered queryset of Subscription objects subs = Subscription.objects.filter(artist__in=artists_for_rgs) # get me the profiles that have a subscription relationship with any of the items in 'subs' profiles = UserProfile.objects.filter(subscriptions__in=subs, notify=True).distinct() This query seems to work but I suspect it returns more UserProfile items than we really want. -
Does Bootstrap/Django Error message has no red color?
I wanted to play around with messages in my Django-application. Unfortunately every messagetype seems to work as expected except the error message is not red. My Code is very simple. views.py from django.contrib import messages def generate_test(request): messages.info(request, 'TEST') messages.success(request, 'TEST') messages.warning(request, 'TEST') messages.error(request, 'TEST') return render(request, 'test.html') test.html {% extends "base_generic3.html" %} {% load static %} {% block content %} {% endblock %} My base_generic3.html contains a lot of other content like jquery and bootstrap-4 integrations. But the below part is for displaying the message in bootstrap-4 style: ... {% if messages %} {% for message in messages %} <div class="alert alert-{{ message.tags }} alert-dismissible text-center" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span> </button> <strong>{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Error{% else %}{{ message.tags|title }}{% endif %}! </strong> {{ message }} </div> {% endfor %} {% endif %} ... -
drf - use serializers only for post() method
I am using Django Rest Framework. I have defined a serializer - ReceiptLog with no model, which should create entries in TestCaseCommandRun and TestCaseCommandRunResults when a post() request is made to receipt log. Receipt log doesn't exist in the database, I am using it just as an endpoint to accept a combined payload and create entries in underlying tables. I do not want a get() request for the ReceiptLog serializer. Below are the code snippets. Issues: How to ensure I have only post() working and get() returns an exception Is using serializers the best approach? or should I use viewsets? I have a browsable API which lists all the api's in urls.py. So when I click on receipt log api, it should not display any data, as get() is not allowed. How do I ensure this? models.py class TestCaseCommandRun(models.Model): # fields class Meta: managed = False db_table = 'test_case_command_run' unique_together = (('team_name', 'suite_name', 'suite_run_id', 'case_name', 'command_name'),) class TestCaseCommandRunResults(models.Model): # fields class Meta: managed = False db_table = 'test_case_command_run_results' unique_together = (('suite_run_id', 'command_run_id', 'rule_name', 'result_id'),) views.py class TestCaseCommandRunViewSet(viewsets.ModelViewSet): queryset = models.TestCaseCommandRunViewSet.objects.values(team_name','suite_name','suite_run_id', 'case_name','command_name','command_run_id','run_start','run_end','result','run_status') serializer_class = serializers.TestCaseCommandRunViewSet class TestCaseCommandRunResultsViewSet(viewsets.ModelViewSet): queryset = models.TestCaseCommandRunResultsViewSet.objects.values('suite_run_id','command_run_id','rule_name', 'result_id', 'result','expected_values','actual_values','report_values','extended_values') serializer_class = serializers.TestCaseCommandRunResultsViewSet class ReceiptLogViewSet(viewsets.ViewSet): serializer_class = serializers.ReceiptLog serializers.py …