Adzmely
Yes that for single field I need to be increase for two fields
actually not all db backend support multiple auto field in single table
Adzmely
there is a discussion about this 10 years ago …
abhishek
Yes but for me I was getting stuck in logic but now I got it I need to fetch the previous integer from db and need to give an single increment for that
abhishek
Like id it will increase For empid it should start from 100
abhishek
Like that
Adzmely
id= autofield empid = id + 100
abhishek
Ohh ok
Adzmely
u can add a save func in your model class , that take the value of self.id and set self.empid = self.id + 100
Adzmely
overide save method in order to set the empid value ..
Даниил
overide save method in order to set the empid value ..
To be honest, it's bad practice to override save method, in his case better desicion to use signals
Adzmely
To be honest, it's bad practice to override save method, in his case better desicion to use signals
imho it is not a total overide , you just like injecting some extra things before the real “super” save
abhishek
Super save?
Adzmely
Super save?
google for overide save method in django model, u will understand …
abhishek
Ok
Smile
hello is the delete method safe to use? Or POST is the most reliable and why?
Google
I have a postgresql database. How can I use django-dbbackup?
S
Anyone know Django loggers concept
S
Anybody Please help me to excecute django logger
Vishal
Can we edit the model data in a list view ??
Smile
with what it is connected that the given request without the distinct() will return duplicates? tags = Tag.objects.filter(name__icontains=q) object_list = self.model.objects.distinct().filter( Q(title__icontains=q) | Q(project_owner__name__icontains=q) | Q(tags__in=tags))
ssff
opencv(4.6.0) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:assertion failed) !_src.empty() in function 'cv::cvtcolor'
Maxim
Please help me out I got this error
this is Django group, not Python group
ssff
ssff
I know that this group for django
George
This is problem of django
do you know how to read the error?
George
I think yes
as you can see it says OPENCV
OneRepublic
Hello All, is it a good idea to create different table (i.e model) to store 2 different type of users? I want them to signup with different fields in form. I've created a custom user model.
Max
class Youtube: def analyze(self, request): if 'url' in request.GET: self.url = request.GET['url'] url = self.url url = url.split('=', 1)[1] url = url.split('&', 1)[0] url = 'https://i.ytimg.com/vi_webp/{}/maxresdefault.webp'.format(url) context = { 'url': url } return render(request, 'main/index.html', context) Hi gues, why it says that I have to put 2 arguments, anybody knows?
Software Engineer
https://nekobin.com/bixonufuga
Software Engineer
Is this correct?
Oxytocin
Hi Im new to django and have a question now. Thanks for help Actually I have 5 models: ls-bl, list, block, question, answer Ls-bl connects one list with one block Each list has some questions And each question must have one answer Now I want to create an obj of answer for each question of the list in ls_bl Would you please explain that how I can do this?
navid
hello everyone i need help understanding how django ORMs work through many to many relationships consider a PRODUCTS and a CATEGORY model and a third table for making a relationship between these two and some other details having the id of the category how can i access the products related to it?
Thayrone
Good afternoon guys, somebody know handle with Django tenants? How can i use autocomplete Fields with shared apps and tenants apps?
Hunter
In what sequence the django files are executed ???
navid
class products(): description = .... class category(): name = ... class ProductCategory(): pro = foreign (product) cat = foreign (category) . . .
SELECT "Products"."product_id", "Products"."name", "Products"."description", "Products"."price", "Products"."main_image", "Products"."created_on" FROM "Products" INNER JOIN "ProductsCategory" ON ( "Products"."product_id" = "ProductsCategory"."product_id" ) WHERE "ProductsCategory"."category_id" = 1
navid
data = Products.objects.filter(productscategory__category=category_id)
navid
here's what i tryed and the result
navid
this returns none although there is data matching the conditions
Charly
navid
category__category=category_id?
navid
Cannot resolve keyword 'category' into field. Choices are: created_on, description, main_image, name, pictures, price, product_id, productscategory, userproduct_cart
navid
remove the products part on filter parameter
mind if i DM you the details? it's been hours trying to figure this out 😑
Nityananda
How to connect react js with django??
How to connect react js with django??
With RESTful API For creating rest API in Django, you should use Django Rest Framework
Hunter
Anyone
Charly
Anyone
Anyone what?
Mirco
Anyone
!anyone
Doragonsureiyā
Anyone
Maybe anyone is here, yes, but they are not obliged to read everyone's message here neither to reply to everyone's message, if someone wants to reply to your message, they will do that, just don't try to draw attention to your message writing "anyone?" every 5 minutes, that will lead you to be warned for SPAM/Flood, just be patient or use Google/DuckDuckGo to research about your question instead of wasting time here waiting for people to do your work. Have a nice day 😊
navid
mind if i DM you the details? it's been hours trying to figure this out 😑
sun of a bitch i forgot to return the results after the get_queryset method 7 fucking hours wasted on bullshit
Stealth
hi, i need help. i have django project and nginx in docker. but i have dont working video. static work, image work but video dont work dont load player. help please me
Tadiwos
m
Without rest API??
Without rest API you can not use all the react features in Django
Nityananda
Suppose I have to use components of reacts then how should I do.
Mirco
Suppose I have to use components of reacts then how should I do.
2 projects: 1. React 2. Django with Rest framework as installed app With Django you expose APIs With React you will consume APIs by using axios for example
Beki
Hi there i was starting with django and peoples refer me to use node .... any suggestion here
Ahmed
Hi there i was starting with django and peoples refer me to use node .... any suggestion here
Node.js is the best backend freamwork but you have to leran more about Javascript and the Javascript programing language it's hard and it's had many updates
Tanner
Hi there i was starting with django and peoples refer me to use node .... any suggestion here
Plenty of mvcs have advantages and disadvantages. Django might not be the fastest or have the newest bells and whistles, but it's widely adopted, proven to support huge applications, and makes life very easy. So it should be right up there with any framework you consider 😃
👑 Dharmzeey
Please i have reoccurring issues with my django model , migrations and database. Summary, today i changed my default id to uuid and then after migration, i wanted to run migrate command but have been getting error (django.db.utils.IntegrityError: could not create unique index) I know if i delete database table, the problem will be solved but i already have a lot of information Please how can i solve the problem without dropping my table
👑 Dharmzeey
I have checked the internet, and tried several methods, but none worked
👑 Dharmzeey
And also, not only for uuid, in the past I have run into such error whereby I later end up deleting the migration and the table, but I don't want to delete the fable It is even always worse in production
.
Hello All, is it a good idea to create different table (i.e model) to store 2 different type of users? I want them to signup with different fields in form. I've created a custom user model.
“..always use one, and only one Django model to handle the authentication. You can still have multiple user types, but generally speaking it’s a bad idea to store authentication information across multiple models/tables.” Good read for you https://simpleisbetterthancomplex.com/tutorial/2018/01/18/how-to-implement-multiple-user-types-with-django.html How many different fields are you considering for those user types? If it’s just a few, you can just add all fields to the same user model, with one field that differentiates them, and handle loading different fields using Django’s forms logic. If it’s a lot, consider 1. Subclassing into 2 user types, or 2. Storing that different information as its own model/table
asymtrc
hey folks ! how do I set data when initializing model automated ? I have model Country and City , co city has ForeignKey=Country . And I want another model Hotel that has ForeignKey fields for City and Country , how do I make Hotel to override "country" field from City ?
Shrenika
I got an error template does not found error
Shrenika
Anyone know how to solve that
Favas
Django 2.2 relatedobjectdoesnot exist error for onetoone field
Ramesh
Hii all I'm creating a survey app with survey model questions models and responses. Now I'm getting the problem representing the respective survey questions as headers and the responses in a tabular format, could anyone please help me
Favas
Any ideas about this error anyone??
Amaljith Chacko
Any ideas about this error anyone??
The entry might be get deleted