Coding
from django.utils.encoding import python_2_unicode_compatible ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' Can anyone help me solve this error I don't understand it, I'm just a beginner in django
Anonymous
how can we keep track of video streaming progress in Django Rest Framework, when we are giving url of youtube to frontend(App).?
Azad
Hi... All.... I am facing issue to install pip install mysqlclient
Azad
I am not able to open mysql
꧁❦ I'm Farooq ❦꧂
I have one requirement table1: device_mac_a -- device_mac_b device 1. -- device 2 device 2 -- device 3 device 3. -- device 1 output: { device 1 :{device 2, device 3}, device 2:{device 1, device 3}, device 3:{device 1, device 2} }
Oloba
Hey Django gurus. There is this problem I usually encounter when collecting static. At times it works at times it doesn't. And I have tried to see the difference is static folder isn't copied in the root folder. Anyone with a better solution to this?
Son
hellow am asking how can i produce 8 random digits in my model using token
Son
or uuid
Son
without repeatation
Alex
hellow am asking how can i produce 8 random digits in my model using token
for uuid https://docs.djangoproject.com/en/3.2/ref/models/fields/#uuidfield
Alex
> There is this problem I usually encounter when collecting static. At times it works at times it doesn't. That tells me precisely nothing. Is there is any error or what? The algorithms is simple - specify STATIC_ROOT directory. Usually people set it as <project_dir>/static/, but actually you can put it wherever you want. And be sure that when you run manage.py collectstatic it has unix rights to access that dir. As well that your frontend server (usually nginx) has rights to read that dir as well
dคv¡d
i use form from ModelForm and i can add attr as what i want.. but i don't how i use that form again to use for update that field? pls help. Thank you so much
Alex
i use form from ModelForm and i can add attr as what i want.. but i don't how i use that form again to use for update that field? pls help. Thank you so much
I guess you need this example for the docs https://docs.djangoproject.com/en/3.2/topics/forms/modelforms/#the-save-method
dคv¡d
I guess you need this example for the docs https://docs.djangoproject.com/en/3.2/topics/forms/modelforms/#the-save-method
not about save() method just update form first but i don't know how to set value in html Element. at the first i build up form from ModelForm and i use that form for insert data but how can i use that form again for update ? or i need to try another method?
Alex
I get a 404 for css files. But http is fine
In short, it means that client cannot find that file under the given url. There can be tons of reasons why.
Oloba
In short, it means that client cannot find that file under the given url. There can be tons of reasons why.
What could be some of the reasons please? So that I can get to study and understand them. Kindly
Alex
What could be some of the reasons please? So that I can get to study and understand them. Kindly
I already have told you and gave the link on how manage staticfiles. Here's doc on deployment as well https://docs.djangoproject.com/en/3.2/howto/static-files/deployment/
игорь/igor
can anyone have logic for this..? thanks in advance
It looks like graph, as a data structure I mean. You could create a class for that and use it to generate whatever you want. class MyGraph: def __init__(self, edges=[]): self.gdict = {} if len(edges)!=0: for e in edges: self.add_edge(e.device_mac_a, e.device_mac_b): def add_edge(self, vertex1, vertex2): if vertex1 in self.gdict: self.gdict[vertex1].append(vertex2) else: self.gdict[vertex1] = [vertex2] def whole_dict(self): result = {} for key, val in self.gdict.items(): if key in result.keys(): result[key] = list(set(result[key].extend(val))) else: result[key] = list(set(val)) for v in val: If v in result.keys(): result[v].append(key) else: result[v] = [key] return result devices = table.objects.all() graph = MyGraph(devices) graph.whole_dict() Sorry if it is overwhelming ;) it should work though
Almaz
Hello, everyone! Is there any other way to create password reset by django and don't allow less secure in Gmail and also don't write manually only one Gmail address?
HARILAL
hi,how to make filter in django admin.i have 2 models competition and prize..i want comepetions to be filtered in prize admin.models are given below..can anyone help me
HARILAL
class Competition(BaseModel): title = models.CharField(max_length=255)
HARILAL
class Prize(BaseModel): competition = models.ForeignKey('competition.Competition', on_delete=models.CASCADE)
игорь/igor
I need to store in dictionary
The result is dictionary
Owolabi
Is there a way I can integrate Google map to Django admin for tracking drivers location and movement on a chauffeur project? any help please.
꧁❦ I'm Farooq ❦꧂
Anonymous
is there a way to get all attributes of a Serializer field as json ?
Anonymous
Can you give an example
here https://dpaste.org/B3oQ#L1
Anonymous
is there a way to get all attributes of a Serializer field as json ?
serialize("json", YourModel.objects.all())
Sanjay Krishnan
here https://dpaste.org/B3oQ#L1
You can access them using _meta in model object Modelname._meta.fields It will return a list of those fields, loop through them and use dict method to get the value you need
Ahmed
Got it, thanks
Anonymous
You can access them using _meta in model object Modelname._meta.fields It will return a list of those fields, loop through them and use dict method to get the value you need
there is already an attribute called serializer.fields that returns a dict of fields. what i'm talking about is the attributes inside each field.
Anonymous
like max_length, required, allow_blank
Sanjay Krishnan
like max_length, required, allow_blank
serializer.fields[name].max_length will work.. serializer.fields[name].__dict__ To access all attributes of that field
pat
Simple questions guyz.. I'm trying to connect signals to channels.. To I really need channels_layers to achieve it?
Mansi
I want to connect django to SQL server. Then where should I create the table in models.py OR create tables in SQL server and utilise them in django?
Mansi
Want to connect to MS SQL server. Does it works for that too?
pat
Want to connect to MS SQL server. Does it works for that too?
Oh you want to go from sqlite to ms sql? Never done that sorry can't help you but look on google
M
Hello. Im trying to debug locally websocket in django python but cannot get server logs. I can see them on heroku but not locally. Anyone have any idea how i can get debug logs of websocket?
Tiago
I'm having trouble updating on django
Tiago
Can someone help me?
Saurav
SC?
Doragonsureiyā
Can someone help me?
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z!" Just ask directly! The better you are at explaining the problem, the more likely you are to get help. Asking smart questions
Tiago
ok
Tiago
my update dynamic object passing param Model = apps.get_model('spread_sheet', camel_case(sheet)) update = Model.objects.filter(id=data['id'])
kuzmich
Hey there guys! I got a server running on gunicorn and there is cloudflare as proxy I started facing CORS error when there are around 10 async requests and the page gets reloaded less than a sec It can happen when those 10 requests are sent several times ANY HELP APPRECIATED UPD: I found this in response headers on those requests that failed: expires: Thu, 01 Jan 1970 00:00:01 GMT
JavinP
Can someone please suggest a book that explains how to handle transactions and OAuth2 in Django?
Anonymous
Hi everyone! I require info on how NDArrayField is used, specifically how it can be saved in the Postgres database using forms.ModelForm, I already did it using the form.save () but I get the following error: ValueError: Cannot load file containing pickled data when allow_pickle=False. PLEASE ADVICE. THX!
Jerome
Want to connect to MS SQL server. Does it works for that too?
Django knows SQL so yes , you won't see any difference
Amir
Hi guys. What is the difference between TestCase and SimpleTestCase? In test writing
JavinP
What kind of transactions? Db transactions?
Yes, I mean from a django request handler perspective (not from sql perspective).
игорь/igor
Yes, I mean from a django request handler perspective (not from sql perspective).
Have you looked up docs? https://docs.djangoproject.com/en/3.2/topics/db/transactions/
HamidReza Fekri
hello , I'm learning django and my second project is e-commerce web app i finish product app and customer but I have no idea about order app how to write views in this app i hope someone can recommend me good source to study about it and also i want to use class view for this
Anonymous
guys is it ok for clients to use the django admin interface ?
Sanjay Krishnan
guys is it ok for clients to use the django admin interface ?
Just restrict access to updation of models that could break the system 😂
Anonymous
Just restrict access to updation of models that could break the system 😂
i saw a video that said to only use this interface for development.
Anonymous
i don't see why though
Gordrick
Is there a way I can integrate Google map to Django admin for tracking drivers location and movement on a chauffeur project? any help please.
Do you have tracking devices sending device locations to your Django app already (Streaming longitude and latitude that is)
Anonymous
I need help to establish real time communication with help ot aiortc.
Charly
I need help to establish real time communication with help ot aiortc.
that doesn't say much to be able to help you
Wizuba
Hi is there a django's roadmap ?
Joel
Hi, does anyone know how to handle the aggregate "_id" that django does automatically in its primary keys, what happens is that I am working with an already established database, its tables have the id field and the foreign ones id_table1 And when I want to call objects.select_related (id_table1) I get an error that the name id_table1_id is not valid, since django adds it automatically Does anyone know how to control that aggregate, or how to make django skip that in the DB Thanks in advance