Mirco
Maksim
Muflone
https://link.medium.com/phObFKdU6X
Muflone
Tutorial for beginners for Django and DRF and React
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
???
Anders (izzno / gooood) 🇳🇴
Just find any vue tutorial using an api...
Ghorz
SELECT id, time, idate, istatus, location, active FROM consignment_timeline, consignment_people, consignment_consignment WHERE consignment_people.track_number = 'EB237CDEBE6A466' AND consignment_consignment.people_id = 'EB237CDEBE6A466'
withe the above raw sql, i got what i wanted but how do i translate it to django
Sendi
Anders (izzno / gooood) 🇳🇴
I love python...
https://pastebin.com/nBaryszA
@pyflare You can pass the request object to the serializer creating the full URL :)
picture:
https://imgur.com/PipqJS5
Ghorz
?
https://dpaste.de/DiNf
i had difficulty calling objects.consignment.timeline in my template, it returns consignment.Timeline.None
Anonymous
How to refresh token using djoser? Djoser seems not to provide endpoint for this
Mirco
Borys
Hi, my colleagues, I'm new to Django, I'm very interested and I'd like you to recommend a good tutorial
I thank you in advance.
And they help me solve an issue. Which is better to develop in Django. VSCode or pycharm?
tom
inchidi
inchidi
Doragonsureiyā
Akash
How can I make my DecimalField return normalized value:
DecimalField(max_digits=14, decimal_places=8)
10 if value is 10.00
10.25 if value is 10.2500000
10.2575 if valus is 10.2575
Maxim Cheremisov
Hey guys!
How can i colorize built-in django code in HTML template in {{, {% ...?
Maxim Cheremisov
Because now i have just grey characters
El
Maxim Cheremisov
PyCharm
Maxim Cheremisov
El
install a theme for PyCharm
Anonymous
Akash
round()
How will you use round for this?
I don't want to round the output, I want to normalise it... Only truncate unnecessary 0 and clean decimal place if it's just .00
Output can have 1 to 8 decimal places without rounding
Anonymous
from decimal import Decimal
def normalize_number(number):
if number.is_integer():
number = int(number)
return number
else:
number = Decimal(str(number)).normalize()
return number
Anonymous
what about this?
Anonymous
@Ak4zh did you try my code? I think it works.
Shubham
hello how to serlialize the queryset manually
Shubham
?
Shubham
def list(self, request):
qs = self.get_queryset()
res = {
"q": qs
}
# print(dir(self))
print("custom list", qs)
return Response(qs)
Shubham
I want attrib of qs in res dict
Shubham
print("custom list", qs) —->custom list <QuerySet [<User: shubham>, <User: Shubh>]>
Yash Patel
I want to create redirect to login page if session is not exist at index else goto index soo please suggest me any session checking and redirecting code..
Anders (izzno / gooood) 🇳🇴
inchidi
I did?
no, you didnt. you override get_permissions() instead
Anders (izzno / gooood) 🇳🇴
no, you didnt. you override get_permissions() instead
Ah, I'm not sure why I did that, I remember having some issues because the serialization of one and many are different, but could be unrelated. I'll change it and see 👌
Anders (izzno / gooood) 🇳🇴
Or maybe I thought you had to...
inchidi
inchidi
like
inchidi
Language:
py3
Source:
foo=True
bar=False
a=(foo|bar)
b=(foo|bar,)
print(type(a))
print(type(b))
Result:
<class 'bool'>
<class 'tuple'>
Anders (izzno / gooood) 🇳🇴
I'm sure it would warn me it expected a tuple, and then I'd cought that. My other serializers are Modelserializers, there I set the property and don't override, the drf example of viewset overrides methods and does not set properties.
inchidi
inchidi
huehue
Anders (izzno / gooood) 🇳🇴
"The ViewSet class inherits from APIView. You can use any of the standard attributes such as permission_classes, authentication_classesin order to control the API policy on the viewset."
Even says so in the doc. Then I dunno 🤫, I don't always remember
Pavel
hello
how to change the input field, with type = select, to text?
this is real?
Anders (izzno / gooood) 🇳🇴
example: https://pastebin.com/nBaryszA
Anders (izzno / gooood) 🇳🇴
@Inchidi Did not have to be a tuple
inchidi
Anders (izzno / gooood) 🇳🇴
Do you ise inmutables where ever you can ?
inchidi
Anders (izzno / gooood) 🇳🇴
huh... I did not know that... I usually stick to the defacto std examples... Unless I am very familier with the subject.
Mirco
Anders (izzno / gooood) 🇳🇴
Anonymous
Somebody here passed django or python test on upwork?
Syed Jafer
Any sample codes for django infinite scroll ?
Anonymous
I want to create registration page after registration user redirect to login.how can I do this with Django without using default user
Anonymous
Please let me know if anyone knows about this
Mirco
👍
It's so easy to make syntax error especially when tuple has just one item and you forget the trailing comma
Anders (izzno / gooood) 🇳🇴
Mirco
Anks
Best channel on YouTube for django?
Anonymous
The net ninjas are a good resource too
Anks
In YouTube?
Anonymous
r0b0t
Hey guys. I'm trying to create a dependent select whereby if I choose a country, cities are automatically loaded. I've been able to populate the cities via ajax but when I submit the form it is invalid.
Here is the link to forms.py: https://gist.github.com/r0b0tt/68f288004f8eb319f0bcd7ef438d21da
Here is the link to my view: https://gist.github.com/r0b0tt/64399a4b28bc04b276f1c17ff575a4c3
I cannot figure out where the problem is. Can someone please help me
Anonymous
Borys
Thanks Paul
Anonymous
Anonymous
Maxim Cheremisov
Hello everyone!