Master
Do you have user in user_profile template? Or instead user you have object, as should be if its a DetailView
Master
Nedd
Master
Yes.
Nedd
Ok thanks a lot.
vincent
Hi guys. I'm trying to implement role-based access control in Django Rest Framework using Django oauth toolkit. It's not clear to me how all this works since all I understand from their docs is how to get a token. But how do I define what resources a specific group of users can access? Can anyone help?
vincent
Or does someone have a better way to implement role-based access control?
Master
Master
May be you don't have a user with that pk
Maksim
<QUERYSET [<USER: ADMIN>]>
Master
bwahaha... And your admin have Profile?
Maksim
ofk, in main page all works
Maksim
and other pages
Maksim
<img src="/media/{{ user.profile.photo }}" title="{{ user.username }}" >
base template
Master
change User.objects.filter(pk=pk) to User.objects.get(pk=pk)
Master
or to more adequate approach https://docs.djangoproject.com/en/2.2/topics/http/shortcuts/#get-object-or-404
Maksim
User.objects.get(pk=pk)
I tried to do it
Maksim
o thanks. it's strange but I got a mistake
Maksim
now all works
Shiva
Guys how to open a file in Django in server
Shiva
fc = fiona.open("G:\Shiva\Chennai Extracts\CHENNAI_WARDS\Chennai_wards.shp") , I used this to open in local machine
Shiva
But I don't know how to open in server
cj
Shiva
fc = fiona.open("http://gisdev.in/gisdev/files/Chennai_wards.shp")
I used this in server but it's not opening the file
cj
Shiva
cj
Shiva
cj
e.g:
so in your local machine you will have:
FOLDER=G:\Shiva\Chennai Extracts\CHENNAI_WARDS\
and in server it could be:
FOLDER=/home/user/somedir/
and you use that FOLDER variable to tell your code where the file is
cj
I can't understand
👆 that FOLDER is the environment variable of the location of the file you want to open in local/server environment
Arseniy
Hi
Arseniy
Anybody know how can i change MEDIA_URL whih django-filebrowser use
Arseniy
By default it use MEDIA_URL from django setting file
Arseniy
But i need to stay it and give filebrowser another
Arseniy
FILEBROWSER_MEDIA_URL setting from docs dont work
Arseniy
Docs are 2014 year from
cj
Arseniy
I have just trying to do it with my friend about 4 hours
cj
Docs are 2014 year from
https://docs.djangoproject.com/en/2.2/topics/files/
updated 9 hours ago 🤷🏻♂️
Arseniy
Lol
Arseniy
I see v3.5.2 on site
Arseniy
And triangle dont press
Arseniy
Django-filebrowser
Arseniy
Its library for django
cj
Django-filebrowser
https://django-filebrowser.readthedocs.io/en/latest/
well... updated 8 months ago
🤷🏻♂️
Arseniy
Oh
Arseniy
Sorry
Arseniy
Last v where FILEBROWSER_MEDIA_URL was in settings are 3.5.2
Arseniy
My mistake
Arseniy
But in current docs there are no info about changing MEDIA_URL
Arseniy
Ok, ty at all
Arseniy
May be anyone else use it
Pablo
How to do testing with Django ?
Pablo
Mys test not working,
Muhammad
Hi all,
When testing django application, does anyone here have an experience with django-pytest not django unittest module?
Did you get a better gain in terms of testing and coverage?
inchidi
inchidi
basically its not what they can test or not, both can do same thing. but your code structure will completely different
Muhammad
@Inchidi why coverage is not better with pytest?
Could you please explain to me why?
And thanks
Muhammad
Thanks! so i will give django-pytest a shot i think.
Abhinav
Is the default sqlite3 db okay to store BLOB files or should I move on to Postgresql for that?
cj
Abhinav
Ok
Abhinav
Akash
I have this situation where 50+ individual django orm apps are connected to a single database.
These apps have to use a common database but they cannot be merged in one project.
Now we are planning to push it and expect 100's of new instances...
How will it effect PostgreSQL?
How many simultaneous connection can it handle?
Yash
Hey i want to make website like freelancer on django so how to make it can any provide guideline regrading this project
Ghorz
Has any used
https://django-contrib-comments.readthedocs.io/en/latest/#
I can't find a reply comment function in the package
Ghorz
It's pretty nice though
Ghorz
Ghorz
Akash
Ghorz