def _archive_entry_year(self, category):
        " Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category "
        year = getattr(settings, 'ARCHIVE_ENTRY_YEAR', None)
        if not year:
            n = now()
            try:
                year = Listing.objects.filter(
                        category__site__id=settings.SITE_ID,
                        category__tree_path__startswith=category.tree_path,
                        publish_from__lte=n
                    ).values('publish_from')[0]['publish_from'].year
            except:
                year = n.year
        return year
def _archive_entry_year ( self , category ) : year = getattr ( settings , 'ARCHIVE_ENTRY_YEAR' , None ) if not year : n = now ( ) try : year = Listing . objects . filter ( category__site__id = settings . SITE_ID , category__tree_path__startswith = category . tree_path , publish_from__lte = n ) . values ( 'publish_from' ) [ 0 ] [ 'publish_from' ] . year except : year = n . year return year
Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category