Anonymous
checl your urlpatterns
url(r'^leave/(?P<leave_id>\d+)/$', views.leave, name='leave'), here it is and in my template its href="{% url 'leave' leave.id %}
Владимир
Please help me, I won't blocked remove record in Django admin, one record, field one record is_default
Anonymous
what is the difference between foreign key and foreign object in django model fields?
✙Yaroslav
Hi. How to set the parameters with the help of crontab so that the function works every 2am? Crontab in celery.
Isaías
Hello
Isaías
Help.
Isaías
File "/usr/local/lib/python3.6/site-packages/kombu/transport/__init__.py", line 68, in resolve_transport raise KeyError('No such transport: {0}'.format(transport)) KeyError: 'No such transport: '
Isaías
celery -A core worker -l info -B
Isaías
django 3
Isaías
Python 3.8
Isaías
Celery 4.2.0
Isaías
Redis
✙Yaroslav
I use selery. I want the task to run every 2 am. For a test, to check that this works, I try to indicate the nearest time that will come for the function to work. But the trouble is, it doesn't work anyway. I'm trying this type of '' '@periodic_task (run_every = crontab (hour = 0, minute = 14), name =' parse_data ')' ''. What parameters should be specified in crontab for the task to work, for example, at 00.23.? If it works out, then I think you can easily do it so that it works at 2 am.
Random
How to secure file uploads
Random
I mean What things i have to take care of
Random
For security
Anonymous
Hello developers, How best can I save videos in Django help will be appreciated
Knight
Hi all~ Is this the right way of getting the latest record of each users? My_model.objects.filter(user__in=['user1', 'user2', 'user3']).latest('created_at')
Eliab
Hi everyone! I'm beginning in Django. Someone know how to download css to the folder of the project?
Knight
You could also use My_Model.objects.last()
It just gets the latest record. Not each users' record. Or am I wrong?
Brian
It just gets the latest record. Not each users' record. Or am I wrong?
You're correct. Just the last one... Isn't that what you're trying to achieve?
Brian
I have to get the latest record of each user
Do as you had stated initially. ... That Will work
Knight
Do as you had stated initially. ... That Will work
Dont know why, but its not working
Brian
Where do you get the 'created at'? Do .latest() at the end of the query... No need for the field
Brian
created at
Ferrum
hi i tried to extend the django index template i wanted to display a metric of the total number of users registered but im having issues on how to access the User model from the extended template so i can work with it i have tried {{User}} and {% for users in User %} {{users}} no luck please help
Ferrum
Send the users data from context
the template is not connected to a personal view since its a django admin template
S Karim
And try looping like yourapp.model
Ferrum
extend base_site.html in index.html
base_site is already extended in the index.html and i have extended index in my own template
Ferrum
And try looping like yourapp.model
i have tried this no luck
King__David
Hi everyone! I'm beginning in Django. Someone know how to download css to the folder of the project?
Open Static folder, and put .css, .js files there, then link with the link in the template
Sh
Assalamu alaikum. There was model with 3 fields. after sometimes I want to add new column. I should set default value according to 3 fields for past records, how to make?
Mehmet
You can set temporary default while makemigration operation or add parameter default=value in field to set permanent default for the column.
Sh
You can set temporary default while makemigration operation or add parameter default=value in field to set permanent default for the column.
class Field(): name = Text() surname = Text() full_name = Text()// new column I want to set default for fullname = name+surname
Sh
I want to make like that
Mehmet
class Field(): name = Text() surname = Text() full_name = Text()// new column I want to set default for fullname = name+surname
Is this a pseudocode? That is neither Model nor Field subclass. That is not a Db processable default expression. You should override Model save method to handle that.
Sh
I wrote to explain more clearly, sorry
Mehmet
Like below def save(self, *args, **kwargs): self.full_name = f"{self.name} {self.surname}" super(Model, self).save(*args, **kwargs)
Mehmet
Like below def save(self, *args, **kwargs): self.full_name = f"{self.name} {self.surname}" super(Model, self).save(*args, **kwargs)
Of course, if there is a bulk create operation, you should follow a different approach, such as post update after bulk creation with Django F expressions. Because save hook run only on single object creation.
Mehmet
You mean save function does run while migrating?
Do you use the bulk_create function of any model anywhere?
Mehmet
Then there is not any problem for now. bulk_create function does not run save hook of the object. I mean you should find a manual way to update full_name= name + surname after calling bulk_create
Anonymous
how can i set a condition to check if a user is eligible for something e.g he/she needs to be an employee for more than a yr to submit a form..if not the form wont be submitted
devops
Anyone knows about bash profile file
devops
Can u help me
devops
Can anyone help
Doragonsureiyā
Anyone knows about bash profile file
Please don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello I need help on $z" Just ask about your problem directly! With a very high amount of people here the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Anonymous
Write the login, have timestamp for employ assignments date, compare current date....
tried comparing and got thie error '<=' not supported between instances of 'datetime.timedelta' and 'int'
Ghorz
https://stackoverflow.com/questions/7852855/in-python-how-do-you-convert-a-datetime-object-to-seconds#7852969
Anonymous
Logic* Convert datetime to timestamps in seconds
if i import datetime how do i only get the date today in YY-MM-DD format?
Engnr
{'requestId': '15984273213672496', 'requestTimeStamp': '2020-08-26 10:35:21', 'channel': 'SMS', 'operation': 'DeliveryReceipt', 'traceID': '38$11337131336213862', 'requestParam': {'data': [{'name': 'Msisdn', 'value': '25XXXXXXX'}, {'name': 'CpId', 'value': '1002'}, {'name': 'correlatorId', 'value': '2582987'}, {'name': 'Description', 'value': 'DeliveredToTerminal'}, {'name': 'deliveryStatus', 'value': '0'}, {'name': 'Type', 'value': 'DELIVER_RECEIPT(Bulk)'}, {'name': 'campaignId', 'value': '8'}]}}
Ghorz
if i import datetime how do i only get the date today in YY-MM-DD format?
https://stackoverflow.com/questions/7852855/in-python-how-do-you-convert-a-datetime-object-to-seconds#7852969
Ghorz
Same thing, apply the logic
Anonymous
Same thing, apply the logic
and is the condition written in veiws.py or forms.py?
Ghorz
how do i access it
Read throuthe data structure, apply dict[]
Ghorz
If you don't know how to go about it, take a refresher on dict
محمد دلشاد
Help me with this ERROR: Could not find a version that satisfies the requirement requirements.txt (from versions: none) ERROR: No matching distribution found for requirements.txt
Mehmet
pip install -r requirements.txt You have forgotten -r there.
محمد دلشاد
another one