+
+
+class ProfileTab(LoopBase):
+ def __init__(self, name, title, description, url_getter, private=False, weight=500):
+ super(ProfileTab, self).__init__(weight=weight)
+ self.name = name
+ self.title = title
+ self.description = description
+ self.url_getter = url_getter
+ self.private = private
+
+ def can_render(self, context):
+ return not self.private or (
+ context['view_user'] == context['request'].user or context['request'].user.is_superuser)
+
+ def update_context(self, context):
+ context.update(dict(
+ tab_name=self.name,
+ tab_title=self.title,
+ tab_description = self.description,
+ tab_url=self.url_getter(context['view_user'])
+ ))
\ No newline at end of file