Simon
Hi, I want to give access to DetailView class based view of a post to either the author of the post or a memeber of the staff group, but not to anyone else. I have used GroupRequiredMixin from django-braces, to restrict the view to staff group, but I don't know how to allow access to the post author also. Any ideas how I could accomplish this?
Brian
Alternatively share a pastebin link with your code. If your detailedview has context, it's even easier
Simon
Not quite sure I understand your question, but you could override the queryset and filter the user or group. Something like Post.objects.filter(user=request.user, group='staff')
In my model, any user can create a post. He doesn't have to be a member of the staff group. But I want the post to be visible to either to a member of the staff group or to the author of the post, but not to anyone else. I tried that for the limiting the access to just the author. I changed the get_context() so that it returns Post.objects.filter(user=request.user). I was not aware of the group argument of this method. Are you sure this will return a queryset to both a memeber of staff group or to the author of the post?
Bunty chhatri wala..
I deployed my app on Heroku.. Now it saying *Base.html* not found But locally it is working fine.
Brian
I can totally read this pal
Anonymous
Should I add migrations folder to .gitignore if not why
Nirupam
User.objects.all() --- in this objects is not available ..? Why
Bunty chhatri wala..
have you configured STATIC_URL correctly?
Yes.. at localhost its working fine
Tushar
https://pastebin.com/j22t9rwz
Tushar
Tushar
this is my views.py
my validators does work
Nirupam
Create users.
Actually i was getting one error.since morning..that is ..whereever i am creating app, in app.py file it's coming as warning. And i am not able to add app name i. Installed_ app..
Shihasz
https://pastebin.com/j22t9rwz
Redundant codes. No need of that 'else' part
Tushar
Redundant codes. No need of that 'else' part
but when i remove they give me error no httpresponse
Shihasz
but when i remove they give me error no httpresponse
You should return ur render function within the scope of the view
Rainur
Hello! What kind of solutions do you use for costumize default django admin interface ?
Rainur
Has anyone used django-admin-tool?
Tushar
Hello! What kind of solutions do you use for costumize default django admin interface ?
https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#set-up-your-projects-admin-template-directories
Anonymous
Hello! I am new to python and want to learn djano and flask. Can anyone provide material to start on with as an beginner.
Anonymous
sure
Doragonsureiyā
Hello! I am new to python and want to learn djano and flask. Can anyone provide material to start on with as an beginner.
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Anonymous
Thankyou
Yash
Hello.. where can I easily learn django rest framework other than from it's documentation? I'm a beginner in django.
Anonymous
The easiest way to deploy a django app in AWS is using docker ?
Mirco
The easiest way to deploy a django app in AWS is using docker ?
You can use Fargate and ECS services of AWS
Anonymous
Can i use Faker iniside my models
Mirco
For testing, yes
Anonymous
For testing, yes
I want it to fill each time when one object of that model is created and this is for a slugfield (link field) to be filled random but unique
Tushar
just like we have delete action for select details so it is possible can we make action which are use for make user. in my alumni project i want when admin select student and they will be make user
Shivank
Hi all, I have a question, How can we activate an virtual environment which is saved in some other directory ,for a project.
Nirupam
Can you elaborate your problem?
Appname in app.py file showing warning kind.its not adding in installed app properly.
Adiziel
Appname in app.py file showing warning kind.its not adding in installed app properly.
Open settings.py and add the name of your app folder in installed apps section and also don't forget commas
Shivank
Thanks ! Figured it
Adiziel
Great
Rit
Hi bros... Even though I learned python I am struggling to write codes in view part of Django... How to become good in writing programs in view
Thiago
guys can someone help me I'm not sure what to do I already did and redid 10x I have his django-address app I want the user to send the location through the documentation there is no connection with the user so add no models user = models.OneToOneField (User, on_delete = models.PROTECT, verbose_name = "Professional Name") at django-admin everything works correctly but when I send the form it doesn't store as far as i know i did everything right, as i always did, but something is wrong
Thiago
guys can someone help me I'm not sure what to do I already did and redid 10x I have his django-address app I want the user to send the location through the documentation there is no connection with the user so add no models user = models.OneToOneField (User, on_delete = models.PROTECT, verbose_name = "Professional Name") at django-admin everything works correctly but when I send the form it doesn't store as far as i know i did everything right, as i always did, but something is wrong
saran
Hi anyone tried django translation?? Is it worth using or reliable?? I'm working on multilingual site. Or any other alternatives.
saran
Why not install it yourself and find out
Is any better alternatives is their I can try it out na. Why don't waste time that.
Anonymous
Is any better alternatives is their I can try it out na. Why don't waste time that.
Asking us to try is the same as asking us to waste our time. Just have a look at djangopackages.org and try them all. Then use what works for you
saran
Asking us to try is the same as asking us to waste our time. Just have a look at djangopackages.org and try them all. Then use what works for you
Heyy mahn if any one tried any alternatives before he/she can suggest na.. That what I meant. I don't want to waste anyone's time. 🙏 Asking for a suggestion only.
Abrar
It was a simple yes or no question. Some people here overreact a lot.
Anonymous
Hello experts, please suggest if pandas can be used in django..i need the data frame utilities only..
Anonymous
Why not ?
🙂 actually heard that it is a huge library and may take lot of space... Thanks @pyflare
Xavier
🙂 actually heard that it is a huge library and may take lot of space... Thanks @pyflare
well no that much if u cant spare that amount space then django will disappoint you more but yea go with panda if u want no issues, it works amazingly
Anonymous
Thanks...🙂
Dev
Anyone tell me how do i fetch data from an API to my html file in django
Anonymous
Anyone tell me how do i fetch data from an API to my html file in django
use requests module to send http requests to the api
Kronos
get data with requests and then take the data what you want and do whatever you want with it on the views...then pass it into the template context
Kronos
Depending on the api
Anonymous
Or httpx , much better 😛
or even pycURL 😂
Mirco
or even pycURL 😂
Yes but nah httpx now is much better than requests and it supports async/await 🔝
Anonymous
Like if the field is date or string like that??
saran
Roman
Hi guys ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine .
Roman
Why do I get this ? All if fine the request is proceed