Real
hello guys
both of these 2 automatically update the fields after save()
i want to update just "updated_at" everytime.
created_at = models.DateField(auto_now_add=True)
updated_at = models.DateField(auto_now=True)
...
...
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
I think this which is the same as what you posted should work fine
...
the auto_now will updated each time there is a change to that model element, while the auto_now_add will only update when the model element is created
Real
Muhammed
##view code
all_data = {
'a' :[1,2,3,4],
'b' :[5,2,8,4],
'c' :[3,9,3,4],
'd' :[1,7,5,4]
}
return render(request, 'Warranty_report.html', {'all_data':all_data})
##Template code
<table border="1">
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
{% for i in all_data %}
<tr>
<td>{{i.a}}</td>
<td>{{i.b}}</td>
<td>{{i.c}}</td>
<td>{{i.d}}</td>
</tr>
{% endfor %}
</table>
Muhammed
Please help me
Anonymous
##view code
all_data = {
'a' :[1,2,3,4],
'b' :[5,2,8,4],
'c' :[3,9,3,4],
'd' :[1,7,5,4]
}
return render(request, 'Warranty_report.html', {'all_data':all_data})
##Template code
<table border="1">
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
{% for i in all_data %}
<tr>
<td>{{i.a}}</td>
<td>{{i.b}}</td>
<td>{{i.c}}</td>
<td>{{i.d}}</td>
</tr>
{% endfor %}
</table>
what's your problem?
Anonymous
Muhammed
Amir
Please tell me how do I do
context ={
"all_data": all_data
}
return render(request, 'Warranty_report.html', context=context)
Amir
Muhammed
Amir
Anonymous
I want to create a table with data a, b, c, d
context = {
'a':[1,2,3,4],
'b':[7,8,9,0],
...
}
🤔🤔
Anonymous
I want to create a table with data a, b, c, d
<table border="1">
<tr>
<th>a</th>
</tr>
{% for i in a %}
<tr>
<td>{{i}}</td>
</tr>
{% endfor %}
<tr>
<th>b</th>
</tr>
{% for i in b %}
<tr>
<td>{{i}}</td>
</tr>
{% endfor %}
</table>
try it and then change it the way you want
I think there is a problem with your template
Muhammed
Muhammed
Anonymous
kasim >
Anonymous
Is this proper way?
I do not know much
I changed his code to answer
It may need to be nested for
kasim >
{% my_tag %}
<table class="table">
{% for chunk in lst|chunks:4 %}
<tr>
{% for x in chunk %}
<td> {{ x }} </td>
{% endfor %}
</tr>
{% endfor %}
</table>
Anonymous
kasim >
Me too new to django😂
Maan
how to use kafka in python
Maan
can anyone suggest me how to connect database with kafka
Maan
in django
ADI
i ma creating project major project title name is COLLEGE RATING i ma getting the error mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\akuma\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\akuma\desktop\vsu\College_rating\College_rating\settings.py", line 141, in <module>
STATIC_ROOT = BASE_DIR / "staticfiles"
TypeError: unsupported operand type(s) for /: 'str' and 'str'
ADI
plese give me any instraction when i deploy project heroku it showing error
Mirco
i ma creating project major project title name is COLLEGE RATING i ma getting the error mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\akuma\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\akuma\desktop\vsu\College_rating\College_rating\settings.py", line 141, in <module>
STATIC_ROOT = BASE_DIR / "staticfiles"
TypeError: unsupported operand type(s) for /: 'str' and 'str'
which Django version are u using ?
BASE_DIR must be a Pathlib's Path and not a str
ADI
3.0
ADI
like which format
ADI
tq ..workinh
ADI
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
ADI
i am getting this one
Hardik
Hello
I want to know that how to add multi bar graph with the help of
django-admin-charts
ADI
plese help me
Muhammed
Anonymous
Tell me if it is possible or not??
I am building a social media website like I Instagram I want to send real-time notifications to user like when other user like you post etc ..
Can a use Django channels and send a web push notifications to user
But how can I integrate django channels for whole I have implemented it for chating (for chating route ONLY /chats)
can I use same for whole website for all routes
Vinod
If anyone wanted to clear interview in python and django in near by bengalore please reach me oit
Shourya
!paste
Doragonsureiyā
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like:
- https://del.dog
- https://dpaste.org
- https://linkode.org
- https://hastebin.com
- https://bin.kv2.dev
If you posted a wall of text, go back and delete it.
Sherry
How to create excel reports with Django
Frederic
Hello, Do you know an english speaking group where I can ask questions about django-oscar ?
Charly
Shukurillo
Hello, is it possible to use django with vue.js or something like that
Michael the wolf 🐺
yes
Michael the wolf 🐺
for api's look into diango rest framework.
Frederic
Shukurillo
Frederic
I'd like to model sale of products by weight and measures. So for example a butcher would price chicken by kilo but sell it by piece and the final price would depends on the actual chicken weight. How would you do this with Django-oscar ?
Vanita
hello...anybody can help me to design the form in a correct way as am new to django..TIA
Ray of Hope
Vanita
signup form
Anonymous
signup form
This can help you in a good and simple way!
https://www.youtube.com/watch?v=Ev5xgwndmfc
Pharell
Good evening dev
I filled a table on my template with ajax code and I checked checkboxes in my table. I want to be able to write a code to save that the checked rows in my views.py in my database
Need help. Thanks in advance
h
Hello everyone,
Hope you are doing great, I need a small help.
What I'm planning to do is from the url query parameter I'm trying to get the data and filter it through my database and then represent the value
"/api/users?page=1&limit=10&name=James&sort=-age"
but I'm confused on how to write this query parameter in urls file, how can a user enter these value in url?
Please do help me out
Thanks
Hitesh
Charly
VISHNU
I am using background-task for sync and everything works fine but this module appears in admin panel side bar how to remove it from their.
h
I guess i have to use mixin, but i'm confused on how to proceed with that.
_karimoff_1904
If i want to deploy my django app do i needto install whitenoise
Mirco
_karimoff_1904
Up to u
If i dont install it does my site works with static
Anonymous
Any one know about save the video capture by opencv
Doragonsureiyā
Any one know about save the video capture by opencv
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 first results
Mr
How to make a chatbot using Django or GUI plz help me
Rishu
Check google from more info
Caesar
Good afternoon. Are there any alternatives for using the periodic_task decorator in django_huey, the function must take arguments, but the doc says that functions wrapped by this decorator should not take arguments, are there any alternatives for this?
Sergey
Hello everybody, I have Image field, and serializer give full url to it, but i want to have just relative one. How to manage it?
Anonymous
i don't remember the right syntaxes but you need to add , {context....} at the end of the field
Anonymous
i had the same problem and that's how i solved it
Anonymous
when u call ur serializer in the view