#2848 Forks sorted according to the dates
Merged 6 years ago by pingou. Opened 6 years ago by chocos.
chocos/pagure stats  into  master

model.py changed to sort the forks
Neha Kandpal • 6 years ago  
file modified
+8 -1
@@ -386,7 +386,14 @@ 

                               default=datetime.datetime.utcnow)

      date_modified = sa.Column(sa.DateTime, nullable=False,

                                default=datetime.datetime.utcnow)

-     parent = relation('Project', remote_side=[id], backref='forks')

+     parent = relation(

+         'Project',

+         remote_side=[id],

+         backref=backref(

+             "forks",

+             order_by="(projects.c.date_created).desc()"

+         )

+     )

      user = relation('User', foreign_keys=[user_id],

                      remote_side=[User.id], backref='projects')

      private = sa.Column(sa.Boolean, nullable=False, default=False)

I think templates/forks.html is not required .

rebased onto b09886ae897292134edfe3afea1ce506afb4c90d

6 years ago

A better fix would be aot add the sorting the model itself where the relation is defined, so at: https://pagure.io/pagure/blob/master/f/pagure/lib/model.py#_389 using somethling like what's in: https://pagure.io/pagure/blob/master/f/pagure/lib/model.py#_430

rebased onto 8cdcd7d

6 years ago

rebased onto 9925f9d738db103f6e377b1d34b6eee334dcacd6

6 years ago

changes updated as suggested by pingou and batman

there should be space after ','

1 new commit added

  • indented
6 years ago

1 new commit added

  • indentation updated
6 years ago

rebased onto 55bf77b

6 years ago

:thumbsup: and @pingou , forks.html is not required now right? (as @chocos said in the initial comment)

Looks good to me, thanks! :)

Pull-Request has been merged by pingou

6 years ago