Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @register.filter(name='set_or_redirect')
- def set_or_redirect(objects):
- address = 'ул. ' + str(objects.street) + ' д.' + str(objects.building)
- try:
- if objects.subdivision_polyclinics != None :
- if objects.subdivision_polyclinics.redirect:
- return '<a href="{}">Редирект</a>'.format(objects.subdivision_polyclinics.redirect)
- else:
- if objects.polyclinic.redirect:
- return '<a href="{}">Редирект</a>'.format(objects.polyclinic.redirect)
- else:
- return '<a href="/new-write/{}/{}/">Записать</a>'.format( objects.polyclinic.id,address )
- return '<a href="/new-write/{}/{}/">Записать</a>'.format(objects.polyclinic.id,address )
- else:
- return '<a href="/new-write/{}/{}/">Записать</a>'.format(objects.polyclinic.id,address )
- except Exception as e:
- return '<a href="/new-write/{}/{}/">Записать</a>'.format(objects.polyclinic.id,address)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement