Anonymous
It's free and really good for basics
Jimmies San
hi guys! i have to build a django dashboard on top of a restful api daemon... have you any hint/link about that? :) the api daemon is separate from django, and it's finished.
Jimmies San
i have to show data from daemon, i can't use a framework js and do data binding 'cause i have to manage auth without modify the daemon, and other things. yes web dashboard
Jimmies San
an existent component that "do things" and expose api rest to fetch data. not important this.
Jimmies San
i have api rest. i call that from django and visualize
inchidi
i have api rest. i call that from django and visualize
actually django wont call the rest api, you create your rest api with django. and call it using ajax/etc. after your javascript get the data from rest api, jacascript visualize it
inchidi
first step is read about django rest framework i think
Jimmies San
yes so you think is better create api with drf to serialize data and after that visualize it with some js
Jimmies San
and not call directly the daemon with python requests inside django and visualize it with js?
Jimmies San
i have doubt about this two way
Jimmies San
the daemon have api rest
Jimmies San
it's not important for django, i don't need inside django the api rest
inchidi
still dont understand what you mean by daemon
inchidi
are you sure you understand what rest api is?
inchidi
the daemon have api rest
can you tell me example of parameters accepted by "the daemon rest api"?
Jimmies San
daemon do things, rest api is the way it expose data using rest convention
Jimmies San
so it has url like /v1/network and you can "get" on this url to fetch data
Jimmies San
or "post" to create a new network
Jimmies San
or put/patch to edit
Jimmies San
and so on
inchidi
so it has url like /v1/network and you can "get" on this url to fetch data
so the daemon already provide this? you dont need django then. just Javascript is enough. but you can still use django to render your Javascript
Jimmies San
please read me: i talk about that before
Jimmies San
i can't to data binding: i need to create user without modify the daemon
Jimmies San
i go to launch. thanks for help.
Django Bot
>> Links - django-payments β€” django-payments 0.9.0 documentation - Reusing Django include urls for index - sjoerdjob.com - SectorLabs/django-postgres-extra: Bringing all of PostgreSQL's awesomeness - MicroPyramid/django-mfa: Django app for providing MFA (Multi-Factor Authent
Abhi
someone help
Abhi
this is my imageserlializers :
Abhi
class ImageSerailizers(serializers.Serializer): image = serializers.FileField(max_length=None, use_url='/data/')
Abhi
this is my code to handle the request
Abhi
def imagetoocr(request): if request.method == "POST":``````# print(request.FILES)``````serializer = ImageSerailizers(data=request.POST)``````if serializer.is_valid():``````print("valid hai")``````else:``````print("Not valid")
Abhi
i am getting this error
Abhi
django.core.exceptions.TooManyFieldsSent: The number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS.
Django Bot
>> Blogs - Django - Template language Intro >> Links - How to Create Group By Queries With Django ORM
Abhi
after checking valid serialisation, how to get the serialised data ? Below is the code
Abhi
if request.method == "POST": serializer = FileUploadSerailizers(data=request.FILES) if serializer.is_valid(): print("Serialisation is valid") print(serializer.data) else: print("Invalid Serialisation")
Abhi
i am getting {'image': None}
Django Bot
>> Jobs - Junior Software Developer
Aluma
Or .validated_data
Val
Hey guys I need your opinion I want to make an authentication that should group users into user and admin. Where user would have some privileges and admin also would have some privileges also. Now I'm thinking of making the admin a boolean and thereby using the conditional statement to specify the allocated privileges. But is there a better way to do this or any better ideas?
Anonymous
lol
Val
yeah just use the django admin
I am not using Django... I am trying to develop an api that I would test through the postman. I'm thinking of the best logic to use through functional programming
Val
Tokens?
Yes I'm using jwt and bcrypt to hash
inchidi
or you just wanna have one api login but admin can access api for admin and user can't?
inchidi
I want to have a single api for both user and admin
and you are using drf jwt? good choice
Val
I want make it in a way where admin can have some privileges and the user other privileges
Val
inchidi
inchidi
http://www.django-rest-framework.org/api-guide/permissions/#setting-the-permission-policy
Val
did you know you can define that with one line using drf?
No... I am actually using node n not Django but I believe the logic should be the same thing. I didn't want to bring it up since this is a Django chat group
Val
oh okay
So I'm thinking of making column in my model for admin as a boolean. And through the back end make a particular user an admin by setting it to true. And in the controller I designate the appropriate privileges to the admin.
Django Bot
>> Links - [Django] Timezone helpers - springload/awesome-wagtail: A curated list of awesome packages, articles, a - Django Channels β€” Channels 1.1.8 documentation - Finally, Real-Time Django Is Here: Get Started with Django Channels | Herok
Yega
hello everyone , I just started learning Django. Its amazing. and I have a few doubts.
Yega
like why do we use all the django commands in cmd (I use windows), what is so special about cmd?
Yega
py manage.py runserver
Yega
I just executed that (just started)
Yega
and as a result i could access the address and view the page
Yega
but why do we use cmd? is there anything nobel behind this or just because it is one way to do and was randomly selected
inchidi
py manage.py runserver
py part means you are running python manage.py is the python file you want to excute and runserver is command that accepted by the manage.py
inchidi
i think because thats how we run python, using cmd
Yega
i think because thats how we run python, using cmd
ohh,, yeah that could be a possible reason. I'll explore more on it now, Thank you
Django Bot
>> Links - Testing Models with Django using Pytest and Factory Boy - Django – Simple channels Example – Developers Area
biswaz
How do I hardcord a superuser username and password so that'll I can login even if such a user is not present
biswaz
For debugging purpose
inchidi
How do I hardcord a superuser username and password so that'll I can login even if such a user is not present
from django.contrib.auth.models import User User.objects.create_superuser("username", "password", "email")