cj
how to take avg of max in a sql table
Nitesh. Here you have a useful link: https://duckduckgo.com/?q=how+to+take+avg+of+max+in+a+sql+table
Anonymous
How to write custom decorator
cj
How to write custom decorator
Kgf. Here you have a useful link: https://duckduckgo.com/?q=How+to+write+custom+decorator
Muflone
How to find answers without a search engine?
cj
How to find answers without a search engine?
Muflone. Here you have a useful link: https://duckduckgo.com/?q=How+to+find+answers+without+a+search+engine%3F
cj
🤣
Anonymous
Links for creating a Custom Django User Model please
Anonymous
isn't your Google working, sir?
I have googled and watched a lot of tutorial but i was guessing that may be some of y'all can recommend best blog or post about that Anyway thanks ☺️☺️
cj
nvm, take a look to: https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html (old but still gold)
Anonymous
🙏 thanks 😊
Felipe
Hey guys! Whats up?
Felipe
I'm with a little problem here
JZA
ctrl-alt-supr
Felipe
I created a field in the model that can only accept values between 0 and 100. To validate the input I created a validators.py file that checks if the number entered is within this range. By testing manually, by the admin, the validators are raising the ValidationError, but when trying to simulate the behavior in the automated tests it is not raising.
Felipe
Here's the code
Felipe
https://pastebin.com/2d4gMQWq
Felipe
Someone can help me to understand what I'm doing wrong?
Dmitrii
Dmitrii
Someone can help me to understand what I'm doing wrong?
i think it's better to use PositiveIntegerField in your case cause it'll resolve part of your issue. It'll check the negative values automatically.
Felipe
Thank you @dkovner
Felipe
It works on admin level, but not at db level. This is why the test is failing
Felipe
I'll try to change my approach
Dmitrii
u r welcome
Akash
is there any inbuilt way in django to get queryset count in K or M format if it's a big number? 10K instead of 10000
Anonymous
is there any inbuilt way in django to get queryset count in K or M format if it's a big number? 10K instead of 10000
just get count of numbers then add k when count is more than 999 then count every 3 number to add k
Mohmadhaider
How to build bot on WhatsApp
RIZWAN
+1
Mirco
How to build bot on WhatsApp
afaik you can't
Raghad
If any one know how to make test in django ??
Yegor
Just google it
Raghad
Ok thanks
Mirco
iNcAeLuM
Hi, I am trying to display a img depending of a filed of an objects, am trying to do this: {% for i in objects %} <img src="{% static 'myapp/images/{{ i.field }}.jpg' %}" alt="">
iNcAeLuM
no result
iNcAeLuM
any way to do this
iNcAeLuM
?
iNcAeLuM
iNcAeLuM
should i do : <img src="{{ i.field.url }}.jpg" alt="">
iNcAeLuM
is field ImageField()?
no is a charfiled
iNcAeLuM
is field ImageField()?
is a charfield and i want to display a img depending of the name of the charfield
Anonymous
oh I see
Anonymous
then you have to make <img src="{{ MEDIA_URL }}{{ i.field }}.jpg" alt=""> just pass MEDIA_URL in your render context
iNcAeLuM
then you have to make <img src="{{ MEDIA_URL }}{{ i.field }}.jpg" alt=""> just pass MEDIA_URL in your render context
my settins is config like this: MEDIA_URL = '/media/' shuld i pass MEDIA_URL or '/media/'?
Anonymous
my settins is config like this: MEDIA_URL = '/media/' shuld i pass MEDIA_URL or '/media/'?
or pass context = { "MEDIA_URL" : "yourdomain.com/path/to/image/folder/"}
Anonymous
H
Can someone provide me with django 2.2 books or tutorials
Bhupesh
Hey guys what is the best way to update M2M fields though views ?
Mohmadhaider
afaik you can't
You can explore gupshup They are working on the same
Mohmadhaider
Gupshup.io
Goutham
Hello how to pass queryset to template please help
inchidi
that dictionary you return with your response on your views
Macurrent
How is apache important for django users?
Yegor
no
Literally no
Bernard Kwey
please can someone help me with the how i can really create a comment template i tried the django documentations but i couldn't get my head around it.
Anonymous
Hey
Anonymous
M new here
Anonymous
Actually m beginner in Python
Anonymous
Could u guys plz guide me
Maz
Actually m beginner in Python
Tell you what...work with Python only for a month. And I mean REALLY work on it. Then come back and we'll give you pointers on Django.
Anonymous
Join @python
Already did
Mirco
Already did
That's your place 😊
أمجد☄
How can i add an expiration date function in a model that takes value from a multiple choices field for ex: 10 days, and when the date expires it would do some kind of action like turning a boolean into True ?
أمجد☄
Use an async_task that check date between start and end
Never heard of it, giving the code would save me alot of time of searching it up.
Mirco
Look for async task ( celery or django-q ) and python property into models
أمجد☄
Okay, thank you
Mirco
Okay, thank you
It's easy, don't worry