[PATCH v2 01/10] models: Resolve issues with Patch.state
Finucane, Stephen
stephen.finucane at intel.com
Fri Oct 2 01:26:53 AEST 2015
> On Thu, Oct 01, 2015 at 04:14:23PM +0100, Finucane, Stephen wrote:
> > > On Thu, Oct 01, 2015 at 03:52:25PM +0100, Stephen Finucane wrote:
> > > > @@ -243,7 +243,7 @@ class Patch(models.Model):
> > > > date = models.DateTimeField(default=datetime.datetime.now)
> > > > submitter = models.ForeignKey(Person)
> > > > delegate = models.ForeignKey(User, blank = True, null = True)
> > > > - state = models.ForeignKey(State,
> > > default=get_default_initial_patch_state)
> > > > + state = models.ForeignKey(State, null=True)
> > >
> > > I was wondering, is it necessary to change the null contraint here?
> >
> > To the best of my knowledge, yes. We need a default but we don't
> > always have any entries in the 'State' table (for example, when
> > testing). As a result the only possible "default" is None. Note that
> > this will never be set to a null value however due to the additions to
> > the 'save' function.
>
> I guess it's a bit weird to weaken the db schema for the testing use
> case but it's doesn't really matter much to me. By the way this patch
> already had an a-b tag from me.
Agreed - it wouldn't have been my first choice but it ended up being the only viable one.
> Acked-by: Damien Lespiau <damien.lespiau at intel.com>
Thanks for the review!
> --
> Damien
More information about the Patchwork
mailing list