Firdaus
Most do try to read the documentation. But sometimes it is very hard understand. Most of the time it is not about technical understanding, but the language itself.
When I first learn English, it looks weird to me. Things that I see as A-B-C, in English it is explained as B-C-A. Something like active/passive, transitive/non-transitive.
So I totally understand for newbies asking for other source besides the official guide. Especially those looking for video-based tutorial.
Suren
hi everybody, please let me know how can I iterate string in django templates? I want automatically to add <li> tag to each string. Instead I am able only to do it for each char
{% for string in tour.price_includes %}
<li>{{ string }}</li>
{% endfor %}
ㅤ
Suren
if I do this way <li>{{ tour.price_includes }}</li> - it will add only one <li> tag to whole text.
If I do it like in my sample:
{% for string in tour.price_includes %}
<li>{{ string }}</li>
{% endfor %}
It is going to iterate each char from the text. So the question it how to iterate by string
Cyeloth
Suren
Cyeloth
Cyeloth
like for price_include in MyModel...:
price_list.append(price_include)
return render(request, YourHtml, {
'price_list' : price_list
})
in your html:
{% for price in price_list %}
<li> {{price}} </li>
{% endfor %}
Suren
Dima
Hello every one
I have auto-generate javaScript file and its name follow the pattern like this: mane.longHash.js
so my question is how I can connect this file in my templates/index.html?
I know only how to connect static files like this:
{% load static %}
<script src="{% static "frontend/main.js" %}"></script>
W
W
check this way and let me know
Deise Freire
Please, I need a kind person to help me, I have no idea why this project does not run, the login image would have to appear, but nothing appears. I'm desperate.
https://replit.com/@DeiseF/experiencein-v2
I want to leave this screen https://69c4c8e0-13da-4ac1-8e9c-dbeaae42e1a6.id.repl.co/perfis/ and the image of a login appears
.
Mohamad
friends, how can I add a checkbox to the model?
-
I'm trying to use a custom font in my Django app.
Here are the relevant lines from my base.html:
<link href="{% static '/css/styles.css' %}" rel="stylesheet"/>
Here are my relevant lines from the css file:
@font-face {
font-family: myFirstFont;
src: url("css/alfont_com_AlHurra-Font-Regular-2.ttf") format("truetype");
}
My CSS is working except for the font. What steps am I missing to get this working?
Vikash
Getting error
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Vikash
data1 = json.dumps(data) data2 = ("format=json&data=" + data1) print(data2) response = requests.post(url=settings.DELHIVERY["URLS"]["order_creation"], headers=headers, json=data1)
Rami
Hello! Does anyone know how to test celery tasks without the message broker? I am using unittest
Mirco
Pablo E
Hlello !! ,How I make mock test in Django App
Pablo E
Krunal
I am developing e-commerce application with Django rest framework. I want to send email notification on food category for different condition. I might need to send email notification in future for other categories. What is the best approach to develop functionality that any future changes can be handled easily and less changes?
RKumar
Charly
Yes
So if we don't know these details we can't help you
Vamsi
Iam not able to install django
🅼🅸🆃🅷🆄
CODE:
class Solution:
def twoSum(self, nums, target):
for n in nums:
if (target - n) in nums:
return [nums.index(n), nums.index(target - n)]
Solution.twoSum([1,2,5,6,9,8], 11)
ERROR:
TypeError: Solution.twoSum() missing 1 required positional argument: 'target'
can anyone please explain why this error show
Charan Cherry
CODE:
class Solution:
def twoSum(self, nums, target):
for n in nums:
if (target - n) in nums:
return [nums.index(n), nums.index(target - n)]
Solution.twoSum([1,2,5,6,9,8], 11)
ERROR:
TypeError: Solution.twoSum() missing 1 required positional argument: 'target'
can anyone please explain why this error show
class Solution:
def twoSum(self, nums, target):
for n in nums:
if (target - n) in nums:
return [nums.index(n), nums.index(target - n)]
s1=Solution ()
result=s1.twoSum([1,2,5,6,9,8], 11)
print(result)
Final output:[1,4]
Mirco
CODE:
class Solution:
def twoSum(self, nums, target):
for n in nums:
if (target - n) in nums:
return [nums.index(n), nums.index(target - n)]
Solution.twoSum([1,2,5,6,9,8], 11)
ERROR:
TypeError: Solution.twoSum() missing 1 required positional argument: 'target'
can anyone please explain why this error show
1. Move to @python
2. Study python more and its standards, the methods must be written in Snake case and not camel case
Nazim
Wan
how to accses foreginkeys in request fungsion?
class boardingUser(models.Model):
name = models.CharField(null=True, max_length=25)
class Myrecipe(models.Model):
user = models.ForeignKey(boardingUser, on_delete=models.CASCADE, null=True)
category = models.CharField(null=True, max_length=20)
def __str__(self):
return '%s' % (self.user)
Vikash
How to add format=json&data= before json data in python
Samrah
I am getting "similar queries" according to the debug tool. These are my models: https://pastebin.com/qCMypxwz
Samrah
Suryo Adhy Chandra
Hello... i wanna ask a question about push my project to heroku via cli
after i push my project, it said success.
but after i see the logs of heroku, there is some message errors
Suryo Adhy Chandra
2022-11-14T08:56:19.411276+00:00 heroku[web.1]: State changed from starting to crashed
2022-11-14T08:56:20.961054+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=tokokuon.herokuapp.com request_id=3281d307-83c4-4d79-98fa-660e40db76e7 fwd="36.80.211.14" dyno= connect= service= status=503 bytes= protocol=https
2022-11-14T08:56:21.352988+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=tokokuon.herokuapp.com request_id=3cdebdb3-e0f2-4cd5-82e6-aba2c985c028 fwd="36.80.211.14" dyno= connect= service= status=503 bytes= protocol=https
this is my error.
Suryo Adhy Chandra
thanks for your help before
Samrah
Suryo Adhy Chandra
Suryo Adhy Chandra
how max size?
i mean how many maximum size the project?
.
Hello guys i wanna learn django rest freamwork so i need a good source to learn from
Prosto
Hello djangers! Hope someone have an experience with translations. So, I have 2 languages, and I need to add 3rd. if I'll do makemessages, and the compilemessages will it erase my previous translations?
IDK
It shouldnt erase because makemessage adds not existing messages so if some message already translated then it wouldnt erase until you manually overwrite
Prosto
IDK
ofc
Coder
Has anyone had issues with static files when uploading a django project to the beget server?
Tolga
hey ı am trying to do hospital managment but ı got confused ı made the custom user model this one but ı dont know is it right can you help me ? https://dpaste.org/VYE5F
Kaleb
Is there anyone worked on an appointment application?
Kaleb
Like i want to parse string time to save as a time object in database but i'm confused
Pooya
Hello guys, please help me with this:
How can I make a queue for users to wait when the earlier user finishes the views.py process?
Faraaz
Hello Guys! Can any one help me with this error?
RuntimeError at /signup
You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/signup/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Mirco
Faraaz
Thanks bro
talha
do I have to use collectstatic everytime to update static files to the aimed directory that I wrote in STATIC_ROOT I am using apache
Mirco
talha
Mirco
Naga Rajan
django.core.exceptions.ImproperlyConfigured: "^SnippetViewSet\.(?P<format>[a-z0-9]+)/?\.(?P<format>[a-z0-9]+)/?$" is not a valid regular expression: redefinition of group name 'format' as group 2; was group 1 at position 46
i got above error when using routers
any one help me to solve this
Naga Rajan
and any one give usage of simple routers in drf
Co
Hi , I need help
My project can't load css from static file
In layout I used {% load static %}
А
django.db.utils.IntegrityError: The row in table 'women_women' with primary key '1' has an invalid foreign key: women_women.user_id contains a value '1' that does not have a corresponding value in auth_user.id.
А
Hi, i need help
А
How to solve a problem?
lilobaje
How to send email (Gmail) Django..any new alternative?
Роман
Hi, all!
I try
u = User.objects.last()
u.is_stuff = True
u.save()
u.refresh_from_db()
u.is_stuff
and i got False
what am i doing wrong?
Jay
Can anyone send me reference for how to upload multiple images in 1 post request in DRF using manytomany relationship
👑 Dharmzeey
👑 Dharmzeey