inchidi
https://docs.djangoproject.com/en/2.0/ref/contrib/staticfiles/#settings
Anonymous
STATICFILES_DIRS
i change it but get a error :
?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.
so what can i do
inchidi
inchidi
its because your static root value inside your staticfiles_dirs
inchidi
change STATIC_ROOT to something else, maybe static_root directory instead static
Django Bot
>> Links
- A comprehensive Django CBV guide — /var/
- PyConWeb 2018
Anonymous
nice!
thank you so much it work Truly with your help
i fix STATICFILES_DIRS and run mange.py collectstatic
and it worked
Prayashi🍩
Any python expert?
Anonymous
Nope
inchidi
too bad, i like gb but...
Anonymous
Prayashi🍩
I really need help😭😭
Anonymous
It's development halted a while ago
inchidi
Prayashi🍩
Hmm
Prayashi🍩
Actually I don't know much about python
Prayashi🍩
But I am interested in it
Prayashi🍩
I wanted to create a bot in telegram
Prayashi🍩
Anonymous
Prayashi🍩
I want to create a bot
Prayashi🍩
Which can delete messages
Prayashi🍩
Post message with buttons
Django Bot
>> Links
- Blazing fast tests in Django
- python-database-sanitizer
- django-material
Django Bot
>> Links
- Python 2.7, Django and namespace packages · Martin Sanders
mλdcodez
Need help with this, shared question yesterday, no response, so i decided to ask on Stack Overflow
https://stackoverflow.com/questions/50515991/attrs-for-widget-isnt-working-issue-with-from-django-contrib-auth-models-impo
Django Bot
>> Links
- django-model-path-converter
- Playing around with PyPy performance while running Django.
- ic-labs/django-icekit: GLAMkit is a next-generation Python CMS by the Inter
- cookiecutter-django/{{cookiecutter.project_slug}}/compose/production/django
Django Bot
>> Links
- cookiecutter-django/start at master · pydanny/cookiecutter-django
Django Bot
>> Links
- Blazing fast tests in Django
Django Bot
>> Links
- Building Modern Applications with Django and Vue.js
inchidi
Django Bot
>> Links
- RevSys Python Builds
Django Bot
>> Links
- graphene-django
Django Bot
>> Links
- Django Packages : Reusable apps, sites and tools directory
- Djangocon: Graphql in python and django - Patrick Arminio
Arnak
Hi there!
Can some one help me understand, I have
class CustomUser(User):
mobile = PhoneNumberField(unique=True)
created_on = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default = False)
objects = UserManager()
and use rest framework with 'rest_framework.authtoken'
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
)
}
when I use permission_class
class Isstaff(permissions.BasePermission):
def has_permission(self, request, view):
if request.method == 'GET' and request.user and request.user.groups.filter(name='API'):
return True
return False
class AccountList(generics.ListAPIView):
permission_classes = (Isstaff,)
queryset = Account.objects.all()
serializer_class = AccountSerializer
filter_backends = (DjangoFilterBackend,)
filter_fields = ('abonement', 'secret', 'pin')
I get "Authentication credentials were not provided."
Arnak
My request.user is in API group
Arnak
but if I don't use permission, everything work
Arnak
from django.contrib.auth.models import User
bool(user.groups.filter(name='API'))
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'user' is not defined
inchidi
inchidi
user= ....get(username="...")
Arnak
sorry
bool(user.groups.filter(name='API'))
True
Arnak
inchidi
request.user
what do you want to achieve by request.user?
Arnak
Request user must be in group API, if not permission must be denied
Arnak
No, I tried it, problem was still
inchidi
request.user
then why you answer my question by this?
inchidi
by modify Isstaff to:
class Isstaff(permissions.BasePermission):
def has_permission(self, request, view):
return request.method == 'GET'
then try access the api endpoint
Arnak
I get answer
inchidi
then try again with the other
class Isstaff(permissions.BasePermission):
def has_permission(self, request, view):
return request.user
inchidi
if you still get answer then try again with
class Isstaff(permissions.BasePermission):
def has_permission(self, request, view):
return request.user.groups.filter(name='API')
Arnak
Arnak
inchidi
Arnak
Anonymous
hey i want to sort question in my home page according to date
inchidi
inchidi
Anonymous
Anonymous
thank you
Arnak
Arnak
root
Arnak
it's realy magic )
inchidi
this pic doesnt mean anything tho
Arnak
where i can print this, in api response?
Arnak
for example
def list(self, request):
print(request.user.username)
return Response("Something", status=status.HTTP_404_NOT_FOUND)