Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
social-auth-app-django facebook backend state with redirect_uri
I know my question sounds like a duplicate, but I've looked everywhere without finding any solution. I am working on implementing social logins for my django webapp. So far google, twitter and yahoo logins have worked as expected. But facebook always gives the error below: URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs. After some digging I got to learn how to setup my facebook login properly: Facebook app settings below App Domains set to domain.ext Site URL set to https://www.domain.ext/ Valid OAuth Redirect URIs set to https://domain.ext/social/complete/facebook/ I also looked at the redirect url (shown below) and found that it contains a state variable, state=kMQH3TdKSdF8oYGGx7Xri4KgFaEQ9OyU. Full url below https://www.facebook.com/v2.9/dialog/oauth?client_id=977674249054153&redirect_uri=https%3A%2F%2Fwww.domain.ext%2Fsocial%2Fcomplete%2Ffacebook%2F&state=kMQH3TdKSdF8oYGGx7Xri4KgFaEQ9OyU&return_scopes=true&scope=email%2Cpublic_profile My facebook login url on my django app is {% url 'social:begin' 'facebook' %} and I have this 'social_core.backends.facebook.FacebookOAuth2' in AUTHENTICATION_BACKENDS I searched and found there's such issue already on the social-core github page which has been resolved. It says that from v1.7.0, this line REDIRECT_STATE = False has been added to the facebook backend. I dug into … -
django foreignkey in HyperlinkedModelSerializer what type of value
Using django 2.0.2 python3.4 models.py class Userinfo(models.Model): useruid = models.BigAutoField(db_column='UserUID', primary_key=True) username = models.TextField(db_column='Content') registerdate = models.DateTimeField(db_column='RegisterDate') class Meta: managed = False db_table = 'userinfo' class Postinfo(models.Model): postuid = models.BigAutoField(db_column='PostUID', primary_key=True) useruid = models.ForeignKey( Userinfo, db_column='UserUID', on_delete=models.CASCADE) content = models.TextField(db_column='Content') registerdate = models.DateTimeField(db_column='RegisterDate') class Meta: managed = False db_table = 'postinfo' serializer.py class req_AddPostSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = models.Postinfo fields = ('useruid', 'content') views.py class AddPost(viewsets.ModelViewSet): queryset = '' serializer_class = req_AddPostSerializer def create(self, request, *args, **kwargs): serializer = req_AddPostSerializer( data=request.data) if not serializer.is_valid(): return Response(serilizer.errors) serializer.save() return Response("succes") request.data { "useruid": "1", "content": "test" } errors invalid hyperlink - no url match or Incorrect type. Expected URL string, received str url.py router = routers.DefaultRouter(trailing_slash=False) router.register(r'AddPost', views.AddPost, base_name="AddPost") urlpatterns = [ url(r'^', include(router.urls)), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] i want Postinfo.useruid = Userinfo.useruid but i don't know this error how to this if change useruid to IntegerField it's worked but this is out of not foreignkey -
Where to go next? [on hold]
Good day to all. This question has already been raised, probably thousands of times, I would like to know the opinion of experienced developers where to go further in the field of web development for the developer of the full stack. At the moment I know the base of the python, OOP, a little Django and flask, on the front - js, extjs. Where can I go further, maybe some frameworks, linux bash, tcp/ip, how to move even to the level of the middle. -
How does django generate unique user token
I'm a bit confused about token authentication. After a few question and attempts I've manage to create url gateway for auto-login my users but I'm managing to do that only by using user_id and passing it out in the url for example http://example.com/auth/login/?user_id=12 but I would rather do it with ?token=. I'm using DRF example on how make custom auth token and return some more data about my user with that so after I curl to the url I'm returning {"token":"d5d86e55fd5ddd48298b2ac72c3ed96b7e30dd86","user_id":52} Now the problem that I'm facing is this MyUser maching query does not exists which is normal I didn't have token in my model so I've created one token = models.CharField(max_length=125, null=True, blank=True) so I could overcome DoesNotExist error but the error is still there. I'm using this hack for the gateway login from django.contrib.auth import authenticate, login from django.core.urlresolvers import reverse from django.views.generic import View from django.http import HttpResponseRedirect from business_accounts.models.my_user import MyUser class UrlGatewayLogin(View): def get(self, request, **kwargs): page_group = kwargs.get('page_group') token = request.GET.get('token') user = MyUser.objects.get(token=token) user.backend = 'django.contrib.auth.backends.ModelBackend' login(request, user) return HttpResponseRedirect(reverse('dashboard', args=(page_group, ))) Is DRF token unique per user, and how can I generate token in django and use it for my gateway? -
django make a button that takes you a random next page
So I'm trying to make a quiz app with Django. So far I've got a SQL database that can autopopulate a template given a question id. If I go to http://localhost:8000/polls/2/ it'll give me the second quiz question. I'm trying to make a button that'll take me to a random quiz question when clicked on. Inside myproject/polls/view.py I have the following method: # myproject/polls/view.py def get_question_page(request, question_id): try: question = Question.objects.get(id=question_id) except Exception as e: question = None context = {'question': question} return render(request, 'index.html', context) def get_random_page(request): n = Question.objects.count() rand = random.randint(1, n) return get_question_page(request, rand) I've attempted using the following code inside myproject/polls/index.html: <!-- myproject/polls/index.html --> <form action="{% url 'views.get_random_page' %}" method="POST"> <input id="submit"a type="button" value="Click" /> </form> But I only end up with: NoReverseMatch at /polls/2/ Reverse for 'views.get_random_page' not found. 'views.get_random_page' is not a valid view function or pattern name.` Can someone explain what's going wrong and how to fix this? -
create associted data with ModelSerializer in Django REST Framework
I'm using Django 2.0 and Django REST Framework to write REST API. My contacts/models.py contains class Contact(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100, blank=True, null=True) date_of_birth = models.DateField(blank=True, null=True) avatar = models.ImageField(upload_to='contact/%Y/%m/%d', blank=True) class Meta: db_table = 'contacts' class ContactPhoneNumber(models.Model): contact = models.ForeignKey(Contact, on_delete=models.CASCADE) phone = models.CharField(max_length=100) class Meta: db_table = 'contact_phone_numbers' and contacts/serializers.py class ContactPhoneNumberSerializer(serializers.ModelSerializer): class Meta: model = ContactPhoneNumber fields = ('id', 'phone', 'primary', 'created', 'modified') class ContactSerializer(serializers.HyperlinkedModelSerializer): phone_numbers = ContactPhoneNumberSerializer(source='contactphonenumber_set', many=True) url = serializers.HyperlinkedRelatedField( view_name='contacts:detail', read_only=True ) class Meta: model = Contact fields = ('url', 'id', 'first_name', 'last_name', 'date_of_birth', 'avatar', 'phone_numbers') def create(self, validated_data): print(validated_data) instance = Contact.objects.create(**validated_data) instance.save() return instance I want to be able to create contact along with phone_number and one contact can have many phone_numbers. But when I send POST request with only contact data, it gives error as 'contactphonenumber_set' is an invalid keyword argument for this function on calling contacts only is showing all associted mobile numbers in json response but unable to create record. print(validated_data) gives following data {'first_name': 'Anshuman', 'last_name': 'Upadhyay', 'date_of_birth': datetime.date(2018, 5, 15), 'contactphonenumber_set': [], 'user_id': <SimpleLazyObject: <User: anuj>>} How can I create related multiple fields with REST Framework? -
Django list of timestamps from DateTimeFields in output of group-by
I have a model that looks like the following (some irrelevant fields have been omitted): class Note(models.Model): enterprise_id = models.IntegerField(db_index=True) field_id = models.IntegerField() activity = models.TextField(choices=ACTIVITY_CHOICES) user_date = models.DateTimeField() I would like to (in SQL terms) group by the combination of (enterprise_id, field_id, activity, year of user_date) and then for each group, list the user_dates from Notes that went into it. The following queryset works, but the array_agg list ends up being a string such as [datetime.datetime(2017,1,1,0,0,0),...] or similar, which is not very easily parsable. Is there a way that I can ArrayAgg the unix timestamp from the user_date field, rather than the datetime object itself? Or failing that, ArrayAgg the tuple of (year, month, day) so it can be parsed? qs = self.get_queryset()\ .annotate(year=ExtractYear('user_date'))\ .values('activity', 'enterprise_id', 'field_id', 'year')\ .order_by('activity', 'enterprise_id', 'field_id', 'year') \ .annotate(dates=ArrayAgg('user_date')) -
module 'http.client' has no attribute 'HTTPSConnection'
I'm getting the following error when I attempt to upload an image to my web page. I haven't had any issues until now. A few days ago, I think that I did have to do some reinstalls related to pip/python due to the fact that I think I corrupted something, but I thought that I had everything working. Any ideas what could be wrong? I did reinstall pip3.6, but this issue seems to persist. Environment: Request Method: POST Request URL: https://beanzoid.com/accounts/profile/websitesetup11/ Django Version: 2.0.1 Python Version: 3.6.5 Installed Applications: ['django.contrib.sites', 'django.contrib.admin', 'registration', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'accounts', 'versatileimagefield', 'products', 'orders', 'carts', 'access', 'storages'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', '] Traceback: File "/home/jasonhoward/lib/python3.6/django/core/handlers/exception.py" in inner 35. response = get_response(request) File "/home/jasonhoward/lib/python3.6/django/core/handlers/base.py" in _get_response 128. response = self.process_exception_by_middleware(e, request) File "/home/jasonhoward/lib/python3.6/django/core/handlers/base.py" in _get_response 126. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/jasonhoward/lib/python3.6/django/contrib/auth/decorators.py" in _wrapped_view 21. return view_func(request, *args, **kwargs) File "/home/jasonhoward/webapps/beanzoid/jason/accounts/views.py" in homepageimage 1076. instance.save() File "/home/jasonhoward/lib/python3.6/django/db/models/base.py" in save 729. force_update=force_update, update_fields=update_fields) File "/home/jasonhoward/lib/python3.6/django/db/models/base.py" in save_base 759. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/home/jasonhoward/lib/python3.6/django/db/models/base.py" in _save_table 842. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/home/jasonhoward/lib/python3.6/django/db/models/base.py" in _do_insert 880. using=using, raw=raw) File "/home/jasonhoward/lib/python3.6/django/db/models/manager.py" in manager_method … -
Invalid bucket name from docker-compose up to EC2
I created a docker machine on EC2. Then I created a new cookiecutter_django app and left it plain vanilla. It's set to use .evn for the environment variables. docker-compose -f production.yml build worked fine. docker-compose -f production.yml up gives this error: django_1 | botocore.exceptions.ParamValidationError: Parameter validation failed: django_1 | Invalid bucket name "": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$" Researching this error, the advise was setting various environment variables. So I've tried them all in the .evn (I did create an s3 bucket named pulsemanager): DJANGO_AWS_STORAGE_BUCKET_NAME=pulsemanager AWS_S3_BUCKET_NAME_STATIC=pulsemanager AWS_STORAGE_BUCKET_NAME=pulsemanager No matter what I try I'm stuck with the error. -
Wrap button in `{% buttons %}`
I learns the button from bootstrap with Django template {% buttons %} <button name="button" class="btn btn-primary">log in</button> {% endbuttons %} I test it make no difference when removing {%%} <button name="button" class="btn btn-primary">log in</button> What's the reason the button should be wrapedin {% buttons %} -
How to associate User Logged to Models in a Form?
I have a problem. In my project, I need to associate the User logged in a forms to my Models. A forms contains ('user_logged', 'name', 'description' and 'conclusion'), and I wish the forms get user logged automatically, and other fields I will put manually. I try this in my models: user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True, on_delete=models.CASCADE) But I fill in my forms, and dont get my user logged, the results for user is: "None". My views below: @method_decorator(login_required, name='dispatch') class CreateTarefa(CreateView): model = Tarefa fields = ['nome_tarefa', 'descricao', 'concluida'] template_name = 'tarefa_form.html' Thanks a lot. Best wishes. -
Enumerate element with tag ol in for loop
I'd like to enumerate the elements in for loop with tag 'ol' with code: {% for topic in topics %} <ol> <li>{{ topic }}</li> </ul> {% endfor %} It displays 1.Python 1.Javascript 1.SQL When tried: {% for topic in topics %} <ol> <li>{{ forloop.counter }}{{ topic }}</li> </ol> {% endfor %} It outputs: 1.1.Python 1.2.Javascript 1.3.SQL Refactor the code as and works: {% for topic in topics %} <ul> <li>{{ forloop.counter }}. {{ topic }}</li> </ul> {% endfor %} The solution seem cumbersome, Could it be achieve in a straight-forwards way? -
Django - How to link one person with Multiple tokens for other users to sign up with
my question is how do you create multiple tokens when a specific class of user signs up then those token are linked to that user and when users sign up with the token in another class it goes under the first users interface and they can control what they see. For More Clear Description--- I'm trying to create a VR project for schools where you can learn with VR 360 videos. What I need to know is how do I implement code that makes it so when a teacher signs up they are given a class code. then the students sign up with that class code and they are automatically linked to the teacher and the have an interface of the students that used that class code. I've got the signup forms up except for the token part. Any help would be appreciated! Thanks, Missbzeebee P.S. I'm using Django 2.0 and Pycharm for programming. -
Django got segmentation when running uwsgi with gevent paramters
I would like to use websocket like http://django-websocket-redis.readthedocs.io/en/latest/running.html. When I try command 'uwsgi --http :9000 --module mysite.wsgi --http-websockets', it works correctly. But when running with 'uwsgi --http :9000 --module mysite.wsgi --gevent 100 --http-websockets', it got a segmentation. *** Operational MODE: async *** WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x8427c0 pid: 18686 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 18686, cores: 100) *** running gevent loop engine [addr:0x48d3e0] *** Traceback (most recent call last): File "src/gevent/greenlet.py", line 527, in gevent._greenlet.Greenlet.spawn File "src/gevent/greenlet.py", line 247, in gevent._greenlet.Greenlet.__init__ File "src/gevent/greenlet.py", line 133, in gevent._greenlet._extract_stack ValueError: call stack is not deep enough !!! uWSGI process 18686 got Segmentation Fault !!! *** backtrace of 18686 *** uwsgi(uwsgi_backtrace+0x2c) [0x46b5bc] uwsgi(uwsgi_segfault+0x21) [0x46b981] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f3744ab84b0] uwsgi() [0x48da09] uwsgi(uwsgi_ignition+0x12e) [0x46bb6e] uwsgi(uwsgi_worker_run+0x26d) [0x47039d] uwsgi(uwsgi_init_worker_mount_apps+0) [0x4709a0] uwsgi() [0x41e53e] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f3744aa3830] uwsgi(_start+0x29) [0x41e569] *** end of backtrace *** Is there any suggestion? -
How can you translate log entries?
I have a model, Timeline, that represents the history of a User. Other users and many other applications can append Logs to this Timeline. Log has the following fields: user_id: foreign key to user created_at: datetime content: text Problem: I realized this model is unable to be translated into other languages (i18n is a high priority for me). How can I build structure the Log class so that is translation friendly? -
Floor Division and Modulo in ListView Django
With Django Listview, is it possible to display new columns that contain the values of floor division and modulo? I have the following two models: models.py class Model_Item(models.Model): item_name = models.CharField(max_length = 100, null = False, blank = False, unique = True) item_bottleperpack = models.FloatField(null = True, blank = False) # e.g. 100 bottles per pack def __unicode__(self): return self.item_name class Model_ItemTransaction(models.Model): item = models.ForeignKey(Model_Item, to_field = "item_name") item_sold = models.FloatField(null = True, blank = True) # in terms of bottle def __unicode__(self): return self.item With this listview: views.py class View_Item(ListView): def get_queryset(self): queryset = Model_Item.objects.all() queryset = queryset.annotate( sum_ = Sum("model_itemtransaction__item_sold") ) queryset = queryset.annotate( floor_division_ = F("sum_") // F("item_bottleperpack"), module_ = F("sum_") %% F("item_bottleperpack") ) return queryset Basically, if I have sold, say 650 bottles, and there is 100 bottles per pack, I would like the listview to display: 6 packs on the "floor-division" column, and 50 bottles on the "modulo" column. Currently I am receiving the following errors with my current code unsupported operand type(s) for //: 'F' and 'F' and unsupported operand type(s) for %%: 'F' and 'F' and hoping someone could help me find any solution to this (and it does not have to be … -
Trouble Banning users and adding them to table
I Have a function that is intended to ban a user and then add them to the Banned_User table.So that I may then send the user an email with the details of their ban.But I can't seem to get the function to ban and save. Function works as intended If I change my report_reason field in Banned_User table from models.ManyToManyField to models.ForeignKey but a user can have multiple reports and reasons reported and email needs to contain all reasons banned so I require it to be a ManyToManyField. Current traceback error: Exception Type: TypeError at /admin/api/profile/ Exception Value: Direct assignment to the forward side of a many-to-many set is prohibited. Use report_reason.set() instead. def banning_users(self, request, queryset): for obj in queryset: if hasattr(obj, 'user'): # This object is a Profile, so lookup the user profile = obj user = obj.user user.is_active = False user.save() # Get the report(s) for this user user_reports = Report.objects.filter(user_reported=profile) # Go through each report, in case there are multiples, # add a record in the ban table banned_reasons = [] for report in user_reports: ban_record = Banned_User.objects.create(profile=profile, report_reason=report) ban_record.save() banned_reasons.append(report.get_report_reason_display()) # Send the email subject = 'Ban' message = 'You have been banned for the … -
Encapsulate the argument captured in (?P<topic_id>\d+) as request object's attribute
In the urlpatterns Django send a get request and and topic_id argument to views.py url(r'^edit_topic/(?P<topic_id>\d+)$', views.edit_topic, name='edit_topic'), In the views.py get passed in the two arguments def topic(request, topic_id): """Show a single topic and all its entries.""" topic = Topic.objects.get(id=topic_id) I wonder if topic_id could be included in request and send single one argument to views.py def topic(request): topic = Topic.objects.get(id=request.topic_id) The codes will encounter error now, but it's not difficult to achieve in the implement details of Django to add 'topic_id' attribute to request object. What's the disadvantage if package topic_id to the request? -
Django Load DB data via AJAX
I have these queries on views.py: class MyView(LoginRequiredMixin, TemplateView): template_name = 'templates/diagram.html' def get_context_data(self, **kwargs): context = super(MyView, self).get_context_data() context['models'] = Model1.objects.filter(parent_category__isnull=True) if 'model_type' == 'type1': context['type1'] = Model1.objects.filter(parent_category__pk=kwargs['type1']) if 'model_type' == 'type2': context['type2'] = Model2.objects.filter(type2__type1=kwargs['type2_pk']) if 'model_type' == 'type3': context['type3'] = Model3.objects.filter(type1__pk=kwargs['type2_pk']) return context The models that I am using, are all related to each other (I have changed their names) and I want to build an AJAX function that loads the data into a simple HTML Tree. I am doing this since there is a lot of data and I want to load the related data of a root element with a click event. This is the script that I have built: <script> $(document).on('click', '.js-expand', function () { var elem = this, model_type = $(this).data('model_type'), model_pk = $(this).data('model_pk'); var model_data = { 'model_type': model_type, 'model_pk': model_pk }; $.ajax({ url: '{% url 'my_view_url' %}', data: model_data, success: function (data) { var child = $(elem).children().first(); child.html(data); } }) }); Now, in my template I have this piece of code: {% if models %} <ul> {% for model in models %} <li class="js-expand" data-model_type="type1" data-model_pk="{{ model.pk }}" style="color: black;"> {{ model }} <ul class="js-expand" data-model_type="type2" data-model_pk="{{ model.pk }}" style="color: blue;"> {% … -
a POST request was judged as NOT POST Method
When I submit a post request from a form, it's processed as not post in the views: <p>Edit The Topic:</p> <form action="{% url "learning_logs:edit_topic" topic.id %}" method="POST"> {% csrf_token %} {{ form.as_p }} <button name="button">Save Changes</button> </form> The views.py, I set test within if request != "POST": def edit_topic(request, topic_id): topic = Topic.objects.get(id=topic_id) if request != "POST": form = TopicForm(instance=topic) # assert request == 'POST' print("\tPOST Method in not post condition.\n", f"\tRequest Method is {request.__dict__['method']}") come by with Quit the server with CONTROL-C. POST Method in not post condition. Request Method is POST [16/May/2018 07:14:31] "POST /edit_topic/5 HTTP/1.1" 200 1770 The post method is treated as not post. What's the problem with my code? -
AttributeError: 'bool' object has no attribute
I am working on a Django project and essentially I have written a model which stores user details. They complete this profile after they have signed up and I have a Boolean in the User model which states whether they have completed this custom profile yet so I can make changes in the template. When the form for the second profile page gets submitted I would like it to update the Bool from False to True but I am getting the error: 'bool' object has no attribute 'has_created_artist_profile' See code below: views.py def ArtistEditView(request): artist = Artist.objects.get(user=request.user) current_artist = request.user artist_status = current_artist.has_created_artist_profile if request.method == 'POST': form = ArtistForm(request.POST, request.FILES, instance=artist) if form.is_valid(): artist_status.has_created_artist_profile = True artist_status.save() form.save() return redirect(reverse('artist_home')) else: artist_dict = model_to_dict(artist) form = ArtistForm(artist_dict) return render(request, 'artist/artist_edit.html', {'form': form}) forms.py class ArtistForm(forms.ModelForm): class Meta: model = Artist exclude =['user', ] Any one able to suggest a better way to update this / to get rid of the error? -
NoReverseMatch at /restaurant/meal/9/edit/ at Django
i created a restaurant_delete_meal function to delete meal object . When i run the link restaurant/meal/id/delete the function work and delete the object . But when i try to add a button in the edit-meal page with the link of delete meal function i get this error NoReverseMatch at /restaurant/meal/9/edit/ Error during template rendering enter image description here -
Conditionaly redirect users after login
I have looked at both Django -- Conditional Login Redirect and Conditional login redirect in Django and neither address my current issue. What I want to do is check a property of the user after they have successfully logged in. If the property is in a good state send them directly to the page specified by the next URL argument, otherwise send them to fix the property and then forward them to the next page. So far I have succeeded in sending the user on to next after they have fixed the property, but I can't conditionally redirect after login. I know I can set the LOGIN_REDIRECT_URL, but that only applies if there is no value in next. -
Heroku custom domain from hostgator
I have a django application that I launched with heroku. I have a challenge of adding my custom domain to change the www.example.heroku.com to www.example.com. I got my domain with hostgator and I have changed the cname to point to www.example.com.herokudns.com. but after 48 hours I am unable to use www.example.com and I contacted my domain provider which is hostgator but I was told I needed nameserver which is not provided by heroku. I am confused at this point as this is my first time of trying a custom domain with an heroku application -
How to change status of a task in scrum app in django
I have a scrum app built with django to finish and need help with changing the status of the task via a html template page (weekly,daily) to (verify or done). There are user groups of developer(add weekly and daily tasks, move task to verify section) admin, quality analyst and owner(full priveleges to move tasks and update task). I need to be able to change the task when signed in as a developer but is stuck here are the path and view.py file path('/changestatus/', views.ChangeTaskStatus, name='change_status'), Check the file snippet here