Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to use combination of annotate and aggregate sum in Django ORM
from the below table I need the output has, [(Apple,21.0), (Orange,12.0) ,(Grapes,15.0) ] basically fruits grouped with the sum of their cost date in (dd/mm//yyyy) Fruits Table date item price 01/01/2021 Apple 5.0 01/01/2021 Orange 2.0 01/01/2021 Grapes 3.0 01/02/2021 Apple 7.0 01/02/2021 Orange 4.0 01/02/2021 Grapes 5.0 01/03/2021 Apple 9.0 01/03/2021 Orange 6.0 01/03/2021 Grapes 7.0 ........... .... I tried the below code its not working as expected fruit_prices = Fruits.objects.filter(date__gte=quarter_start_date,date__lte=quarter_end_date) .aggregate(Sum('price')).annotate('item').values('item','price').distinct() -
Django- login_required decorter not working please help me
Working on a simple project using Django and the loqin_required decorator is not working. i just want when a user is logged in and refresh page or click "back" then it should logged out. here is my code : views.py from django.shortcuts import render from django.contrib.auth.decorators import login_required # Create your views here. @login_required(login_url='/authentication/login') def index(request): return render(request,'expenses/index.html') def add_expense(request): return render(request,'expenses/add_expense.html') urls.py from .views import RegistrationView,UsernameValidationView,EmailValidationView, VerificationView, LoginView ,LogoutView from django.urls import path from django.views.decorators.csrf import csrf_exempt urlpatterns = [ path('register',RegistrationView.as_view(),name="register"), path('login',LoginView.as_view(),name="login"), path('logout',LogoutView.as_view(),name="logout"), path('validate-username',csrf_exempt(UsernameValidationView.as_view()), name="validate-username"), path('validate-email', csrf_exempt(EmailValidationView.as_view()), name='validate_email'), path('activate/<uidb64>/<token>',VerificationView.as_view(),name="activate"), -
How to get imagefield path in models?
Happy new year and hello,i've got a problem with resizing images in django. I need to find out the way to get Imagefield path from model during loading images, how do i get? I wrote a func which changing upload path for Imagefield, i'd like to get an url to that file and past it in imagekit generator for resize. This is a func for changing upload path for Imagefield def get_file_pathM(instance, filename): extension = filename.split('.')[-1] new_name = 'new_name' filename = "%s.%s" % (new_name, extension) print('geeeeeeeeeeeeeeeeet', os.path.join('photos/project_photo/%y/%m/%d')) date_now = date.today().strftime("%Y/%m/%d").split('/') path = 'photos/project_photo/{}/{}/{}'.format(date_now[0], date_now[1], date_now[2]) return os.path.join(path, filename) Here's my class of ImageSpec for resize class Thumb(ImageSpec): processors = [ResizeToFill(100, 50)] format = 'JPEG' options = {'quality': 60} photo = models.ImageField(upload_to=get_file_pathM, verbose_name='Фото', blank=True, null=True) source_file = open('here should be an url to photo','rb') image_generator = Thumb(source=source_file) result = image_generator.generate() dest = open('media/photos/project_photo/2022/01/03/avtolider_new.jpg', 'wb') dest.write(result.read()) dest.close() And another question, it's said in imagekit documentary that's it's possible to use Imagefield as source in image_generator without using open, but it doesn't work somehow and shows an error, like Imagefiled can't open or close file. -
Can an APIView group multiple GET and POST methods?
I am implementing an API for a game using DRF view (more specifically APIViews). I have figured out how to use more than one serializer for a view but I need this view to combine multiple models and think that I need more than one GET as well as more than one POST method. Is this even possible? My code so far looks like this: class GameView(APIView): """ API View that retrieves the game, allows users to post stuff and finally a game session is posted as well once the 5 game rounds have been completed """ serializer_class = GametypeSerializer serializer_class = GamesessionSerializer serializer_class = GameroundSerializer serializer_class = ResourceSerializer serializer_class = VerifiedLabelSerializer serializer_class = LabelSerializer def get_serializer_class(self): if self.request.method == 'POST': return YOUR_SERIALIZER_1 elif self.request.method == 'GET': return YOUR_SERIALIZER_2 else: return YOUR_DEFAULT_SERIALIZER def get_queryset(self): gametypes = Gametype.objects.all().filter(name="labeler") return gametypes def get(self, request, *args, **kwargs): # gets a resource and an empty game round object to be completed (according to the game type chosen by the user) def post(self, request, *args, **kwargs): # users post a label, that is saved in the label model, a verified model is saved in the verified label model. Once 2 game rounds have been completed, … -
TypeError: unsupported operand type(s) for /: 'float' and 'decimal.Decimal'
Let us consider my views.py def ajax_add_other_order_item(request,id): client = request.user.client def _convert(from_currency, to_currency, price): custom_rate_obj = client.custom_rates.filter(currency=to_currency).first() if custom_rate_obj is None or custom_rate_obj.exchange_rate in (0, None): custom_rate_obj = ExchangeRates.objects.latest('created') return custom_rate_obj.convert(from_currency, to_currency, price) if request.method == 'POST': unit = request.POST.get('u_price') or 0 purchase_price = _convert(currency, 'GBP', float(unit)) try: exchange_price = float(unit)/purchase_price except ZeroDivisionError: exchange_price = 0 Here i am getting error TypeError: unsupported operand type(s) for /: 'float' and 'decimal.Decimal' Please help to solve this issue -
Which one is better pgpool vs pgBouncer for Database connection Pooling
Currently working on monolithic Django Service. Want to use a Database pool so which one is better pgpool vs pgBouncer. p -
Unbound Local Error: local variable 'files' referenced before assignment
Unbound Local Error: local variable 'files' referenced before assignment Getting error above: Please tell me where I am getting wrong in this code. I am beginner in Django. And I tried so many times. In this project, I am doing multiple file upload using model forms. Please help me to solve this. views.py: from Django. shortcuts import render from user master. forms import Feed Model Form, File Model Form from .models import Feed File def create_ to_ feed(request): user = request. user if request. method == 'POST': form = Feed Model Form(request .POST) file_ form = File Model Form(request. POST, request. FILES) files = request. FILES. get list('file') #field name in model if form.is_ valid() and file_ form.is_ valid(): feed_ instance = form. save(commit=False) feed_ instance. user = user feed_ instance. save() for f in files: file_ instance = Feed File(file=f, feed=feed_ instance) file_ instance. save() else: form = Feed Model Form() file_ form = File Model Form() return render(request,' user master/multiplefile.html',{'form': form, 'file_ form': file_ form, 'files': files, 'user': user}) urls.py: path('multiple/', views. create_ to_ feed, name='create_ to_ feed'), ]+static(settings. MEDIA_ URL, document_ root= settings. MEDIA_ROOT)+static(settings. STATIC_URL, document_ root=settings. STATIC_ROOT) models.py: from Django. d b import models Create your … -
Create dynamic action URL form in Django python
whenever I submit the form it takes me to the testformresult page like https://www.studnentdetail.com/student/testformresult but What I want is, when someone enters the name of the student in the form.html page then data of that student is fetched from the mysql database and displayed on another page something like https://www.studentdetail.com/student/<student_name>. Also I want to know how like many railway site when we search for particular train like 10029 then in the next page it shows url something like https://www.train/10029-running-status. form.html <form method="POST" action="{% url 'testformresult' %}"> <label for="fname">First Name</label> <input type="text" id="fname" name="firstname" placeholder="Your name.."> <input type="submit" value="Submit"> </form> views.py def testform(request): return render(request, 'testform.html') def testformr(request): fname = request.POST.get('firstname') return render(request, 'testformresult.html') urls.py path('testform', views.testform, name='testform'), path('student/testformresult/<slug:student>', views.testformresult, name='testformresult'), -
Django. Retrieving data from a related model for use in a form
How can I automatically associate a user with an id_ ticket and fill in a field in the form? Sample form - https://i.stack.imgur.com/9YMUv.png models.py class Ticket(models.Model): ticket_id = models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID') ticket_title = models.CharField(max_length=100) ticket_date_open = models.DateTimeField(auto_now_add=True) user = models.ForeignKey(CustomUser, on_delete=models.CASCADE, verbose_name='User') class TicketMessage(models.Model): ticket_mes = models.TextField(verbose_name='Message') ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE) user = models.ForeignKey(CustomUser, on_delete=models.CASCADE) forms.py class TicketMessageForm(ModelForm): ticket_mes = forms.CharField(label='Answer', required=True) class Meta: model = TicketMessage fields = ('ticket_mes', 'ticket') views.py class Ticket(DetailView, CreateView): model = Ticket form_class = TicketMessageForm ticket_message = TicketMessage template_name = 'support/ticket.html' context_object_name = 'one_ticket' allow_empty = False def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['ticket_message'] = TicketMessage.objects.filter() return context def form_valid(self, form): obj = form.save(commit=False) obj.user = self.request.user return super(Ticket, self).form_valid(form) success_url = reverse_lazy('ticket_list') I assume that need to somehow take the data from the template and pass it to form_valid. Tried adding a hidden field where passed the necessary information. This is works, but it looks wrong and unsafe. <select class="d-none" name="ticket" required="" id="id_ticket"> <option value="{{ one_ticket.ticket_id }}" selected="">{{ one_ticket.ticket_id }}</option> </select> -
Async Request with OpenAPI Generator Python
Happy New Year EveryOne I have a particular Case in which i am using OpenAPI generator for calling the api in another Microservice. I have two microservices ie User and Customer so in Customer im am getting the information of the multiple users from User below is the example code from user.api_clients import User user_id = [1, 2, 3, 4, 5, 6, 7, 8, 9] user_list = [User.api.get(id=i) for i in user_id] and the above code will give me the user_data from User. In short it will hit user api from User 9 times one by one. So is there any way to hit this in a single shot with asyncio. I am new to this async thing in python. So ill really appreciate if anyone can give me an idea about how to do this. There is also a similar case like i want to get object from User model in oneshot for these user_id list. Yes i can use id__in=user_id but is ther anyway to hit the below code in oneshot like below code user_id = [1, 2, 3, 4, 5, 6, 7, 8, 9] user_obj = [User.objects.get(id=i) for i in user_id] Thanks for helping -
How to add property decorator with return url path in existing model field how?
I am make a model with the md5_name field but i want to return a share_url key using property decorator in django python how. -
using method 'build_standard_field(self, field_name, model_field)' to overcame the error [<class 'decimal.InvalidOperation'>]
I'm writing a Django Rest Framework, and I want to use a generics.CreateAPIView to create an operation in my database. my models.py: class User(AbstractBaseUser, PermissionsMixin): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) email = models.EmailField("Email Address", unique=True) first_name = models.CharField("First Name", max_length=150) last_name = models.CharField("Last Name", max_length=150) mobile = models.CharField("Mobile Number", max_length=150, blank=True) balance = models.DecimalField(max_digits=9, decimal_places=2, default=0.0, verbose_name=("Balance")) created_at = models.DateTimeField("Created at", auto_now_add=True, editable=False) class Operation(models.Model): sender = models.ForeignKey("User", related_name=("Sender"), on_delete=models.CASCADE) receiver = models.ForeignKey("User", related_name=("Receiver"), on_delete=models.CASCADE) amount = models.DecimalField(max_digits=9, decimal_places=2, default=0.0, verbose_name=("Amount")) created_at = models.DateTimeField("Created at", auto_now_add=True, editable=False) I want to send uuid values when creation the operation and handle the users filter in the backend using the view. So I added extra fields to the serializers as this: class OperationCreateSerializer(serializers.ModelSerializer): sender_uuid = serializers.UUIDField(format='hex_verbose') receiver_uuid = serializers.UUIDField(format='hex_verbose') amount = serializers.DecimalField(max_digits=9, decimal_places=2, coerce_to_string=False) class Meta: model = Operation fields = ["sender_uuid", "receiver_uuid", "amount"] write_only_fields = ["sender_uuid", "receiver_uuid"] class OperationListSerializer(serializers.ModelSerializer): class Meta: model = Operation fields = ["sender", "receiver", "amount"] The Problem is when I try to create the transfert operation I get error [<class 'decimal.InvalidOperation'>] for the field 'amount' in the view. The logic I'm using in my view is: class TransferView(generics.CreateAPIView): serializer_class = OperationCreateSerializer queryset = Operation.objects.all() def create(self, request, *args, … -
Dict columns extraction using for loop
There is a dict named 'data' { "error":false, "message":"Ok", "data":{ "numFound":1845, "start":0, "numFoundExact":true, "docs":[ { "sub_farmer_id":0, "grade_a_produce":320, "commodity_image":"red_carrot.jpg", "farm_image":"", "batch_status":"completed", "batch_count":30, "franchise_type":"TELF", "sr_assignee_id":0, "farm_status":"converted", "state_name":"RAJASTHAN", "farmer_id":1648, "grade_a_sell_price":0, "id":"11", "commodity_name":"Carrot Red", "acerage":1, "soil_k":0, "lgd_state_id":8, "soil_n":0, "unique_key":"11_8", "historic_gdd":0.41, "farm_type":"soiless", "soil_test_report":"", "user_id":1648, "expected_yield_delivery_date":"2020-04-30T00:00:00Z", "current_gdd":0, "soil_p":0, "expected_grade_a_produce":636, "water_ph":0, "end_date":"2020-04-30T00:00:00Z", "batch_id":8, "expected_delivery_date":"2020-04-30T00:00:00Z", "previous_crop_ids":"0", "batch_updated_at":"2021-12-29T17:50:58Z", "grade_c_rejection":0, "water_test_report":"", "farm_updated_at":"2021-12-29T17:51:00Z", "water_ec":0, "start_date":"2019-10-30T00:00:00Z", "assignee_id":0, "pest_problems":"", "expected_production":1060, "is_active":true, "mobile":"7015150636", "grade_b_sell_price":0, "irrigation_type":"drip", "total_acerage":0, "current_pdd":0, "commodity_id":68, "stage":"flowering", "farm_health":"0", "expected_grade_b_produce":424, "grade_b_produce":740, "historic_pdd":0.31, "username":"Agritecture", "variety_name":"", "sr_assignee_name":"", "lng":0, "locality":"", "assignee_name":"", "subfarmer_mobile_no":"", "commodity_image_96px_icon":"", "subfarmer_name":"", "batch_end_date":"", "lat":0, "_version_":1720553030989906000 } But I am trying to extract data from list and append in a new csv with different columns so that it looks neat and clean so, Here I am trying code writer = csv.DictWriter(response_data, fieldnames=['Farmer Name', 'Mobile', 'Irrigation Type', 'Batch Status', 'Soil Parameters', 'Water Parameters', 'Crop Name', 'Farm Status', 'Farm Type', 'Franchise Type', 'Farm Total Acerage', 'Batch Acerage', 'Farm Health(%)', 'Historical Yield(/Acre)', 'Expected Produce', 'Actual Yield(/Acre)', 'Actual Produce', 'Crop health(%)', 'Stage', 'SOP Adherence', 'Assignee', 'Sub Farmer', 'Last Activity Update', 'Exp. Delivery Date'], delimiter=",") writer.writeheader() for docs in data.keys(): writer.writerow( {"Farmer Name": docs.get('username'), "Mobile": docs.get('mobile') "Irrigation Type": data.get('irrigation_type'), "Batch Status": data.get('batch_status'), "Soil Parameters": {'N:-': data.get('soil_n'), 'P:-': data.get('soil_p'), 'K:-': data.get('soil_k')}, "Water Parameters": {'ec:-': data.get('water_ec'), 'pH:-': data.get('water_ph'), }, "Crop Name": data.get('commodity_name'), … -
how to create multiple object in list using loop
So, I want to create different objects every time loops run, my object is [name, age, dob] which is appended in an empty list data = [] I am using class class PersonsData(object): # Object constructor def __init__(self): print("Person Data") self.name = '' self.age = 0 self.doB = 0 # Input Method def enter_data(self): size = int(input("Enter the number of data")) for i in range(size): self.name = str(input("Enter Your Name" + " ").upper()) try: self.age = int(input("Enter Your Age" + " ")) except: print("\n**Enter value in Number**") self.age = int(input("Enter Your Age" + " ")) self.doB = (input("Enter Your DOB" + " ")) print("\n") # Display Method def display(self): print("Name:", self.name) print("Age:", self.age) print("DOB:", self.doB) the problem is instead of creating new object its just overwritting other, so ho I can create new object my other half of the code while True: print() print(""" 1.Add New Detail 2.Display Detail 3.Quit """) choice = int(input("Enter Choice:" + " ")) if choice == 1: info = PersonsData() info.enter_data() print(info.name) data.append(info) print(data) elif choice == 2: for i in data: print("--------------------------------") i.display() print("--------------------------------") elif choice == 3: quit() else: print("Invalid choice") I am new to python so, please don't judge me on the … -
not getting fetch data from OneToOneFiled in Django Rest Framework
Models.py- In Hiring Model class Driver field is OneToOneField, how to fetch data from that, i did not find any proper solution how to work with OneToOneField relation, please help me out class Driver(BaseModel): employee_id = models.CharField(max_length=8,unique=True,null=True, default=True) city = models.ForeignKey( City, models.CASCADE, verbose_name='City', null=True, blank=True ) location = models.ForeignKey( Location, models.CASCADE, verbose_name='Location', null=True, blank=True ) class City(BaseModel): name = models.CharField('Name', max_length=80) employee_series = models.CharField('Name', max_length=3) available_employee_id = models.IntegerField(default=1) def __str__(self): return self.name class Location(BaseModel): city = models.ForeignKey( City, models.CASCADE, verbose_name='City', ) name = models.CharField('Name', max_length=80) def __str__(self): return self.name class Hiring(BaseModel): driver = models.OneToOneField( Driver, models.CASCADE, related_name='driver', verbose_name='Driver', null=True, blank=True ) status = models.CharField(max_length = 255,choices=STATUS_CHOICES, null=True, blank=True) serializers.py class CitySerializer(serializers.ModelSerializer): class Meta: model = City fields = ('id', 'name') class LocationSerializer(serializers.ModelSerializer): class Meta: model = Location fields = ('id', 'name') class HiringstatusSerializer(serializers.ModelSerializer): class Meta: model = Hiring fields = ('id','driver', 'status') class DriverEditListSerializer(serializers.ModelSerializer): city = CitySerializer(read_only=True) location = LocationSerializer() hiring=HiringstatusSerializer(many=True, required=False, allow_null=True) class Meta: model = Driver fields=('id','city','location','hiring') views.py class DriverViewSet(viewsets.ModelViewSet): queryset = Driver.objects.filter(is_active=1) serializer_class = DriverEditListSerializer output- in output u can see in hiring field showing null value { "id": 4343, "city": { "id": 1, "name": "Mumbai" }, "location": { "id": 89, "name": "Santacruz" }, "hiring": null … -
How to handle inline formset in post method of generic CreateView?
I have a form and inline formset, both on the same page to update Ad and Picture model. Here is the code: class AdCreateView(CreateView): form_class = AdForm template_name = 'main/ad_create.html' success_url = '/ads' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['picture_form'] = ImageFormset() return context def post(self, request, *args, **kwargs): form = ???? picture_form = ??? if form.is_valid() and picture_form.is_valid(): **somehow save data from both forms to DB.** ??? return ? So the question is, how can I take the inline formset in post method and validate and save it? And what should I return? I mean is this a proper way of doing it or maybe there are other ways to do it. -
multiple forms in one step, Django Wizard form
I am trying to create 2 Model Forms in on Step, one of them is Modelformset, does someone did this before, it will be very helpful if i get some working code. I am using Django 2 in my project. Thank you. -
Is Django Unleashed book good to use when starting to learn Django?
Im new to creating websites and i want to use Django as my backend framework. I learn better using books and after browsing the internet for some learning materials i saw this book Django Unleashed. This book uses Django 1.8 but the latest version as of now is Django 3. Is it ok to use outdated book to learn Django or is there any better books? I hope u can help me on this. Thank you -
Django, common model used in several applications
In my project, there are applications named "developer" and "startup" In developer and startup application, i need a table named "languages", which implies that the language developer use and startup use. So i made model named "languages", But I'm thinking about whether to make this in developer application or startup application, or make a new application and make it in it. When I made it in developer application, i could use it by importing startup application models.py. But actually, I don't think that the table "languages" is more relevant to application "developler" than "startup". How should I do? I referenced link https://stackoverflow.com/questions/4137287/sharing-models-between-django-apps -
How to implement DB Connection Pool in Django
Django kills db connection after every request. It is an overhead to create a new db connection every time so how can we implement a connection pool from where we can use connection objects. -
Is there a clean way to lower the cyclomatic complexity of Django templates?
I have a Django template I'm working on that takes an object that has multiple properties and adds different tags based on those properties. For example if object.bold == True it adds the <b></b> tag, and if object.strikethrough == True it adds the <strike></strike> tag. I've seen some other posts that smell which suggest nesting the ifs like: {% for object in objects %} {% if object.bold == True %} {% if object.strikethrough == True %} <b><strike>{{object.name}}</strike></b> {% else %} <b>{{object.name}}</b> {% endif %} {% else %} {% if object.strikethrough==True %} <strike>{{object.name}}</strike> {% else %} {{object.name}} {% endif %} {% endif %} {% endfor %} This code hurts me. I've also seen some wonky logic with only wrapping the beginning tags in if statements. Again, it's painful to introduce console errors. Is there a better, cleaner way to achieve this result without nesting ifs? I'm leaning towards making a custom Django tag but that seems like overkill for something that I'm really hoping can be simpler. -
Heart disease prediction
I have source code to predict heart diseases, but it shows 1-if disease is exist, and 0-if none disease. I need to make precent of disease. Here is an example with logistic regression, but i have 4 algorithms, so i need to show precentege of risk. Actually, i am new in AI, so this is not my code at all but i need to improve it view.py: import csv,io from django.shortcuts import render from .forms import Predict_Form from predict_risk.data_provider import * from accounts.models import UserProfileInfo from django.shortcuts import get_object_or_404, redirect, render from django.http import HttpResponseRedirect, HttpResponse from django.contrib.auth.decorators import login_required,permission_required from django.urls import reverse from django.contrib import messages @login_required(login_url='/') def PredictRisk(request,pk): predicted = False predictions={} if request.session.has_key('user_id'): u_id = request.session['user_id'] if request.method == 'POST': form = Predict_Form(data=request.POST) profile = get_object_or_404(UserProfileInfo, pk=pk) if form.is_valid(): features = [[ form.cleaned_data['age'], form.cleaned_data['sex'], form.cleaned_data['cp'], form.cleaned_data['resting_bp'], form.cleaned_data['serum_cholesterol'], form.cleaned_data['fasting_blood_sugar'], form.cleaned_data['resting_ecg'], form.cleaned_data['max_heart_rate'], form.cleaned_data['exercise_induced_angina'], form.cleaned_data['st_depression'], form.cleaned_data['st_slope'], form.cleaned_data['number_of_vessels'], form.cleaned_data['thallium_scan_results']]] standard_scalar = GetStandardScalarForHeart() features = standard_scalar.transform(features) SVCClassifier,LogisticRegressionClassifier,NaiveBayesClassifier,DecisionTreeClassifier=GetAllClassifiersForHeart() predictions = {'SVC': str(SVCClassifier.predict(features)[0]), 'LogisticRegression': str(LogisticRegressionClassifier.predict(features)[0]), 'NaiveBayes': str(NaiveBayesClassifier.predict(features)[0]), 'DecisionTree': str(DecisionTreeClassifier.predict(features)[0]), } pred = form.save(commit=False) l=[predictions['SVC'],predictions['LogisticRegression'],predictions['NaiveBayes'],predictions['DecisionTree']] count=l.count('1') result=False if count>=2: result=True pred.num=1 else: pred.num=0 pred.profile = profile pred.save() predicted = True colors={} if predictions['SVC']=='0': colors['SVC']="table-success" elif predictions['SVC']=='1': colors['SVC']="table-danger" if predictions['LogisticRegression']=='0': colors['LR']="table-success" else: colors['LR']="table-danger" if predictions['NaiveBayes']=='0': … -
install a django application for a client and protect its source code or convert it to an executable
I have a Django web application, I want to install it for a client who doesn't want to use the internet so I have to install it locally on his pc, My question: what should I do to protect my source code. See that I have to put all my source code on his pc to be able to install the application, is there a possibility to encrypt the source code or to convert the django project into exe? thank you ! -
how to update multiple fields via
how to update multiple fields via Model.objects.bulk_create(list) I try it Model.objects.bulk_create(list).update(startD=startD, endD=endD) but error show 'list' object has no attribute 'update' -
How I can create registration form using using my own usermodel in django
I wanted to create my own registration form without using the crispy forms, I wanted to give my own styling to the form, please help me with steps or provide me a tutorial link. Thank You