inchidi
that's what you need?
inchidi
biswaz
biswaz
I use django allauth
inchidi
i think its kinda XY problem
inchidi
rarely using postman because pycharm have similar tools 😁
inchidi
inchidi
i forgot the fullname lol
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
ππππ¬ππΎππππ
I don't know java 🙁
ππππ¬ππΎππππ
i don't know how to document an API, is it hard to do ?
ππππ¬ππΎππππ
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
ππππ¬ππΎππππ
ok
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
Jimmies San
inchidi
Aluma
Aluma
Its easy and clean. It will jut use your comments in code to generate a doc
Anonymous
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
Anonymous
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
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
you are closing possibility for you to know that your custom manager applied to certain model
Anonymous
Anonymous
Anonymous
Anonymous
This and the thing I'm suggesting is not quite different
Anonymous
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