MG
yeah, this is working
PV
Sendgrid SMTP return connection refused error at python anywhere
Mirco
👍🏻
Jimmies San
👍🏻
oh many thanks mate. it's so hard to read the answers on google! thank you again! legend !!1111
Aswath
i have a doubt here
Aswath
i have a model that needs to be a one to one field to the user and initially not point to any user. How might i go about implementing this ?
Aswath
Anyone have any suggestions ?
Aswath
Yeah jus tried it now.
Aswath
Thanks
Doragonsureiyā
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
.
Select * from ( Select distinct on (id) Name Email From User ) as list_of_output Order by list_of_output.name How to write a query like this in django orm?
cj
Select * from ( Select distinct on (id) Name Email From User ) as list_of_output Order by list_of_output.name How to write a query like this in django orm?
what have you tried so far? because that looks like a simple list_output = User.objects.order_by("name").distinct("id")
cj
but, you don't really need to make .distinct("id") as it's a primary key, it won't be repeated
cj
so you just need to order the users by their "name"
Alejandro
MemoryError at /api/send_message/ Cannot allocate write+execute memory for ffi.callback().
Alejandro
????
cj
what have you tried so far? because that looks like a simple list_output = User.objects.order_by("name").distinct("id")
ah, I forgot, if you want to "select" only name and email, just add .values("name", "email") to the queryset (or .values_list, depending on how you want to get the output format)
.
Select * from ( Select distinct on (id) Name Email From User ) as list_of_output Order by list_of_output.name How to write a query like this in django orm?
this inner query was just an example.It is actually a join of two table. This join gives me duplicate items.
cj
this inner query was just an example.It is actually a join of two table. This join gives me duplicate items.
🤷🏻‍♂️ well, I don't read minds, so I don't know your actual real case 🤷🏻‍♂️
.
thats why i want to add distinct on id and add order by name
cj
I gave you a solution based on the question you asked, if you expect people to read your mind, well... IDK what to tell you
Doragonsureiyā
MemoryError at /api/send_message/ Cannot allocate write+execute memory for ffi.callback().
Read this please: http://www.catb.org/~esr/faqs/smart-questions.html
.
what have you tried so far? because that looks like a simple list_output = User.objects.order_by("name").distinct("id")
You cant have order_by and distinct on different fields. It raises "SELECT DISTINCT ON expressions must match initial ORDER BY expressions"
Alejandro
when they use the pusher library they have had this error: Cannot allocate write+execute memory for ffi.callback()
Alejandro
??
Dhruva
Can someone help me with SEO optimization in the django website
Anonymous
how integrate 2fa (2 factor authentication) using twilio guys
Cesar
how integrate 2fa (2 factor authentication) using twilio guys
I really don't get why you can't use Google/duck.com This is literally the first result searching for 2fa Django twilio https://www.twilio.com/docs/authy/quickstart/two-factor-authentication-python-django
Jimmies San
@c0x6A i never remember how to use bot to ban people
Jimmies San
done. manually.
cj
@c0x6A i never remember how to use bot to ban people
reply to a message with: /ban some reason
cj
or /warn some reason to just warn
Jimmies San
Hari
Hi @ceterre i want to learn python any best source
Hari
Can you share links here Dennis
Hari
Or pm me
Dcruz
Can you share links here Dennis
https://www.google.com/url?sa=t&source=web&rct=j&url=https://docs.python.org/3/tutorial/&ved=2ahUKEwiIxMGVlZvnAhXttlkKHd76CBwQFjAAegQIAhAB&usg=AOvVaw1b8TtAqPMZM1ZRY6D8V-hW
Hari
How to write test cases in python?
Cesar
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Cesar
I personally liked django-girls
Ashlah
https://django.fun/docs/en/3.0/intro/tutorial01/
Is this new (and perhaps maintained by django's core developer)? The design looks similar with djangoproject.com
Anonymous
Guy's recommend me a best editor for development of django projects, I used pycharm all the things worked fine but after some days it crashes my front-end template, backend remains good but frontend disturbed How to fix this...?
Aditya
Sublime text
Dhruva
Rollyourownseo is not supported in latest one
Anonymous
Hello my friends. I want to create project with authentication and authorization. There will be to user types, student and teacher. Do you some tutorials where presented smth like this “login -> if student logged opened student page, same with teacher. May be someone had experience in this? Thank you 😊
Anonymous
Thank you, cj
S
How to add music media in django like pictures Can anybody tell??
Bjorn
How to add music media in django like pictures Can anybody tell??
Filefield should work ... Idk about any other specific field type that might exist.
Anonymous
Pycharm should not break front/backend... Maybe you accidentally deleted a CSS/js dependency
I close my working project last night, And When I again run the project at morning It was crashed it's frontend
Sh
Assalamu Alaykum friends. Who has clean open source project under drf, for learning purpose?
enansi
Hi, all for automating the deployment of my Django project, is it best practice to keep an "ansible/" folder in in my project? or should I keep ansible as a separte project in Git?
Alex
*for example
enansi
I had to keep, because you can use it to preprocess settings
So is it an /ansible directory in your project root?
Alex
So is it an /ansible directory in your project root?
yes, or I may put it in /deployment
Alex
matter of taste
Alex
imho
PV
http://dpaste.com/3JJVW5P
PV
ConnectionRefusedError at /app/accounts/register/ [Errno 111] Connection refused
PV
On registration, i am using send grid smtp
V
Hello to all I have a problem posting json data and using FormView. I Made dirty hack, but maybe i just do something wrong. Please help. Problem if i make fetch from js and using Content-type:json and send body: json.stringify(data) then django FormView not see this data. I fixed this extend base class and add some condition for this situation. Code Example below class MyFormView(FormView): def get_form_kwargs(self): """Return the keyword arguments for instantiating the form.""" kwargs = { 'initial': self.get_initial(), 'prefix': self.get_prefix(), } if self.request.method in ('POST', 'PUT'): print(self.request.POST) if len(self.request.POST.keys())>0: kwargs.update({ 'data': self.request.POST, 'files': self.request.FILES, }) else: print("here") try: kwargs.update({ 'data': json.loads(self.request.body), 'files': self.request.FILES, }) except: print("error") print (self.request.body) return kwargs
V
Maybe theres some "Django way " to do this. Please help
V
js code like this let data = { login: el.closest("form").querySelector("input[name=login]").value, password: el.closest("form").querySelector("input[name=password]").value } console.log(data); let response = await fetch(url, { method: 'POST', body: JSON.stringify(data), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRFToken': csrftoken, "X-Requested-With": "XMLHttpRequest" } }); if (response.ok) { let json = await response.json(); console.log(json) } else { console.log(el) el.closest("form").querySelector(".form_error").style.display = "block"; el.closest("form").querySelector(".form_error").innerHTML = error_html; console.log(el.closest("form").querySelector(".form_error")); }
Alex
Maybe theres some "Django way " to do this. Please help
start from "python way" and post your code on, like, pastebin
Alex
my eyes are bleeding