[RFC 3/3] models: Add 'Series' model and related models

Andy Doan andy.doan at linaro.org
Sat Apr 9 05:50:27 AEST 2016


On 04/01/2016 11:14 AM, Stephen Finucane wrote:
> Add a series model. This model is intentionally very minimal to allow
> as much dynaminism as possible. It is expected that patches will be
> migrated between series as new data is provided.
>
> Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
> ---

> diff --git a/patchwork/models.py b/patchwork/models.py

> + at python_2_unicode_compatible
> +class Series(models.Model):
> +
> +    group = models.ForeignKey(SeriesGroup, related_name='revisions',
> +                              related_query_name='revision', null=True,
> +                              blank=True)
> +    date = models.DateTimeField()
> +    submitter = models.ForeignKey(Person)

Given this is a 1-to-1 with a CoverLetter, date and submitter become 
duplicate data. date is just series.cover_letter.date.

> + at python_2_unicode_compatible
> +class SeriesReference(models.Model):
> +    """A reference found in a series.
> +
> +    Message IDs should be created for all patches in a series,
> +    including those of patches that have not yet been received. This is
> +    required to handle the case whereby one or more patches are
> +    received before the cover letter.
> +    """
> +    series = models.ForeignKey(Series, related_name='references',
> +                               related_query_name='reference')
> +    msgid = models.CharField(max_length=255, unique=True)
> +
> +    def __str__(self):
> +        return self.msgid

Having a little trouble envisioning how this gets used. I'm sure you've 
thought this out, but would it be possible to create some kind of 
"incomplete" or "future" Series object instead of needing this type of 
object?



More information about the Patchwork mailing list