Doragonsureiyā
Sourabh
Example 29-04-2021 00:30 In models:- Models.DateTimeField() What i need to give for it takes the example?
Sourabh
Wt i need to write in datetimefield() Insdie?
Mirco
Wt i need to write in datetimefield() Insdie?
blank, null, help_text etc etc the usual model field attribute based on your needs
Sourabh
If i keep blank then its showing error while importing file
Sourabh
The error is Enter a valid date/time
kuzmich
The error is Enter a valid date/time
it expects ISO format I believe
kuzmich
The error is Enter a valid date/time
https://docs.djangoproject.com/en/3.2/ref/models/fields/#django.db.models.DateTimeField just read the docs
Sourabh
K
kuzmich
K
do you want this field to be an auto one?
kuzmich
do you want this field to be an auto one?
anyway, look at the iso format, try that out, it's gonna work
Sourabh
The error is Enter a valid date/time
I have a ccv file iam importing. While importing that error occuring
Sourabh
Csv*
kuzmich
I have a ccv file iam importing. While importing that error occuring
it's not enough for us, we're out of context
Sourabh
it's not enough for us, we're out of context
Kuzmich i have sent pic to u check it once plz
Mirco
If i keep blank then its showing error while importing file
so you should put blank=True if you wanna support blank
Sourabh
Ok let me try
Mirco
Ok let me try
you have to make migration and migrate as it's a model change
Sourabh
Ok
Sourabh
Not working..
Mirco
Not working..
it does not mean nothing
Mirco
if you don't explain better and share a bit of code via pastebin
Sourabh
Hmm
Mirco
blank=True tells Django form to allow blank input of that field
.
Hi guys. Anyone knows how to use celery for sending emails with djoser? I check source code, and it seems I need to override UserViewSet with perform_create and activation methods but it also requires to override djoser.urls.base. Any better ideas?
.
Registration also triggers sending activation email with SEND_ACTIVATION_EMAIL=True (what I use)
.
eh it sucks because u can specify overrided serializers in djoser settings but not views. And in this case i can only override viewset, not certain views and cant connect them to my app urls..(
Mirco
to change the behaviour
.
I must declare default router and connect it
Kashif
Anyone knows how to show this kind of data to table on HTML page <table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>sum</th> </tr> </thead> <tbody> <tr> <th>0</th> <td>1</td> </tr> <tr> <th>1</th> <td>1</td> </tr> <tr> <th>2</th> <td>1</td> </tr> <tr> <th>3</th> <td>1</td> </tr> <tr> <th>4</th> <td>1</td> </tr> <tr> <th>5</th> <td>3</td> </tr> <tr> <th>6</th> <td>4</td> </tr> </tbody> </table>
.
yeah but you can simply override its view and register to your endpoint into the urlspattern
But I dont understand why djoser defines User = get_user_model() in their urls (djoser.urls.base) And should I?
Mirco
.
Ok, thx.
pino@mastrobirraio ~$
hi guys, i'm using ModelViewSet of DRF. I've seen from the documentation that can be added custom actions to it in this way: @action(methods=['post'], detail=True, permission_classes=[IsAdminOrIsSelf], url_path='change-password', url_name='change_password') def set_password(self, request, pk=None): ... I need to add extra arguments to url_path in this way: ``` action/(?P<var1>[^/.]+>)/(?P<var2>[^/.]+>) ``` bet when i try to resolve the url with the reverse_lazy function i got this error: django.urls.exceptions.NoReverseMatch: Reverse for 'profile-change_password' with keyword arguments '{'var1': 'val1', 'var2': 'val2'}' not found. 1 pattern(s) tried: ['my-api/(?P<pk>[^/.]+)/action/(?P<var1>[^/.]+>)/(?P<var>[^/.]+>)/$'] what is wrong?
Harsh
Hey i need help i want to create todo list i am beginner
Harsh
Can anyone help
Kashif
Anyone knows how to show this kind of data to table on HTML page <table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>sum</th> </tr> </thead> <tbody> <tr> <th>0</th> <td>1</td> </tr> <tr> <th>1</th> <td>1</td> </tr> <tr> <th>2</th> <td>1</td> </tr> <tr> <th>3</th> <td>1</td> </tr> <tr> <th>4</th> <td>1</td> </tr> <tr> <th>5</th> <td>3</td> </tr> <tr> <th>6</th> <td>4</td> </tr> </tbody> </table>
Droll55
Hello everyone. I need some help. Cant understand how to render context in FormView, here is my code: https://dpaste.org/6TMa. I have set up get_context_data, but it is not rendering on my template. What i am making wrong and how can i fix it? Thanks!
sarth
how to pass drop-down values from other table by using query without using foreign key..
Droll55
What do you mean with not rendering ? The view looks fine, there's no other way to inject it
i have a description field in my model. Event host setting it with price, ticket type etc. So i would like to view description to user when he is on ticket_select page
Droll55
So user should understand the difference between ticket categorys (VIP, cheap etc. ) But now it renders only ticket_type. Another words, How can i add information anout tickets in ticket select page
Mirco
So user should understand the difference between ticket categorys (VIP, cheap etc. ) But now it renders only ticket_type. Another words, How can i add information anout tickets in ticket select page
The view code looks fine, share the template maybe it's there the issue Anyway you can check by yourself with a simple breakpoint() and check the context
Mirco
Here is a template https://dpaste.org/dqmL
First thing to check is: {{ ticket }} shows something ?
Mirco
If not it means that your query returns an empty queryset So it's faster to check inside the view the context before rendering
Droll55
Mirco
Yep it returns queryset with tickets
And description is a foreign key ? Or which kind of field is it ?
Droll55
Its a TextField
𝙴𝚍𝚞𝚊𝚛𝚍
How to fix the error (Class 'Task' has no 'object' member) ?
Mirco
Its a TextField
Ok so this is the problem
Mirco
you cannot do .all after a simple TextField
Mirco
You should just do {% for ticket in tickets %} {{ ticket.description }} {% endfor %} By renaming inside your view context ["ticket"] to context["tickets"] And you will see the description for every ticket filtered by the event
Droll55
Oh so simple solution. Thank you a lot !
𝙴𝚍𝚞𝚊𝚛𝚍
guys how to fix the error (Class 'Task' has no 'object' member) ? (может кто-то шарит)
Mirco
Why is everyone ignoring me🤔. Please have a look at it
Just process data inside your view and return it to the template via context
Kashif
I view** this kind of data
Mirco
Like this one
And ? You just need a loop and populate the td tag for the table
Mirco
Let me try
just to give u an idea let's say you pass this data to the template: data = ['x', 'y', 'z'] you can just do {% for item in data %} <td>{{ item }}</td> {% endfor %}
Anonymous
hey, need tips on Django Debugger Tool I get details about page load and db queries for that page call... how do I see db queries for api calls?
Javad
hey, need tips on Django Debugger Tool I get details about page load and db queries for that page call... how do I see db queries for api calls?
Which Ide do you use? If pycharm, just hover you mouse over a queryset, then you can see all parameters, incloding sql db queries
Anonymous
I use VS Code
Anonymous
there should be a way to get same details for apis as we get for page load... maybe using different debugger tool
Idk
I have a url leading to loginview page but I want to redirect it to home is user is authenticated already ?
Mirco