Mandeep
Can anyone tell me what is difference between foreignkey and onetoone ?
Сергей
there are a few models, I want to create serializer where field this serealizer wil be those models with all data if the data exist, how can create such serializer without model in meta and I just will receive all data all model that I want?
Anonymous
how can I see admin website content if the user.is_superuser is False?
Leo
how can I see admin website content if the user.is_superuser is False?
Use if statement in the template. See docs for more info
Anonymous
Use if statement in the template. See docs for more info
Can I manage this things by groups or I must override template?
Leo
. A simple if statement will do the trick. If you want to change the constraints using if gives more flexibility .
Leo
Btw how will you do filter the template with grouping?
Anonymous
Btw how will you do filter the template with grouping?
Idk, maybe I can do this in views 🤷🏻‍♂️🤷🏻‍♂️ Well actually I dont know, so now I'm just trying to override admin template as you adviced
Anonymous
index page from django admin
Leo
index page from django admin
Omg.. why do you want to edit that?
Anonymous
Omg.. why do you want to edit that?
My problem is I cant see any info there if I login as non-superuser users.
Leo
My problem is I cant see any info there if I login as non-superuser users.
Ok.. so you want to give permissions to your model? Then do grouping.. omg.. when you said admin template I was shocked .
Leo
Ok.. so you want to give permissions to your model? Then do grouping.. omg.. when you said admin template I was shocked .
I assumed that you wanna filter nonsuperusers in another template. That's why I said like that. Sorry for that
Anonymous
Ok.. so you want to give permissions to your model? Then do grouping.. omg.. when you said admin template I was shocked .
🙂 Ok, I have 3 groups. E.g I want to user that in group A may see all content. So I need to add permissions for view every model to this group, right?
Anonymous
Yes, all users have is_staff = True, but some of them not superusers
Leo
Yes, all users have is_staff = True, but some of them not superusers
So you are telling me that you can't see anything if user without superuser permissions cannot view anything?
Anonymous
Yes, non superusers that in group A (that have permissions to view all models) still cant see any content on admin page.
RIZWAN
Hey guys check it out if you like please give star it will help me to get internship https://github.com/rizwansoaib/face-attendence
Leo
Can I look at your view?
How are you doing the auth in views . Is it custom?
Anonymous
Can I look at your view?
Well, I dont have any views, I just registered models for django-admin, specify the group A for user_1 and added permissions to the group A
Anonymous
I write my own User class inherited from AbstractUser. Maybe it may helps to find a problem 🤷🏻‍♂️
RIZWAN
What's problem
Leo
That's the problem
Using custom Auth eventhough inherited is causing this problem. Django admin backend don't know anything about the new user Auth system you implement ed. So acknowledge the ModelBackend may solve this problem.
Anonymous
What I should do?
Leo
Can I look at you user class?
Anonymous
https://pastebin.com/K5kf1JgW
Leo
https://pastebin.com/K5kf1JgW
Inherit ModelBackend in the class. From django.contrib.backend import ModelBackend
Wisdom
You have to go native.. js cannot trigger fingerprint scanning. That is programming language outside browser.
So your saying there's no way I can implement fingerprint authentication in django except I go native?
Anonymous
I'm using custom backend to auth, btw. I inherited SystemUser from ModelBackend as you said, but it raises many errors https://pastebin.com/K7LH7rnm In settings: AUTH_USER_MODEL = 'telegram_bot.SystemUser' AUTHENTICATION_BACKENDS = [ 'telegram_bot.ldap_backend.UnitelLDAPBackend' ]
Leo
So your saying there's no way I can implement fingerprint authentication in django except I go native?
You can do anything in the backend .. but how will you trigger the fingerprint scanner from browser?
Wisdom
You can do anything in the backend .. but how will you trigger the fingerprint scanner from browser?
That's d problem, but I have seen some webapps implementing fingerprint registration, how do they do it?
Leo
That's d problem, but I have seen some webapps implementing fingerprint registration, how do they do it?
If you have browser plugin for fingerprint device you can accomplish your goal. I think😅
Leo
If you have browser plugin for fingerprint device you can accomplish your goal. I think😅
Hey new versions of chrome and Firefox actually support fingerprint scanner. Visit https://webauthn.guide.
Yep
Hello I have a func.py with def test()....return name I import that function into models.py and call it with p = test But i didnt get the value from name. What i get is <function test at 0x48fjwddk4> p = test() gives me a error...im not too good @obejcts...how can i get the value?
Yep
Strange now it works with test() .. ok my bad, thxs anyway
Muflone
Can anyone tell me what is difference between foreignkey and onetoone ?
The former is one to many relationship, the latter is one to one relationship
Anders (izzno / gooood) 🇳🇴
So far I've spent two days making a simple app serving questions with sequelize, I could have used django and be done in a couple of hours. + getting real familiare with js-sequelize. - dont think i will use it again 😂
Anders (izzno / gooood) 🇳🇴
I've said it before and Ill say it again... People dont know what their missing...
Avinash
How to get logged in user details in another app view ?
Anders (izzno / gooood) 🇳🇴
request.user
Avinash
But giving anonymoususer.
Anders (izzno / gooood) 🇳🇴
then your user is not logged in
Avinash
Used login function
Anders (izzno / gooood) 🇳🇴
I can't see that...
Avinash
??
Anders (izzno / gooood) 🇳🇴
WHERE'S YOUR CODE
Anonymous
Well, I dont have any views, I just registered models for django-admin, specify the group A for user_1 and added permissions to the group A
you need to create your own views. like its name, django admin mean to be administrator page. its possible to do what you want to achieve but creating your own read views will be a lot easier for sure
Albert
Hello. Who can tell in solving the problem? I zapsukayu project on django, knocking on the admin panel - authorization pages and the main admin page are displayed correctly. But I cannot fall into any embedded page (whether they are standard users / groups or models created by me). A redirect occurs, but the page does not load, does not generate errors (only the loader spins instead of favicon). There are no errors in the pycharm console. The only thing that is displayed: ``` [30/May/2019 18:20:35] "GET /favicon.ico HTTP/1.1" 404 5184 [30/May/2019 18:20:39] "GET /admin/order/ HTTP/1.1" 200 41768 [30/May/2019 18:20:39] "GET /admin/jsi18n/ HTTP/1.1" 200 14871 ```
Aadhi
Hello Guys, I have a doubt Django object.image.url is not displaying images even though path is correct Also I have added media URLs in urls.py Can somebody help me
Aadhi
Inside img tag
Aadhi
return render(request,'Manager/player_profile.html',{'player_profile_dict':player_profile_dict}) player_profile.html --------- <div class="container_player_profile"> {% for p in player_profile_dict %} <img style="height:50%; width:50%" src="{{p.upload_photo.url}}"> {%endfor%} </div> urls.py ---------- if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) settings.py ------------- MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/'
Anonymous
I didn't forget 😁 the problem was with method has_module_permissions in my Auth backend and in my admin models. I think I've almost solved this problem.. Anyway thnx to everyone
Yep
Models.py Date = models.DateField(default=datetime.date.today) It works for 2019-05-31 But whats the option for 2019-05-31:hours:minutes:seconds? Datetike.date.now doesnt work
Yep
Sqlite3
Yep
Ok datetimefield works But %Y-%m-%d %H:%M works...seconds dont %M[:%S] like django tells me doesnt work
Thiago
Hello everyone, good night! Can anyone explain me how to login with data from a modal? I can get the data from ajax, but I don't know how to proceed ... :( PLEASE HELP ME
Joshua Rebelo
Hi anyway to expire the csrfmiddlewaretoken before the expiry time
Joshua Rebelo
I have a scenario that on page refresh I generate new csrfmiddlewaretoken token
Joshua Rebelo
Hence I want to make the old one invalid before reaching expire time
abhijith
Any one can help me to get customMessaging(chat) in django??? Working in django 2.1
Himanshu
Can anyone help me with this? Suppose I have a model and it has 3 fields email, mobileno and sid. In the form I am taking only email and mobileno and I'm generating a sid myself so anyone can tell me how can I add this value of sid in the database while saving the email and mobile no. In the db
dynamic
Is there a framework which can follow BDD and create APIs on the basis of the requirements given by BDD? More like automating the process of creating simple API end-points.
Yep
Try datetime.datetime.now
Works, worked before. But i cant get the seconds
Muflone
Works, worked before. But i cant get the seconds
I think the seconds should be there, maybe you're not viewing them in your form
Yep
Oh dam you are right... They are in the db, need to format the html. Thxs & sry, still new to django