@pattmax/

Minty-Share

Django

A file sharing platform.

fork
loading
Files
  • main
    • views.py
    • __pycache__
    • migrations
    • forms.py
    • models.py
    • settings.py
    • urls.py
  • static
  • templates
  • db.sqlite3
main/views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from django.shortcuts import render
from django.shortcuts import redirect
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
from .forms import TorrentForm

# Create your views here.
def home(request):
		return render(request, 'main/index.html')

class SignUp(generic.CreateView):
    form_class = UserCreationForm
    success_url = reverse_lazy('login')
    template_name = 'registration/signup.html'

def upload(request):
    if request.method == 'POST':
        form = TorrentForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            return redirect('home')
    else:
        form = TorrentForm()
    return render(request, 'main/upload.html', {
        'form': form
    })

def displayUpload(request):
	return render(request, 'main/uploads.html')