mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-21 10:30:03 +00:00
Some updates
This commit is contained in:
parent
339f9796d7
commit
c81a9bc23c
15
views.py
15
views.py
@ -193,8 +193,9 @@ class RepoMixin(object):
|
|||||||
return get_ccnetapplet_root()
|
return get_ccnetapplet_root()
|
||||||
|
|
||||||
def get_current_commit(self):
|
def get_current_commit(self):
|
||||||
# Implemented in subclasses.
|
# Get newest commit by default, subclasses can override this method.
|
||||||
pass
|
current_commit = get_commits(self.repo.id, 0, 1)[0]
|
||||||
|
return current_commit
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
return reverse('repo', args=[self.repo_id])
|
return reverse('repo', args=[self.repo_id])
|
||||||
@ -231,6 +232,9 @@ class RepoMixin(object):
|
|||||||
|
|
||||||
class RepoView(CtxSwitchRequiredMixin, RepoMixin, TemplateResponseMixin,
|
class RepoView(CtxSwitchRequiredMixin, RepoMixin, TemplateResponseMixin,
|
||||||
BaseFormView):
|
BaseFormView):
|
||||||
|
"""
|
||||||
|
View to show repo page and handle post request to decrypt repo.
|
||||||
|
"""
|
||||||
form_class = RepoPassowrdForm
|
form_class = RepoPassowrdForm
|
||||||
template_name = 'repo.html'
|
template_name = 'repo.html'
|
||||||
|
|
||||||
@ -256,10 +260,6 @@ class RepoView(CtxSwitchRequiredMixin, RepoMixin, TemplateResponseMixin,
|
|||||||
is_group_user(x.id, self.user.username)]
|
is_group_user(x.id, self.user.username)]
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
def get_current_commit(self):
|
|
||||||
current_commit = get_commits(self.repo.id, 0, 1)[0]
|
|
||||||
return current_commit
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs['repo'] = self.repo
|
kwargs['repo'] = self.repo
|
||||||
kwargs['can_access'] = self.can_access
|
kwargs['can_access'] = self.can_access
|
||||||
@ -276,6 +276,9 @@ class RepoView(CtxSwitchRequiredMixin, RepoMixin, TemplateResponseMixin,
|
|||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
class RepoHistoryView(CtxSwitchRequiredMixin, RepoMixin, TemplateView):
|
class RepoHistoryView(CtxSwitchRequiredMixin, RepoMixin, TemplateView):
|
||||||
|
"""
|
||||||
|
View to show repo page in history.
|
||||||
|
"""
|
||||||
template_name = 'repo_history_view.html'
|
template_name = 'repo_history_view.html'
|
||||||
|
|
||||||
def get_current_commit(self):
|
def get_current_commit(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user