Optimus
Maxim
Doragonsureiyā
Enigma
Enigma
Enigma
Anonymous
you should read my question too
look buddy, can you just inspect element and tell us what kind of input field type is being rendered in the html?
Anonymous
input type date is a valid element, datetime is not a valid one and will fallback to being a text field
Anonymous
if you have a javascript library that is going to help with that, then you need to add the attributes on that form field
Anonymous
That's pretty much the gist of it.
Sergio
Hello everyone, I am making a library page, in a view I need that only the librarians (staff user) can see all the books that have been loaned and show which users they have been loaned to, I made the code and it does not show them, I have looked in documentation and I cannot find something that can help me, someone has a youtube video or a page where I can find a solution
Optimus
Optimus
or role
Enigma
Maxim
Anonymous
its text
lets see your form code
Anonymous
but again it probably just rendering a text field because there is no datetime field in html
Maxim
Anonymous
Anonymous
jalali-date on npm? is that the one?
Anonymous
jdatetime, es?
Enigma
Sergio
you can use permissions
Sure, but I need to look at all the borrowed books, I don't know if I miscall the records
Enigma
date = jforms.jDateField(initial=jdatetime.date.today(),
widget=jforms.jDateInput(attrs={'class': 'form-control', 'placeholder': 'روز-ماه-سال'}))
Enigma
Sergio
Optimus
Hilariyus
does django supports. Mvt pattern?
Anonymous
.
how does it render in the admin panel?
Enigma
Anonymous
Since you're using jdatetime in a model ,im assuming you've added that model to django-admin. Is it rendered as a text field in the admin panel or does it have the correct date dropdown that you need
Enigma
Enigma
its fine in the admin panel
Anonymous
https://github.com/slashmili/django-jalali/issues/117
Anonymous
have you read this?
Sergio
do query filter based on book types
i did it like this
def get_queryset(self):
return BookInstance.objects.filter(borrower=self.request.user).filter(status__exact='o').order_by('due_back')
Sergio
I thought that with this I could see all the borrowed books
Anonymous
Sergio
I did that in the html: {%if user.is_staff%}
Sergio
Calls the page where the book is displayed, when the loan and the user expire, but it does not show them
Sherlock
Sherlock
Sergio
And I use a for and if there are books borrowed the samples and if it does not go to an else that says there are no books borrowed.
I think the problem is that you are only seeing if the user borrowed books, and not all users
Найденов
I'm django developer from Ukrain.
Here is my portfolio website.
https://alexander.42web.io
Найденов
Yeah. It's actually same :)
Найденов
Nice to meet you
HamidReza Fekri
Hey i use abstract user but when i create user in admin put password in database without hash🤦♂️🤦♂️
HamidReza Fekri
class MyUserManager(UserManager): def create_superuser(self, username=None, email=None, password=None, extra_fields): username = extra_fields['phone'] return super().create_superuser(username, email, password, extra_fields) class User(AbstractUser): USERNAME_FIELD = 'phone' objects = MyUserManager() phone = models.CharField(max_length=15, unique=True
B
Hi
N3CRO
HamidReza Fekri
Adhil latheef
How ???🤔🤔
user.set_password(user.password)
user.save()
HamidReza Fekri
def save (self,*args,**kwargs):
self.set_password()
HamidReza Fekri
HamidReza Fekri
It has required row password in set_password
Ram
Can anyone help how to admin generate a password for users
Ram
Which means users approved by the admin and generate a random password for users
Jeevan Panwar
Is there is any web app alternative for after effect of principle for ui design
Anonymous
Anonymous
Any one is taking online Classes on DRF + Project
Jeevan Panwar
Taha
How to send my ajax response to include htlml file into another html?
игорь/igor
Taha
игорь/igor
I know it
Hot to send data?
JsonResponse(response) where response is stringified html, but from experience I can say that sending html via json seems strange, just send data and in browser use reactjs or any other Frontend framework to deal with html
Anonymous
[<CartItem: Royal Watches 2>] what is the name of this data type how can i convert it into simple list like this ['royal watches 2',] because i want to make compare between two using for looop
Anonymous
<QuerySet [<CartItem: Royal Watches 2>]>
how can i convert this to list
Вин Король Саксов
Вин Король Саксов
This class already defined iter, you could loop through that as always
Anonymous
for comparisoin of two lists
prodcut_vari = []
for item in cart_item:
prodcut_vari.append(item)
print(prodcut_vari)
i tried this but didn't work
can you provide the code
Вин Король Саксов
Anonymous
for pr in prodcut_vari:
print(pr)
if pr in ex_vart:
index = ex_vart.index(pr)
print(index)
item_id = id[index]
item = CartItem.objects.get(id=item_id)
item.quantity +=1
item.user = user
item.save()
print('yes')
i want to perform this function between two liists
is it possible with queryset and how