Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Updating a Boolean Field in Django database
can i please get an help in what i'm doing wrong? i have a boolean field in which i want when a user clicks on it, it updates in the database, but i can't achieve my aim. my code is below for better understanding models.py class OrderItem(models.Model): designer_size = models.ForeignKey("Frame_Sizes_Designer", on_delete=models.CASCADE, blank=True) ***** class Frame_Sizes_Designer(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) small = models.BooleanField(default=False, blank=True) def __str__(self): return self.user.username views.py def DesignerFrameSizeSmall(request): dss = get_object_or_404(OrderItem, id=request.POST['id']) dss.designer_size.small = not dss.designer_size.small dss.save() messages.info(request, "Your prefered size has been stored... Thanks") return redirect('business:summary') app_name = 'business' urlpatterns =[ path('designer_frame_small_size/', DesignerFrameSizeSmall, name='dfss'), ] html and js <form action="" method="POST"> {% csrf_token %} <input type="checkbox" id="designer_small" value="{{dss.designer_size.small}}"> <label>Small</label> </form> $(document).ready(function(){ $('#designer_small').change(function(){ $.post("{% url 'business:dfss' %}",{ id: "{{items.id}}", designsmall: this.checked, csrfmiddlewaretoken: '{{csrf_token}}' }); }); the error message i get is internal server error when i check my console and i also get an error in my command prompt dss.designer_size.small = not dss.designer_size.small AttributeError: 'NoneType' object has no attribute 'small' }); -
Format django_filters form
I've been trying for the last few days to format a django_filters filter form. For this I make a class where I define the filters and then I make another child class where I try to format using FormHelper() and Layout() . That child class is the one I use in my view. But the filter form does not come out with the correct formatting. What am I doing wrong? Why my form is not coming with the correct format? I am also using crispy forms. filters.py class DeviceFilter(django_filters.FilterSet): device_group = django_filters.ModelChoiceFilter(label='', lookup_expr='exact', field_name='device_group__pk', queryset=None, empty_label=('Select Group')) device_type = django_filters.ModelChoiceFilter(label='', lookup_expr='exact', field_name='device_type__pk', queryset=None, empty_label=('Select Type')) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.filters['device_type'].queryset = DeviceType.objects.filter(owner=self.request.user) self.filters['device_group'].queryset = DeviceGroup.objects.filter(owner=self.request.user) class Meta: model = Device fields = {} # HERE I TRY TO GIVE THE FORMAT. BUT IT IS NOT WORKING class CustomFilterForm(DeviceFilter): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Row( Column('device_type', css_class='form-group col-6 mb-0'), Column('device_group', css_class='form-group col-6 mb-0'), css_class='form-row' ), ) views.py class DeviceListView(OwnedMixin, SingleTableMixin, FilterView): model = Device template_name = 'devices/list.html' table_class = DeviceTable filterset_class = CustomFilterForm paginator_class = LazyPaginator def post(self, request, *args, **kwargs): queryset = request.POST for i in queryset['list'].split(","): if queryset['action'] == 'delete': … -
Test and Verify AWS Redis Integration with Django project
I am new to Django. I was trying to implement Redis cache system into my Django project. I am using AWS free tier to host my Django project on EC2 machine using gunicorn web server and trying to integrate AWS Redis Cache. I have added below entry in my settings.py file: CACHE = { 'default': { 'BACKEND' : "redis_cache.cache.RedisCache", 'LOCATION' : "redis://xxx.xxx.xxxxx.cache.amazonaws.com/1", 'OPTIONS' : { 'CLIENT_CLASS' : 'redis_cache.client.DefaultClient', }, } } And below is my view function: def usertable(request): obj = userdetails.objects.get(id=1) name = obj.name if cache.get(name): cache_name = cache.get(name) print ("From CACHE") else: cache_name = obj.name cache.set(name, cache_name) print ("*****************FROM DB********************") context = { 'name' : cache_name, } This code is working for me and I can see From CACHE printed in my terminal. But the key value pair which is set if I manually connect to redis using below cli tool: redis-cli -h xx.xx.xxxxx…cache.amazonaws.com -p 6379 -n 1 on giving keys * I do not see any key value pair is set. I am not sure if this is the correct way to test integration of Redis cache. Kindly advice if anyone had tried Redis Cache system. -
How to pass a variable inside a fetch() for static files in Django?
I'm developing an app that displays Highcharts charts in Django and the graph is typically created by reading the content of a JSON file stored in my static files like so: fetch("{% static 'myfile.json' %}") .then(......) Now I've got a dropdown list from which the user can select the json file name and I'd like to pass it to the fetch() function, but I can't figure out how to make it work. For instance: var resultStr = "{% static 'myfile_with_id_XX.json' %}"; fetch(resultStr) .then(.....) this returns a GET 404 error instead of fetching the appropriate json file. How should I format resultStr so that it can be passed in fetch()? And how should I write the fetch() function ? Many thanks for your help! -
Celery - Django Schedule task from inside a scheduled task
I have a Task (let's call it MainTask) that is scheduled using apply_async method, this task has some validations that can trigger another task (SecondaryTask) to be scheduled with an eta. Every time the MainTask tries to schedule the SecondaryTask using apply_async method, the SecondaryTask runs inmediatly, overriding the eta parameter. How can I schedule a different task from a "Main Task" and to be executed later, using eta? Here is an example of the code: views.py def function(): main_task.apply_async(eta=some_day) tasks.py @app.task(bind=True, name="main_task", autoretry_for=(Exception,), default_retry_delay=10, max_retries=3, queue='mail') def main_task(self): ... if something: ... another_task.apply_async(eta=tomorrow) @app.task(bind=True, name="another_task", autoretry_for=(Exception,), default_retry_delay=10, max_retries=3, queue='mail') def another_task(self): do_something() -
DRF: Simple Switch for a choice field in model via router
I want to build an APIView that can turn on power in a store so to say ... Can I do it using a router? model: class Store(models.Model): C = [(0,0), (1,1), (2,2), (3,3)] name = models.IntegerField("name", max_length=60) power_state = models.PositiveIntegerField("current state", default=0, choices=C) user = models.ForeignKey(User, on_delete=models.CASCADE) view: class OnOff(APIView): def patch(self, request): store = Store.objects.get(pk = request.user.id) return Response("switched") I am new to DRF and I do not know if I need a serializer here. The interface I see looks like this: while I was hoping for a simple dropdown between 0 and ... 3 in this case. Also how would the router have to be registered? Right now I put a path in the urls.py: path('test/', views.OnOff.as_view(), name = "on-off"), which means it will not be listed under 127.0.0.1:8000/api/ which would be nice. I tried using (but 404): router = routers.DefaultRouter() ... router.register(r'onoff', views.OnOff, basename = "onoff") urlpatterns = [ path("", views.StoreView.as_view(), name = 'index'), url('^api/', include(router.urls)), ... ] -
Django VSCode: How to make django-html format as expectedl?
I've seen a ton of unanswered questions about VSCode formatting (and if not here, where do you ask these questions?). There are 2 main issues I run into constantly when I'm trying to write django-html templates. 1. Basic HTML tag linebreak doesn't occur in django-html files. When you write an html tag, and press enter inside of it, it should split the tag with an empty line in the middle like. Expected behavior (pipe "|" represents the cursor): <!-- Write the tag --> <div>|</div> <!-- Press enter --> <tag> | </tag> Here's what's happening in the django-html file after enter: <!-- Press enter --> <tag> |</tag> How do you fix this WITH proper template tag formatting (below)? 2. Django template tags don't indent as expected. Tags within if, with, block, etc. tags should be indented. (treated like html) Expected result: <!DOCTYPE html> <html> <head> </head> <body> {% if x %} <p>I did x</p> {% else %} <p> I did else</p> {% endif %} <nav class="navbar"> </nav> {% block content %} <div class="content"> <p>I'm in contente</p> </div> {% endblock %} </body> </html> Instead, the html tags within the django template tags are flattened on the same indent level. Actual result: <!DOCTYPE … -
Django JavaScript template block
I'm learning Django and JS and jQuery all at the same time for a project I'm working on, and I'm having trouble with running JavaScript in a Django template block OTHER THAN {% block content %}. I've seen several tutorials use a {% block javascript %} template block for JavaScript, but I can only get my JavaScript to run if I include it in the {% block content %} block of the html file. If I include it in a like I've seen in the tutorials, it doesn't work (and neither do other functionalities, like html tags). Here's my base template: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>{% block title %}{% endblock title %}</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> {% block style %} {% endblock style %} </head> <body> {% block content %} {% endblock content %} {% block javascript %} {% endblock javascript %} </body> </html> This works: {% extends 'base.html' %} {% block content %} {% load static %} <div class="container-fluid"> <form id="med_input_form"> <div class="form-group" > {% csrf_token %} <label for="{{form.input_meds.id_for_label}}">{{form.input_meds.label}}</label> {{form.input_meds}} </div> <button type="submit" class="btn btn-primary">Reconcile Meds</button> </form> </div> <div class="container-fluid"> <ul id="med_output"> </ul> … -
How optimize complex query django
I use Django 2.1. I'm trying to optimize a query that is being accused of causing slowness in the database, I tried to add as select and prefetch related but it didn't have the desired effect. My final objective emp is a tuple of ids like: ((90512,), (90523,), (125792,)....., (127012,)) creator and hiring_manager is a Fk relationship followers and conductor a M2m relationship This is django query job_ids = list(Job.objects.select_related('creator', 'hiring_manager').prefetch_related('conductors', 'followers').filter(Q(creator__in=emp) & (Q(hiring_manager=user) | Q(followers=user) | Q(conductors=user))).values_list('pk', flat=True)) -
TypeError: 'module' object is not callable Django 3 render function
I am just making a simple hello world page in my Django 3 Application I am getting error TypeError: 'module' object is not callable Here is image of the entire error It was working before but suddenly not working now. Here is my views.py from django.shortcuts import render # from django.http import HttpResponse # from django.template import RequestContext, loader # from django.template import Context def index(request): """Placeholder index view""" print('XXXX') return render(request, 'hello_world/index.html') #return HttpResponse('Hello, World!') def test(request): context = {'foo': 'bar'} return render(request, 'hello_world/index.html', context) The error is in line return render(request, 'hello_world/index.html') but when I change it to return HttpResponse('Hello, World!') it works fine. My html file is very simple index.html <h3> MY DJANGO APP</h3> The html file is also in the correct folder templates/hello_world/index.html -
Login (django project)
I'm having problems with django's user accounts/login I can't go to link 'http://127.0.0.1:8000/authenticate/login/' and this is my errors: TemplateDoesNotExist at /authenticate/login/ This is the main URL file of the project: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('article.urls')), path('authenticate/', include('django.contrib.auth.urls')) ] and this is my app's url: from django.urls import path from . import views urlpatterns = [ path('Matin/', views.matin, name='Matin'), path('register/', views.register, name='register'), ] -
How can i save custom fields in registration from to my database? (Django)
I'm trying to create a school related website with django. So i created a custom user model looks like this (Sorry for the foreign field names): class ogrenciler(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) ogr_adi = models.CharField(max_length=30) ogr_soyadi = models.CharField(max_length=30) sinifi = models.ForeignKey(siniflar, null=True, on_delete=models.CASCADE) numara = models.CharField(max_length=5) foto = models.ImageField(default='default.jpg', upload_to='profile_pics') def __str__(self): return self.ogr_adi + " " + self.ogr_soyadi + "ogrencisi" and this is my custom registiration form: class ogrenciKayit(UserCreationForm): email = forms.EmailField() numara = forms.CharField(max_length=5, required=True) class Meta: model = User fields = ['username', 'email', 'numara', 'password1', 'password2'] def save(self, commit=True): user = super(ogrenciKayit, self).save(commit=False) user.numara = self.cleaned_data['numara'] if commit: user.save() return user I created a signal.py file to whenever a user created also create a "ogrenci"(student). This is my signals.py file: @receiver(post_save, sender=User) def create_ogrenci(sender, instance, created, **kwargs): if created: ogrenciler.objects.create(user=instance) @receiver(post_save, sender=User) def save_ogrenci(sender, instance, **kwargs): instance.ogrenciler.save() Everything works fine but the "numara" field doesn't get saved. This is my views.py file if you wanna check it: def ogrenciregister(request): if request.method == 'POST': form = ogrenciKayit(request.POST) if form.is_valid(): form.save() username= form.cleaned_data.get('username') messages.success(request, f'Hesap {username} adına oluşturuldu.') return redirect('giris') else: form = ogrenciKayit() return render(request, 'kullanicilar/ogrencikayit.html', {'form': form}) -
Problems with Postgrestql and Django in Manjaro linux, after update
I'm making a blog app in Django, and I'm using Postgres as database, since I read it is the best database for django. I am developing in Manjaro linux, a rolling release distribution, and I recently updated my system, after the update I got an error with the database. postgres does not know where to find the server configuration file. You must specify the --config- file or -D invocation option or set the PGDATA environment variable. So after search for a solution I decided to reinstall Postgres, and after reinstall it, more problems happened. Now that I want to start Postgres i get the following error: postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2021-01-14 13:19:00 -05; 6s ago Process: 55976 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE) ene 14 13:19:00 daniel-arch systemd[1]: Starting PostgreSQL database server... ene 14 13:19:00 daniel-arch postgres[55976]: "/var/lib/postgres/data" is missing or empty. Use a command like ene 14 13:19:00 daniel-arch postgres[55976]: su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'" ene 14 13:19:00 daniel-arch postgres[55976]: with relevant options, to initialize the database cluster. ene 14 13:19:00 daniel-arch systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE ene 14 13:19:00 daniel-arch … -
Django PasswordChangeForm change message(or customize, translate)
Change password error message shows only in english how to change it or translate it? /form/ class PasswordChangingForm(PasswordChangeForm): old_password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control', 'type':'password'})) new_password1 = forms.CharField(max_length=100, widget=forms.PasswordInput(attrs={'class': 'form-control', 'type':'password'})) new_password2 = forms.CharField(max_length=100, widget=forms.PasswordInput(attrs={'class': 'form-control', 'type':'password'})) class Meta: model = CustomUser fields = ('old_password','new_password1', 'new_password2') /views.py/ class PasswordChangeView(PasswordChangeView): form_class = PasswordChangingForm success_message = 'Everything is fine' success_url = reverse_lazy('settings_success') /template/ <form method="POST"> {% csrf_token %} {% include '../extends/_messages.html' %} <div class="form-group row"> <label for="st_pass1" class="col-sm-4 col-form-label">Нууц үг</label> <div class="col-sm-8"> {{ form.old_password }} </div> </div> <div class="form-group row"> <label for="st_pass2" class="col-sm-4 col-form-label">Шинэ нууц үг</label> <div class="col-sm-8"> {{ form.new_password1 }} </div> </div> <div class="form-group row"> <label for="st_pass3" class="col-sm-4 col-form-label">Шинэ нууц үг давтах</label> <div class="col-sm-8"> {{ form.new_password2 }} </div> </div> {{ form.errors}} <div class="text-center form-group pt-5" style="width: 100%;"> <button type="submit" class="btn btn-primary cs-btn">Хадгалах</button> </div> </form> (my first question in Stackoverflow. Please let me know if question unclear) -
How can I split a long django-modelform into accordion?
I have a single model that consist of 80+ fields, and a ModelForm made on it. So, to make it readable for user, I decided to wrap it into accordion (jquery) with 4 sections. The problem I ran into is that I don't know how to split my Form as it seems very dull to write each field manually like {{form.field}}. I wonder if its possible to make it in some kind of cycle or using some tags or whatever. Now it looks like: <div id="accordion"> <h3>Section 1</h3> <div> <p>{{form.field1}}</p> </div> <h3>Section 2</h3> <div> <p>{{form.field2}}</p> <p>{{form.field3}}</p> </div> <h3>Section 3</h3> <div> <p>{{form.field4}}</p> <p>{{form.field5}}</p> </div> </div> I really don't think it's necessary to write all 80+ field like that, but I can't come up with the idea how to deal it. Thank you for any idea! -
NameError: name 'contact_value' is not defined in serializers.py [closed]
I followed a tutorial on the Django REST framework, and I'm now trying to apply what I've learnt to my database. The last part of the stacktrace is: ... File "C:\Python\Python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 790, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "C:\Users\jmr\projects\python\django-ref-impl\django_ref_impl\parties\urls.py", line 30, in <module> from . import views File "C:\Users\jmr\projects\python\django-ref-impl\django_ref_impl\parties\views.py", line 49, in <module> from .serializers import ( File "C:\Users\jmr\projects\python\django-ref-impl\django_ref_impl\parties\serializers.py", line 52, in <module> class ContactMethodSerializer(serializers.ModelSerializer): File "C:\Users\jmr\projects\python\django-ref-impl\django_ref_impl\parties\serializers.py", line 54, in ContactMethodSerializer class Meta: File "C:\Users\jmr\projects\python\django-ref-impl\django_ref_impl\parties\serializers.py", line 59, in Meta contact_value, NameError: name 'contact_value' is not defined The start of my serializer.py is: from rest_framework import serializers from .models import ( ContactMethod, ContactMethodType, CountryType, GenderType, Organisation, OrganisationType, Party, PartyContact, PartyContactType, PartyIdentifierType, PartyRelationship, PartyType, Person, RoleType, RoleTypeRelationship, ) # # TABLE: CONTACT_METHOD (COME) # class ContactMethodSerializer(serializers.ModelSerializer): class Meta: # the model for Serializer model = ContactMethod # field names for serialization fields = ( contact_value, effective_period_from, effective_period_to, extension_number, notes, id, contact_method_type_id, created_at, created_by, updated_at, updated_by, ) ... The … -
Is it possible to have a model reference many other models depending on the situation in django?
I honestly don't know how to even phrase my question but i think an example might help. I have mad three apps with their own models respectfully. App1, App2, App3. I want to create a new app (Reports) which will report on each of my other apps (App1,App2,App3). With my current knowledge i have the following in my Reports models.py class Reports(models.Model): name = models.CharField(max_length=150, blank=True) app1_reported = models.ForeignKey( App1, on_delete=models.CASCADE, related_name='reported_app1', blank=True) app2_reported = models.ForeignKey( App2, on_delete=models.CASCADE, related_name='reported_app2', blank=True) app3_reported = models.ForeignKey( App3, on_delete=models.CASCADE, related_name='reported_app3', blank=True) is there any way for me to create in my Reports model one reference that could reference either App1, or App2, or App3? something like: class Reports(models.Model): name = models.CharField(max_length=150, blank=True) reported = models.ForeignKey( App1 or App2 or App3, on_delete=models.CASCADE, related_name='reported_app_is', blank=True) My app works fine with the first implementation I would just like to know if there is a better way. Also please let me know if this makes sense, im struggling with the right wording. -
Login required when submitting a form inside a detail view
Is there a way to add login required when submitting a form inside a detail view? I know LoginRequiredMixin, but I want anonymous user to view the details of the post, but require them to login when adding a comment. Is there a way to do that? Thanks! views.py: class PostView(DetailView, FormMixin): model = Post form_class= CommentForm def get_success_url(self): return reverse_lazy('post-detail', kwargs={'pk': self.object.pk}) def get_post_data(self, *args, **kwargs): post_menu = Post.object.all() context = super(PostDetailView, self).get_context_data context["form"] = CommentForm() return context def post(self, request, *args, **kwargs): self.object = self.get_object() comment_form = self.get_form() if comment_form.is_valid(): return self.form_valid(comment_form) else: return self.form_invalid(comment_form) def form_valid(self, comment_form): comment_form.instance.post = self.object comment_form.instance.user = self.request.user comment_form.save() return super().form_valid(comment_form) -
How to build a private chat (one to one chat) app with Django rest framework, Django channels and React
I want to build a one to one chat application using Django channels. I've already built a public chat app using Django channels, Django rest framework and React (frontend), and now, I want to build a private chat app. Thank you for your help. -
Django - How to change the location of admin static files?
I recently discovered that it's quite easy to check if a site is running on Django as its not possible to change the location of DJANGO Admin styles located at /static/admin/css/base.css The only thing I can change at the path shown above is /static as I set : STATIC_URL = '/static/' at settings.py Is there any way that I can change the path behind /static ? Would be great If I could hide the framework that Im using for my website. Thanks in advance -
rest_framework_jwt | Return custom error message in case of token verification failure
I am using rest_framework_jwt in order to implement token based authentication within my API project based on Django Rest Framework and Python programming language. The issue I am facing right now is that I am getting a random error in response in case an expired token is passed in the header with an API request. I am wandering how I can override that error throwing function and return my own custom response from there. I am getting currently in response is : {"detail": "Signature has expired."} I went through the rest_framework_jwt documentation and found the codes responsible behind throwing that failure response. I tried to change the response object from there but it didn't work and I ran into some other random error. I tried then creating a middleware and there I succeed in returning custom response in case of token verification failure. But now I am unable to login to the system. Codes for the middleware I created are: import jwt from django.utils.encoding import smart_text from django.utils.translation import ugettext as _ from django.http import JsonResponse from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication from rest_framework_jwt.settings import api_settings from rest_framework import exceptions from rest_framework.authentication import ( get_authorization_header ) jwt_decode_handler = api_settings.JWT_DECODE_HANDLER jwt_get_username_from_payload = api_settings.JWT_PAYLOAD_GET_USERNAME_HANDLER … -
Can You do this kind of website with django
I currently learning django . What I want to know is that can I make a website like https://themoviesflix.co/ with django and how much knowledge in django I need to make it. -
Adding Collaborator functionality to my Keep notes app
I am trying to do a clone of Google's Keep Notes app using Django rest framework .I am done with half of the work. But I cant figure out how can I implement that adding collaborator functionality. Any helps ? -
Deserialize Django model with marshmallow
I have 2 models in my Django project: class Item(models.Model): title = models.CharField(max_length=64) description = models.CharField(max_length=1024) price = models.PositiveIntegerField() class Review(models.Model): grade = models.PositiveSmallIntegerField() text = models.CharField(max_length=1024) item = models.ForeignKey('Item', on_delete=models.CASCADE, related_name='reviews') I want to be able to deserialize Item model with nested reviews in it (which is a queryset of reviews) I described marshmallow schemas in a following way: class ReviewSchemaID(Schema): id = fields.Int() grade = fields.Int() text = fields.Str() class ItemReviewsSchema(Schema): id = fields.Int() title = fields.Str() description = fields.Str() price = fields.Int() reviews = fields.List(fields.Nested(ReviewSchemaID())) But when try to deserialize django object to JSON: item = get_object_or_404(Item, id=item_id) item_data = ItemReviewsSchema().dump(item) I get the following error: TypeError: __call__() missing 1 required keyword-only argument: 'manager' How can I fix the error? -
Where can I find the documentation of Django-filter
There is Django little framework called Django-filter, it is used for filtering looping elements in HTML template. If you are a Django-filter master please help me. The documentation is very short and I couldn't find many things by googling. I want to know how can I set price (increasing and decreasing order), title (A-Z, Z-A). Thank you for your help.