Re: Using a model property as a lookup_field

2020-10-27 Thread Matemática A3K
On Tue, Oct 27, 2020 at 12:06 AM Adam Fletcher wrote: > Hi Folks, > > I have a custom user model that has a property called 'name' that returns > the username. > > I want to use this property in a ModelSerializer like so: > > owner = serializers.HyperlinkedRelatedField( >

Re: {"detail":"Not found."}

2020-10-25 Thread Matemática A3K
On Sun, Oct 25, 2020 at 9:45 AM iopasd...@gmail.com wrote: > I made it using viewset and serializer. > The primary key has been set to email, and this error has occurred in > detail > > What's unique is that when you write an e-mail, you only see > {"detail":"Not found."} on the white screen. >

Re: Full Address

2020-10-18 Thread Matemática A3K
On Sun, Oct 18, 2020 at 8:15 AM Softtar wrote: > Yes Thanks Sir. It's working Now. Thanks again Sir. I have one more > question > > I want to pass condition base parameters in url how i can do that > > path('api/filterapplication/ || ', ApplicationLIST1.as_view()), > > > def get(self, request,

Re: practise around renaming fields, foreign key, bulk re-name

2020-10-16 Thread Matemática A3K
On Fri, Oct 16, 2020 at 6:17 AM Andy922 wrote: > I managed to get this to work, perhaps a suggested improvement is to > re-write this into an "easier" syntax on the same form as other serializer > fields. > > Model is called "Product" > > Length =

Re: Time slots in a list

2020-10-16 Thread Matemática A3K
On Thu, Oct 15, 2020 at 6:56 AM Ashutosh Mishra wrote: > I need help guys. > I want all the time slots between the start and end time to the field > slots.Each slot will be of 15 minute > Thanks. > This is a quote from Adam Johnson in the django-devel mailing list: Hi! > > I think you've found

Re: Not getting the URL of Update api

2020-10-12 Thread Matemática A3K
On Mon, Oct 12, 2020 at 6:52 AM Ashutosh Mishra wrote: > I have create update api in django,but i am not getting its api link in > postman Not sure what is the "api link" you are referring to, is it the link you expect to get in the "api summary" or is it a link you expect to get in the

Re: ModelSerializers -> OpenAPI components/schemas/ section?

2020-10-11 Thread Matemática A3K
On Sun, Oct 11, 2020 at 9:52 PM ad...@bit.io wrote: > Hi All, > > I use a number of ModelSerializers and would like my generated OpenAPI > schema to have a components/schema/ section that is referenced by > the responseBody section of my methods. Is this possible? This will make my >

Re: How to make my own model authentication and authorizations in Django Rest Framework

2020-10-03 Thread Matemática A3K
On Thu, Oct 1, 2020 at 1:24 AM Osama Imran wrote: > But I want to know people approaches how they proceed in this scenario as > you know there are tons of tutorial available but not suitable for my > requirements. > How people may approach this in a particular way is found in the tutorials you

Re: boolean field is not accepting data through postman

2020-09-30 Thread Matemática A3K
> > serializer > class TutorialSerializer(serializers.ModelSerializer): > > class Meta: > model=Tutorial > > fields=('id', > 'description', > 'title') > --> Probably because 'published' is missing in the available fields > def create(self,validated_data): > title = validated_data ['title'] >

Re: Create an invitation link using django rest framework?

2020-09-23 Thread Matemática A3K
On Mon, Sep 21, 2020 at 9:15 AM Pradyum Gupta wrote: > am looking for some advice/Mentorship. > > wanted to create an *invitation link for onboarding user to a company* > similarly > slack does by sending company employees email so that they could directly > join the company but using the

Re: How to POST nested objects

2018-02-26 Thread Matemática A3K
http://www.django-rest-framework.org/api-guide/relations/#writable-nested-serializers On Mon, Feb 26, 2018 at 7:46 AM, sakthi selvam wrote: > *models.py* > > class Question(models.Model): > id = models.UUIDField(primary_key=True, default=uuid.uuid4, >

Re: I am not able to get user from request.

2018-02-05 Thread Matemática A3K
On Thu, Feb 1, 2018 at 12:28 AM, Gautam Kumar wrote: > user = None > request = self.context.get("request") > > If it is on CBV, the request is available on self.request > if request and hasattr(request, "user"): > user = request.user > > in 2nd line i am getting

Re: Which is preferred place to write pre_save signal methods in rest_framework?

2018-01-27 Thread Matemática A3K
On Sat, Jan 27, 2018 at 5:42 PM, Matemática A3K <matematica@gmail.com> wrote: > > > On Sat, Jan 27, 2018 at 11:11 AM, Jason <jjohns98...@gmail.com> wrote: > >> My preference would be to create a signals.py file in the application and >> put your signal th

Re: Which is preferred place to write pre_save signal methods in rest_framework?

2018-01-27 Thread Matemática A3K
On Sat, Jan 27, 2018 at 11:11 AM, Jason wrote: > My preference would be to create a signals.py file in the application and > put your signal there, for maximum accessibly and ease of location. > Signals, despite the appearance, are not asynchronous, and one of the >

Re: Rest api logging

2018-01-17 Thread Matemática A3K
You may use Django's logging facilities https://docs.djangoproject.com/en/2.0/topics/logging/#django-request On Tue, Jan 16, 2018 at 4:13 PM, Dilip Maharjan wrote: > I am trying to log rest api, how do you usually go about it?since I used > ModelViewSet, I didn't find

Re: how to do crud useradmin in django rest framework

2017-11-21 Thread Matemática A3K
> url(r'^users/update/(?P[0-9]+)/$', views.UserUpdate.as_view()), > > Page not found (404) > Request Method: PUT > Request URL: http://127.0.0.1:8000/api/v1/users/update/2 > > Using the URLconf defined in colonybitbasics.urls, Django tried these URL > patterns, in this order: > >1. ^admin/