def delete(request, remote): if request.method == 'POST': form = DeleteConfirmForm(request.POST) if form.is_valid(): remote.delete() return redirect('project_remotes', project=remote.project.name) else: form = DeleteConfirmForm() view = ProjectView(request, remote.project, ('remote', 'delete')) view.title = ("Delete remote", ('remote', remote.name)) view.activetab = 'remotes' view.set(remote=remote, form=form) view.crumb(remote) view.crumb('Delete') return view()
def project(request, project): project = get_object_or_404(Project, name=project) remotes = Remote.objects.filter(project=project) view = ProjectView(request, project, ('remote', 'project')) view.title = (('project', "%s's" % project.name), "remotes") view.activetab = 'remotes' view.set(remotes=remotes) view.crumb(Remote(project=project)) return view()
def create(request, project): project = get_object_or_404(Project, name=project) if request.method == 'POST': form = RemoteForm(request.POST) if form.is_valid(): remote = form.save(commit=False) remote.project = project remote.user = request.currentuser remote.name = sha1("%s %s %s" % (remote.user.username, remote.url, uuid.uuid4().hex)).hexdigest() project.git.add_remote(remote.name, remote.url) remote.save() return redirect('remote', project=project.name, ID=remote.name) else: form = RemoteForm() view = ProjectView(request, project, ('remote', 'create')) view.title = ("Add remote to", ('project', project.name)) view.activetab = 'addremote' view.set(add_form=form) view.crumb(Remote(project=project), 'Create') return view()
def create(request, project): project = get_object_or_404(Project, name=project) if request.method == 'POST': form = RemoteForm(request.POST) if form.is_valid(): remote = form.save(commit=False) remote.project = project remote.user = request.currentuser remote.name = sha1( "%s %s %s" % (remote.user.username, remote.url, uuid.uuid4().hex ) ).hexdigest() project.git.add_remote(remote.name, remote.url) remote.save() return redirect('remote', project=project.name, ID=remote.name) else: form = RemoteForm() view = ProjectView(request, project, ('remote', 'create')) view.title = ("Add remote to", ('project', project.name)) view.activetab = 'addremote' view.set(add_form=form) view.crumb(Remote(project=project), 'Create') return view()
def show(request, remote): view = ProjectView(request, remote.project, ('remote', 'show')) view.title = ("Remote", ('remote', remote.name)) view.activetab = 'remotes' view.set(project=remote.project, remote=remote) view.add_button(href=reverse('remote_fetch', kwargs={ 'project': remote.project.name, 'ID': remote.name }) + "?fromui=1", post=True, text='Fetch') if remote.user == request.currentuser: view.add_button(href=reverse('remote_delete', kwargs={ 'project': remote.project.name, 'ID': remote.name }), text='Delete') view.crumb(remote) view.use('remote-fetch-progress-alert') return view()
def show(request, project, commit): view = ProjectView(request, project, ('commit', 'show')) view.title = ("Commit", ('commit', commit.sha1)) view.set(commit=commit) view.crumb(commit) return view()