Mirco
populate my models, as in... field_name['key'] = value??
Put data into model as you would do in a usual way 😁
Player
Put data into model as you would do in a usual way 😁
Ye... I have only used ModelForm before, and I looked how to use models for data saving. It is... very simple. Made some rookie mistakes :D
Player
question remains though.... I plan to receive data every hour lets say. Does django remove duplicates before savin into database or is it something I should do myself?
Guillermo
question remains though.... I plan to receive data every hour lets say. Does django remove duplicates before savin into database or is it something I should do myself?
If you mark the possible duplicated fields as unique Django will throw an exception when saving the model, otherwise you have to manage the duplication yourself
Player
exceptions*
Player
@grroigc you are amazing. Thank you sir :)
Guillermo
@grroigc you are amazing. Thank you sir :)
no problem, man, we all are here to learn and help each other
Ajay
I have attribute error
Ajay
Django. Contrib.auth.views had no attributes login
Ajay
What I should be do
Guillermo
What I should be do
contrib.auth.views.login does not exists, contrib.auth.views.LoginView does exists
Abel
Guys how can I create different types of user in django
Mirco
Guys how can I create different types of user in django
Make a search online, you will find several links about the topic One of the most interesting , imho , is the one of simplebetterthancomplex.com
Nichita
Hi, how can I auth using Django rest framework, but with email and password, not with username / pass? Need I use something like this
Nichita
https://github.com/Tivix/django-rest-auth/blob/master/docs/installation.rst
Rajab
Hi guys! What's the difference between django and drf?
Mirco
Hi guys! What's the difference between django and drf?
DRF is a django app developed to help you to make beautiful and powerful REST APIs in a simple way
Mirco
Thx bro👍
Check DRF official docs for better definition and more info
ⓦⓐⓢⓓⓚⓘⓛⓛⓔⓡ
cj
Hi guys! What's the difference between django and drf?
theresn't a point to make a difference, because one is a "plugin" (to say a word) for the another
Anders (izzno / gooood) 🇳🇴
Is it just me or does VScode sort of grow on you... It slowly takes over without you noticing...
Anders (izzno / gooood) 🇳🇴
btw has anyone experimented / used graphene-django, whats your take on GraphQL on Python / Django.
Anders (izzno / gooood) 🇳🇴
I am hoping someone will tell me its just as nice / easy going as the rest of Django ;)
Mirco
btw has anyone experimented / used graphene-django, whats your take on GraphQL on Python / Django.
A little bit , Python Italy president is making a beautiful library called Strawberry, inspired by python dataclasses to help developers with GraphQL and Py
Anders (izzno / gooood) 🇳🇴
OOuu that sounds nice... I love dataclasses...
Mirco
Alpha release should come early
Anders (izzno / gooood) 🇳🇴
I have been seduced by JS the last months.... But I miss the "simplicity" (by choice) of python...
Anders (izzno / gooood) 🇳🇴
I found a great way to combine JS / Django without complete separation (The view/js hybrid thingy) like I showed you too making it such a great combo. I have a DB heavy project that just escalated 900% so GraphQL would be perfect....
Anders (izzno / gooood) 🇳🇴
I like so much how GraphQL helps you to make few requests to get more info
Yepp... Its the PHP/Django/Vue/JS hybrib thingy... 90% of the info from then API gets thrown away by the PHP part on 90% of the requestes, and now they want to include the rest of the "departments" which will include about 100x the requests...
Anders (izzno / gooood) 🇳🇴
Perfect candidate.
Anders (izzno / gooood) 🇳🇴
(You could say its bad API design, but I refuse to make an API endpoint for EVERY single view function of the PHP app...)
ⓦⓐⓢⓓⓚⓘⓛⓛⓔⓡ
Follow the updates here
Thanks for new stuffs
Anders (izzno / gooood) 🇳🇴
No worries, I think it was a team decision , isn't it ?
Yes, of course. If he really needed that or the program would suffer there would be no other option.
Anders (izzno / gooood) 🇳🇴
:)
Loki
Ok guys, very stupid question incoming I got a task to create a service using Django. I already have structure of models and yml with API methods from my employer. So, I never created API and basically just getting started with Django. There is one field in the model that bothers me: api_key -- CharField -- "access key for API" So what exactly is this API key? Am I supposed to create it with some method or it's just bunch of random symbols that I can generate myself and then pass it somewhere?
Anders (izzno / gooood) 🇳🇴
api_key -- CharField -- "access key for API" is not django...
Loki
Well, it's field in the model api_key = models.Charfield(...) I just don't get how to use it
Anders (izzno / gooood) 🇳🇴
Neither would we without the sourcecode...
Anders (izzno / gooood) 🇳🇴
There are several ways to authenticate an API request. Are you using DRE ?
Anders (izzno / gooood) 🇳🇴
Django Rest Framework
Anders (izzno / gooood) 🇳🇴
Are you familiar with MVC frameworks? How new are you ? etc... ;)
Scrim
i'm trying use django_filters.ModelChoiceFilter(query=....) to make dropdown filter on my website
Scrim
but when i select item
Scrim
and i submit filter
Scrim
return message displayed on screen, make a valid option
Scrim
i cant filter... how can i do this ?
Mirco
Share your code
Anonymous
I am building a django app, that will store api keys for users of 4-5 different service. using hash field to store api keys. My question is to use one single model as UserApiKeys with a identifier column to say which service this key is for. or Make separate Models for each service. ServiceA ServiceB ServiceC
Anonymous
I need an chat APIs for Android app plezzzz anyone help me out of this
R
I need an chat APIs for Android app plezzzz anyone help me out of this
https://duckduckgo.com/?q=chat+api+android&t=h_&ia=web
Anonymous
Anonymous
I dont see the problem in storing them in the same model
Thanks for your input. A follow up question: So I am thinking to create an App called Dashboard It will have a main model, UserApiKeys users have option to add api keys for 5 different services. (Multiple api key for a single service can be added as well) So it will have a Add / delete forms. And the app will basically show some reports generated from those API. Is all this good to build as a single app or I split it up
R
Anyways, I would suggest create ur own User by extending AbstractUser and have an app called users where you have ur User model and UserApiKeys model
R
Is this in django r else other
Look at django channels, their tutorial is how to create a chat... https://channels.readthedocs.io/en/latest/tutorial/index.html
Anonymous
Anyways, I would suggest create ur own User by extending AbstractUser and have an app called users where you have ur User model and UserApiKeys model
yes I am using cookie-cutter so it have already creatred Custom model from AbstractUser thanks for the tip.
Anonymous
Can anyone explain how serializer validations work for fields. One way is to write def validate where we can write our own validation other is when serializer does this on fields automatically
Anonymous
I want to know how serializer does and how to override that
Anonymous
Have you read docs ?
Hi mirco, Read and i just want confirmation. Is def validate_fieldname The only way to do it I am just beginning with django. Thanks
Anonymous
Yes