Optimus
i did date = forms.DateField(widget=forms.DateInput(attrs={'class': 'form-control'}))
where is type attribute or u are not mentioning any date package class or something
Doragonsureiyā
i did date = forms.DateField(widget=forms.DateInput(attrs={'class': 'form-control'}))
Read this please: http://catb.org/~esr/faqs/smart-questions.html#intro
Enigma
where is type attribute or u are not mentioning any date package class or something
oooo sorry i read it wrong. type date is not what im searching for
Maxim
i dont understand you
read https://t.me/django/173439
Enigma
read https://t.me/django/173439
you should read my question too
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?
Maxim
you should read my question too
not quite so - you are interested in solving your problem
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
or role
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
Enigma
input type date is a valid element, datetime is not a valid one and will fallback to being a text field
im trying to put jalali date filed if i give type date from djnago by myself it would give me normal calendar
Maxim
PM ??
personal message
Anonymous
jalali-date on npm? is that the one?
Anonymous
jdatetime, es?
Enigma
jalali-date on npm? is that the one?
https://pypi.org/project/django-jalali/
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': 'روز-ماه-سال'}))
Hilariyus
does django supports. Mvt pattern?
Anonymous
.
how does it render in the admin panel?
Enigma
how does it render in the admin panel?
the models work fine with the same package
Anonymous
the models work fine with the same package
are the fields rendering like you expect them to is what i meant
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
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
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
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
Nickolay
I'm django developer from Ukrain. Here is my portfolio website. https://alexander.42web.io
I dont know that about django dev you speak. I now only python developers that know django fraimwork.
Найденов
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
HamidReza Fekri
Use .set_password()
How ???🤔🤔
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
Any one is taking online Classes on DRF + Project
Taha
How to send my ajax response to include htlml file into another html?
игорь/igor
Taha
{% include "foo/bar.html" %}
I know it Hot to send data?
игорь/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