Harin Kumar
Hii can anyone know how to authenticate a webpage that having Facebook login information and stores information in database by Django backend?
Please
Mirco
Harin Kumar
Okay
I'll
Prashanth
Hii, i have problem that i posted in stack overflow. Can i post the problem link here?
Mirco
If it's related to django, yes
Prashanth
Ya it is django models problem
Prashanth
Prashanth
Ok
Prashanth
https://stackoverflow.com/q/60788287/11665780
Prashanth
Mirco
I see lots of errors starting from python syntax
I strongly suggest you to study python before django and databases theory
Prashanth
I'm done with python cores
Mirco
To be honest, I believe you need much more time
Classes name don't have to be lower case and attribute name don't have to be capitalized
Mirco
So this means you still don't read in a good way PEP8
Mirco
Then there's databases theory to cover
What's the reason why to have department name as primary key ?
Mirco
The default pk or UUID is better, isn't it ?
You still can have the name unique but not as primary key
Prashanth
Coz i want that as unique. And department_details and others are the related to department model
Anonymous
What is the easiest way to get all values of all fields from model instance.
Smt like Model.objects.values(), but having only instance of this model.
Sheshadri
Anonymous
No, i mean i already did
inst = My_model.objects.get(pk=1)
And i need to get all values from all fields i declared in model “My_model” having only INSTANCE “inst”.
Besides getattr.
ᐯᑌᏞᏦᗩᑎ📈
why to use formsets? what are the advantages?
Sheshadri
Anonymous
Amit
Sheshadri
Batman
Hello I was working with something where I have to delete old records whenever one of the fields gets updated in the object. The said field is a many to many field, and I am trying to check when that many to many field is cleared, so I used the pre_clear action under m2m_changed signal, to check that field before it gets deleted, but I was wondering that is it the correct way to do, let's say pre clear gets triggered but when actually clearing the field the database returns an error, how should I approach this thing?
Хумо
Hello! I have 3 apps: University,Book,Admin.Each book related to University.Model Admin inherited from AbstarctBaseUser, and has
university_id = models.ForeignKey(University)
So the task is to limit Admins possibilities:they can edit books which are related to admin’s university.How can i do this?Please help
Dhruva
When the user signs up I want the user to verify themselves and then later on verifying them the mail goes to the admin to see the details provided to see the data is authenticate how to do
Anonymous
I have a question, each view needs to load navbar data. But i dont want to duplicate this call in each view. How can i make BASE for views?)
Original
Anonymous
ok, https://pastebin.com/D6Hc63Tn
Anonymous
see, in this code catalog_parent_list = CatalogParent.objects.all() in every view
Anonymous
i need to (somehow) make one parent view and other must extends from him
Mirco
Mirco
So you can use inheritance
Roman
Hi guys, I got an issue I am not able to fix it please some help : I have django as rest and vue as front end, I had cors policy so I set up
CORS_ORIGIN_WHITELIST = (
'http://localhost:8080',
)
Roman
But still If I do request I get problem untill I do
#CORS_ORIGIN_ALLOW_ALL = True
Roman
But isn't it security hole if I set
#CORS_ORIGIN_ALLOW_ALL = True ?
Alexandros
hello, is it possible from django rest framework validators to know the resource requested without being passed as an argument?
My application is very similar to a marketplace. I have multiple stores (each with multiple products) and I need to verify that an order placed to a specific store only contains products of that store. I am currently not including the store identifier in the body (json), but as the resource identifier. Something like '/stores/<int:store_id>/orders/'. The validator however, only seems to have access to the body of the request.
Alexandros
ok, I figured out I can enable serializer_field for the validator and then access the request using serializer_field.context['request']
Sirius
Hello everybody!
i am getting this error!:
raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).
Muflone
Sirius
Muflone
Use a modern OS version
Muflone
and..?
Reginald
What frontend framework best suits django
Reginald
Anyone??
Shaun
pick the one you are comfy with.
Shaun
i am just using bootstrap for now
Shaun
nah just bootstrap and you can build from there. But that is because i wanted to prototype very quickly.
Shaun
then i would figure out if i need a different framework if i get customers :)
Alexandros
are request data available to permissions in drf? I have a status field that different users have different update permissions on (depending on its current and new value). If not, would this be more appropriately implemented using validators?
Marcos
you can use object permission level instead of model permissions level
Marcos
DRF has already a class for it
Ali
I'm working with PaceJs, and I want to show a loading bar when a button is clicked.
The bar shows normally when the page is loading.
problem is :
The button runs a python script , and the loading bar is being showed after the script finished .
I want to show the loading bar during the script execution which takes a while to finish.
Marcos
nop is not model level, its object level
Marcos
DRF provides you with:
- DjangoModelPermissions
- DjangoObjectPermissions
Alexandros
Ok, I'm looking into it right now, but still, I will need to see the request first, and make sure the new data is permitted
Marcos
.
example you can have model
class Car(models.Model):
...
django model permission check if user has perms to view, add, delete (or whatever permission you have add to that model)
django object permission check permissions at object level
example
you can configure that a user -> can_drive
car = Car.objects.get(brand='Ford')
but maybe same user -> not can_drive
car = Car.objects.get(brand='Chevrolet')
Alexandros
ok, maybe I don't understand exactly how to do this, but the permissions depend on the data submitted by the user, not the current data
Alexandros
so given that the field is any value in the range of 30-45, the user might have access to set the field to values 1-20 and 40-59 but nothing else
Alexandros
so using object permission I can enforce that the user should only access the objects with values 30-45, but I cannot enforce that the new values are 1-20 or 40-59
Alexandros
is that not correct?
Marcos
Noup, django permissions is for access it does not avoids user can change the data if currently have access to it
Marcos
Example we can have an object which has atteibute "owner"
Marcos
If the value of owner is Alexandros, i can not see it
Marcos
Or perform any changes to it
Marcos
If its owned by "josue" i can see it and perform cahnges,
EVEN CHANGE OWNER ATTERIBUTE to alexandros
Marcos
What you can do is
Marcos
On serializer
Marcos
Set this atteibute to read_only
Marcos
So if i try to edit this atteibute DRF will raise 400 BadRequest
Marcos
I guess thats what you want right?
Alexandros
no, the user should be able to change the value to a specific subset of all possible values