[PATCH v6 2/8] models: Add 'SeriesRevision' model

Stephen Finucane stephen at that.guru
Wed Oct 26 23:54:42 AEDT 2016


On 2016-10-26 08:54, Andrew Donnellan wrote:
> On 16/10/16 23:50, Stephen Finucane wrote:
>> Add a series revision model. This model is expected to act like a
>> collection for patches, similar to bundles but thread-orientated.
>> 
>> Signed-off-by: Stephen Finucane <stephen at that.guru>
> 
> Looking pretty good! A few minor things below. I mostly won't repeat
> stuff that Daniel pointed out.
> 
> Otherwise, with Daniel's comments fixed:
> 
> Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

[snip]

>>      @property
>> +    def series(self):
>> +        """Get a simple series reference.
>> +
>> +        Return the last series revision that (ordered by date) that
>> +        this submission is a member of.
>> +
>> +        .. warning::
>> +          Be judicious in your use of this. For example, do not use 
>> it
>> +          in list templates as doing so will result in a new query 
>> for
>> +          each item in the list.
>> +        """
>> +        # NOTE(stephenfin): We don't use 'latest()' here, as this can 
>> raise an
>> +        # exception if no series revisions exist
>> +        return self.series_revisions.order_by('-date').first()
>> +
> 
> When versioning gets added later on, are you planning on calling the
> series group model "Series" as per v2? (FWIW after thinking about it
> for a bit I think I like the v1 naming better than the v2 naming, but
> I digress...)

I'd prefer the 'Series' and 'SeriesGroup' names also, given how we're 
doing versioning. Daniel - any thoughts on going back to that naming?

> If so, calling this method "series()" and having it return a
> SeriesRevision is a bit confusing.

Good call - I'll go with 'latest_series' if I rename SeriesRevision -> 
Series, else 'latest_series_revision'.

Stephen


More information about the Patchwork mailing list