inchidi
that's what you need?
inchidi
How do I hardcord a superuser username and password so that'll I can login even if such a user is not present
oh wait, i think its not what you need. you must change the existing login system behavior for that tho
biswaz
I use django allauth
inchidi
I use django allauth
any problem if you just make your pages accesible for all user?
inchidi
i think its kinda XY problem
inchidi
rarely using postman because pycharm have similar tools 😁
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
rarely using postman because pycharm have similar tools 😁
I'd like to know the tool, i use pycharm and i didn't know that pycharm have this tool 😮
inchidi
i forgot the fullname lol
Essa
rarely using postman because pycharm have similar tools 😁
Postman is fully featured from testing , mocking to documenting your API, on the other hand, pycharm rest tool is just for hitting the endpoints AFAIK.
Essa
well, everyone prefer what suites him the most, in my case I rely heavily on postman docs tools 😐 and I hate it
Essa
I think jetbrains should add the ability to document an endpoint you test in their rest testing tool
Essa
It would be awesome 👏
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
can i make a plugin in PyCharm ?
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
custom plugin
inchidi
Postman is fully featured from testing , mocking to documenting your API, on the other hand, pycharm rest tool is just for hitting the endpoints AFAIK.
am not know postman really well but i use postman/pycharm rest tool just for mocking api request. for documentating my own django rest api i use 3rd party packages http://www.django-rest-framework.org/topics/documenting-your-api/#third-party-packages and set it on when settings.DEBUG == True and for testing i will just leave the real test for unittest from drf
Essa
can i make a plugin in PyCharm ?
Yes I think they have a system for creating plug-ins
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
Essa
using Java, right?
I’m not 💯 sure but it should be
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
I don't know java 🙁
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
i don't know how to document an API, is it hard to do ?
Essa
i don't know how to document an API, is it hard to do ?
It’s easy to think of, but hard to do 😄 β€œIt’s the most boring process in development but it is definitely one of the most important things to do” IMO
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
how the API documentation will be shown to the users ?
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
do i have to create a section on the website for this purpose ?
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
if you want, i can talk to you in arabic.
Essa
No, it’s more towards other developers who use the api endpoints Especially for front end developers, so they can tie their interfaces with the backend
Essa
if you want, i can talk to you in arabic.
Nope it’s not allowed here Rules say English only 🙂
π’Ÿπ‘œπ“ƒπ’¬π“Šπ’Ύπ“π‘œπ“‰π‘’
ok
inchidi
how the API documentation will be shown to the users ?
this is example of an API documentation https://developer.github.com/v3/
Essa
I think 🤔 we took a curve from the purpose of this group, if you need something pvt message me βœ‹οΈ
Jimmies San
Essa
inchidi
use a swagger and go easy :)
lol yeah swagger so powerfull, actually on the link i mentioned before contains this great package https://github.com/marcgibbons/django-rest-swagger
Aluma
Its easy and clean. It will jut use your comments in code to generate a doc
Anonymous
I'll try it
Abhi
i have a boolean field in my djagno model, like this
Abhi
class KYC(models.Model): kyc_status = models.CharField(max_length=30, choices=kyc_status) valid = models.BooleanField(default=False)
Abhi
i want to make a model manager such that whenever the valid field is true then only any changes can be saved to this model else it should give error
Abhi
how can i make it ?
Anonymous
Create a function which does this
Anonymous
And use that function whenever trying to access this model
Abhi
a model function ?
Anonymous
Maybe
Anonymous
It's been a while since I did something in django
Abhi
oh
Anonymous
https://docs.djangoproject.com/en/1.11/topics/db/managers/
Anonymous
This way
Anonymous
In the objects attribute
inchidi
how can i make it ?
you can override the save() function and do the logic there
inchidi
you can override the save() function and do the logic there
it would looks like class KYC(models.Model): kyc_status = models.CharField(max_length=30, choices=kyc_status) valid = models.BooleanField(default=False) def save(self, ....): # i forgot the params accepted by save func if self.valid: # do your logic here .... super().save(....) # pass the accepted params by save function
Anonymous
I think better option would to customise the manager
Anonymous
Just create this function in class inheriting manager
Anonymous
And then call that class saving into objects
inchidi
I think better option would to customise the manager
no, create custom manager when you want to do something that you will use to some (not only one) models
Anonymous
Ohk
Anonymous
Actually you guys gave me a really good idea to do something
inchidi
because if you apply your custom manager just for one Model, you will get this in one projects: # custom manager my_manager applied to model A A.my_manager.save(...) A.my_manager.all(...) B.objects.save(...) B.objects.save(...) #dont forget that this one will still works too A.objects.save(...)
inchidi
which will give nightmare
Anonymous
Well
Anonymous
How about
Anonymous
objects = custom()
inchidi
objects = custom()
do it, i bet you will get more nightmare than before
inchidi
you are closing possibility for you to know that your custom manager applied to certain model
inchidi
But this won't give nightmares
the model will have 2 save behavior tho
Anonymous
This and the thing I'm suggesting is not quite different
Anonymous
But, custom manager is the right way to do so. IMO
Abhi
i have many models actully
Abhi
all have the foreign key denoted to that KYC model
Abhi
and if valid field of that KYC will be True then only those models can be edited