Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
1 answer
67 views

I've a LearnerInstance model: class LearnerInstance(models.Model): learner = models.ForeignKey(Learner, on_delete=models.CASCADE) aim = models.ForeignKey(Aim, on_delete=models.CASCADE) ... ...
Lisa Higgins's user avatar
0 votes
1 answer
106 views

Resetting the password in Django has four main step; Receive email from the user Send password reset link Get the link and change the password from the user side Register new password successfully I ...
cosmoscoder's user avatar
0 votes
1 answer
44 views

I am writing unit tests of ebook catalog applications in Django 5. The book creation page uses the built-in CreateView. The class code looks like this: class BookCreate(SuccessMessageMixin, ...
Eudemonix's user avatar
0 votes
2 answers
84 views

Is there a proper way to modify the form fields before validating the data on a Class Based FormView. More specifically a CreateView. Is necessary to use Class Based views 'cause I'm throwing in a ...
42WaysToAnswerThat's user avatar
0 votes
1 answer
43 views

I tried class base view in my blog website authorlogin. Every time I log in though, my author gets logged, but get a page of error. I have just convert login into class-based view but my author ...
Abrar Rofique's user avatar
0 votes
0 answers
32 views

If the python function "is_valid" has an exception, how do I keep the input values that were entered on the django form? I did search, maybe I don't know a better way to search. If there is ...
Steve42's user avatar
0 votes
0 answers
34 views

class MultipleFileInput(forms.ClearableFileInput): """ Work around for `widget=forms.ClearableFileInput(attrs={'multiple': True})` >> `widget=MultipleFileInput(attrs={'...
David L.E's user avatar
  • 125
3 votes
1 answer
1k views

I'm setting up a CRUD system with Django, using Class-Based Views. Currently I'm trying to figure out how to handle HTTP PUT and DELETE requests in my application. Despite searching the Django ...
user24265527's user avatar
-1 votes
1 answer
55 views

I have used User Creation Form for user registration. class UserSignUpView(SuccessMessageMixin, FormView): form_class = UserCreationForm success_url = reverse_lazy('login') template_name = ...
Shreyash Maskar's user avatar
1 vote
1 answer
32 views

I tried to make a training project with forms. I wanted to create a code for upgrading feedbacks in the form by Class Based Views. views.py class UpdateFeedbackView(View): def get(self, request, ...
odoacer22's user avatar
1 vote
2 answers
151 views

I have a Django app in my project I am currently working on called pharmcare, and I kind of getting into a unique constraint issue whenever I want to override the save() method to insert/save the ...
Blaisemart's user avatar
2 votes
2 answers
4k views

I used Django class-based login and logout views by "django.contrib.auth.urls", login feature works correctly, but when logging out via the link "http://127.0.0.1:8000/accounts/logout&...
Saeed's user avatar
  • 89
0 votes
1 answer
138 views

I implemented django-formtools SessionWizardView with a navbar, so I can jump between steps if I want to update existing instances. My problem is, if I want to edit an instance I have to submit all ...
T_Torture's user avatar
  • 499
1 vote
1 answer
166 views

I want to pass self.request data in the form class. I can access it in View, but unable to access it in form class. class AttendanceCreateView(LoginRequiredMixin, CreateView): model = Attendance ...
Vilashkumar Daate's user avatar
0 votes
1 answer
116 views

Thank you for your time. The following code is a class-based with the method named get_permissions() which purpose is to allow only the authenticated users to make POST,PUT,DELETE and PATCH requests: #...
Enrique Dominguez's user avatar
1 vote
1 answer
39 views

I have a Promotion model containing a published_date field. I would like to restrict access to future promotions to logged in users who are 'previewing' their promotion. class Promotion(models.Model)...
Byte Insight's user avatar
  • 1,184
0 votes
1 answer
42 views

I'm trying to build a form to use it as a filter for my project search page, but the {{form}} shows nothing. Here is how everything is set up: The model I'm trying to use from models.py class Exemplar(...
Ivan Mendes's user avatar
0 votes
1 answer
68 views

I'm trying to prepopulate a django FormView fields with data of another form (prepatory for a meeting minute creator). I made an project simplifiying and reproducing the error for better comprehension ...
herrmartins's user avatar
0 votes
0 answers
23 views

views.py: class LoveLetterCreateView(LoginRequiredMixin, CreateView): model = LoveLetter fields = '__all__' success_url = reverse_lazy('login') # NOT WORKING class SignUpView(CreateView): ...
Yuval Fadlon's user avatar
0 votes
1 answer
72 views

I create an app in django named 'sampleapp' then in models.py I define my model as follows: from django.db import models from django.urls import reverse class Employee(models.Model): first_name = ...
Mohammad Ali Soltan Hosseini's user avatar
0 votes
1 answer
63 views

I have a Django view that combines and sorts querysets from three different models (Event, Subject, and Article) to create a feed. I'm using the sorted function along with chain to merge the querysets ...
afi's user avatar
  • 593
3 votes
4 answers
3k views

I'm digging google for 3 hours right now, and can't find solution for my problem. I moved in my project from drf-yasg to drf-spectacular because openapi +3.0 isn't supported in yasg. I want to have an ...
Lukas's user avatar
  • 69
0 votes
1 answer
40 views

I tried to make a cbv class to generate a profile update function. I use username in URL, but there is always a mistake AttributeError at /edit_profile/apani Generic detail view ProfileUpdateView must ...
Maivery's user avatar
  • 11
0 votes
0 answers
43 views

I am trying to create an interface for a teacher to set homework tasks. This homework includes a student, a chapter, and questions belonging to a selected chapter. Therein lies my problem, I would ...
CranberrySundae's user avatar
0 votes
1 answer
52 views

I need to pass the bundle and the message values to get_context_data() method, but I cannot figure out how to do it. In this instance the form is valid when I pass it (I can add the better error ...
Swantewit's user avatar
  • 1,086
1 vote
1 answer
153 views

I use a regular generic.edit.CreateView of Django to create an object according to user input. The MyModel has an UniqueConstrait so the creation would fail if the new object happens to match an ...
user2283347's user avatar
0 votes
1 answer
1k views

An AssertionError occurred while trying to operate asynchronous view as class-based view in django(CBV) The python code i wrote is as follows. urls.py from django.contrib import admin from django.conf....
Simon's user avatar
  • 9
0 votes
1 answer
321 views

I have a Django project, I'm putting comments and google-style docstrings for better understanding. My question is, Is it okay to mention other methods or classes in a docstring within a function or a ...
David 04's user avatar
0 votes
2 answers
130 views

In the simplified example below, how do I reference the context variable "Elephant" (created in the class Lion) from inside the class Leopard? I have researched and tried a number of ways, ...
Condado's user avatar
  • 65
0 votes
1 answer
292 views

I am trying to pass the user submitted form data into the url kwargs. As of now I am directely returning the redirect response within the form_valid methoad of django's class based views. class ...
Kaushik Tank's user avatar
1 vote
1 answer
69 views

I am trying to make a class-based registration view equivalent of my old function based registration view. When I register as a new user, a user is created but is not logged in after registration, and ...
thenamethatiown's user avatar
0 votes
1 answer
318 views

I am building an API using Django Rest Framework. I have the /api/localities endpoint where all of the objects on my database are displayed. Now I want to create the endpoint for a single page of a ...
Blerdijan's user avatar
0 votes
1 answer
44 views

this is my view which is createview and i've used custom form and send current user id to the form class createToDo(CreateView): success_url = 'home' form_class = ToDoForm ...
vaseemcholakkan's user avatar
0 votes
1 answer
58 views

I found a workaround for my issue but I need to know why the first above case doesn't work. I need to pass a parameter (reman_pk) to my view but when I try : class RepairCreateView(LoginRequiredMixin, ...
Abpostman1's user avatar
0 votes
1 answer
34 views

I have two models Book and Review, models.py class Book(models.Model): title = models.CharField() class Review(models.Model): rating = models.IntegerField() content = models.TextField() ...
gabekutner's user avatar
1 vote
2 answers
666 views

I'm migrating from regular function based views, to class based views. One of the things that I couldn't migrate were the decorators I used. The decorator in question checks if the credentials of the ...
Eddysanoli's user avatar
0 votes
1 answer
283 views

I am trying to create a custom user model. The model is working fine in command prompt and I am able to login to admin panel as well. I can access Login page as well. But when I try to access the ...
Shravan K Subrahmanya's user avatar
0 votes
1 answer
2k views

I want to run long running task in Django class based Redirectview. Before this running task to complete I want to return template. Here is my code. I try with this code. class Redirect_to_page(...
Soe Paing's user avatar
1 vote
2 answers
67 views

I am trying to delete a record after displaying it with DetailView and redirecting to the list page again. view.py ... class DailyRecordDeleteConformationView(RequiredBasicDetailsAndContextMixin, ...
Kaushik Tank's user avatar
1 vote
1 answer
36 views

I have a class based UpdateView that works fine if I render the form as {{ form.as_p }}. It updating the values, but looks bad. If I try to render the fields individually it does not updating the ...
Oriza's user avatar
  • 29
0 votes
1 answer
44 views

I am trying to build CBV with class View parent. This view takes slug of object and find that object between two django models. The functions from services.py was doing a lot of DB queries, so, I ...
bl4z3rr666's user avatar
2 votes
0 answers
73 views

I want to update_or_create object by django CreateView. my class problem is update object but create duplicate of updated object class CardexCreateView(LoginRequiredMixin, CreateView): model = ...
MohamadHossein's user avatar
-1 votes
1 answer
47 views

I want to write a category detail view in order to do so i want to change this function based view def CategoryView(request, cats): category_posts = Post.objects.filter(category=cats.replace('-', ' '))...
Ulan's user avatar
  • 31
0 votes
1 answer
65 views

I'm pretty new when it comes to python classes / django CBVs. I'm trying to have a method (print_test) from my child class override my parent class, but I can't get it to work. What am I doing wrong? ...
Matt S's user avatar
  • 43
1 vote
2 answers
100 views

I'm trying to jump from the world of FBV to CBV, but running into an immediate problem...which i'm sure must be pretty common and solvable and I just don't know how... I'm inheriting the general View ...
Matt S's user avatar
  • 43
0 votes
1 answer
251 views

I'm learning Django and tried to write my own custom user model. I'm not using DRF and serializers and stuffs I have no idea about :) I am using createView to create users but I can't login because &...
Help's user avatar
  • 1
0 votes
0 answers
50 views

Hello my I have a Django project which works fine but the problem I usually get is from my Detail View, it does not render statics files. And when I check the output from my terminal I see that my ...
Victor Okoye's user avatar
1 vote
1 answer
204 views

Suppose I have 2 view classes class View1(LoginRequiredMixin, UserPassesTestMixin, View): def get(self, request, *args, **kwargs): #Do something and render a page def test_func(self): ...
jxw's user avatar
  • 725
0 votes
1 answer
194 views

I am trying to upload files (single and multiple) with an UpdateView via an update template but I keep getting a 'This field is required' error when I submit, and the files aren't uploaded, of course. ...
Uwa Isibor's user avatar
1 vote
1 answer
433 views

I am using Django class-based views for my project and trying to redirect user from registration view if he is already authenticated. I've done it already with LoginView and it was pretty simple and ...
Алексей Василенко's user avatar

1
2 3 4 5
34