[Patchew-devel] [PATCH v2] Refactoring of UpdateProjectHeadView.handle()

Fam Zheng famz at redhat.com
Fri May 25 01:28:18 UTC 2018


On Thu, 05/24 18:09, Paolo Bonzini wrote:
> On 23/05/2018 21:16, Shubham Jain wrote:
> > moved and refactored the UpdateProjectHeadView.handle() into method of api.models.Project so that it can be re-used in rest conversion of update-project-head
> > ---
> >  api/models.py | 31 +++++++++++++++++++++++++++++++
> >  api/views.py  | 29 +++--------------------------
> >  2 files changed, 34 insertions(+), 26 deletions(-)
> > 
> > diff --git a/api/models.py b/api/models.py
> > index d602cb7..1a51a6d 100644
> > --- a/api/models.py
> > +++ b/api/models.py
> > @@ -171,6 +171,37 @@ class Project(models.Model):
> >      def get_subprojects(self):
> >          return Project.objects.filter(parent_project=self)
> >  
> > +    def get_project_head(self):
> > +        return self.get_property("git.head")
> > +
> > +    def set_project_head(self, new_head):
> > +        self.set_property("git.head", new_head)
> > +
> > +    project_head = property(get_project_head,set_project_head)

Please remember to add comma between parameters.

> 
> Fam, what do you think about making git.head a proper field in the
> model, rather than a property?

Yes, that makes sense to me.

> 
> Shubham, if Fam agrees, would you like to try it?  It's outside the REST
> API project, but it is an interesting experience with Django to write
> the migration code etc.
> 
> The patch looks okay to me - I cannot commit it right now, but perhaps
> Fam can do it for me?

Applied, thanks!

Fam




More information about the Patchew-devel mailing list