Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
Hi Todor I am experiencing the same problem. Can you please post the possible solution? On Tuesday, October 10, 2017 at 8:26:32 AM UTC+5:30, Todor Velichkov wrote: > > It does? Can you give me a link to that please? >> > > Pard me, it does not explicitly say to set values programmatically, but

Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
> First we hide the the user field because we dont want the user to see it, > and at the same time keeping it inside form fields we wont prevent the > unique_together validation. > Second - we disable the field and programmatically set initial value to be > used during form

Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
On Sunday, September 23, 2018 at 11:55:41 PM UTC+5:30, Protik wrote: > > Hi, Todor > > I have tested this solution and It looks like it works only when you don't > disable the field (i.e the last line in the BookForm's `__init__()` method. > My views looks lik

Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
hat in > the form constructor (by settings initial value + disabled attr). > > On Sunday, September 23, 2018 at 9:25:41 PM UTC+3, Protik wrote: >> >> Hi, Todor >> >> I have tested this solution and It looks like it works only when you >> don't di

Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
hat in > the form constructor (by settings initial value + disabled attr). > > On Sunday, September 23, 2018 at 9:25:41 PM UTC+3, Protik wrote: >> >> Hi, Todor >> >> I have tested this solution and It looks like it works only when you >> don't disable the field (i

Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
hat in > the form constructor (by settings initial value + disabled attr). > > On Sunday, September 23, 2018 at 9:25:41 PM UTC+3, Protik wrote: >> >> Hi, Todor >> >> I have tested this solution and It looks like it works only when you >> don't disable the fiel

Re: ModelForm unique validation is not done right IMHO.

2018-09-23 Thread Protik
let > you do quick release for development and testing, user will be able try the > module and see if it solves their problems. In my opinion, something > generic won't help when validating unique_together relationship when one of > the fields is not exposed to the user. Bu

Re: ModelForm unique validation is not done right IMHO.

2018-09-24 Thread Protik
Yes, it is working now. Thank you very much. On Monday, September 24, 2018 at 1:43:00 PM UTC+5:30, Todor Velichkov wrote: > > Protik, just use `self.fields['user'].initial = user.id` instead of just > `user`. Just tested it and it work fine. > > On Monday, September 2