Esempio n. 1
0
def upload(request):
    artist = request.user.artist

    if request.method == 'POST':
        fee = get_fee(artist)
        form = UploadListing(request.POST, request=request)
        if form.is_valid():
            listing = form.save(artist, request.POST)
            messages.add_message(request, messages.INFO,
                _("Your listing %s has been successfully created and submitted for review. Your listing will go live within the next couple of hours.") % listing.title)
            return HttpResponseRedirect(reverse('all_listing'))

    else:
        form = UploadListing()
        fee = get_fee(artist)

    return render(request, 'artists/upload.html', {'artist': artist, "form": form, "fee": fee})
Esempio n. 2
0
def upload(request):
    artist = request.user.artist
    
    if request.method == 'POST':
        form = UploadListing(request.POST, request=request)
        if form.is_valid():
            listing = form.save(artist, request.POST)
            messages.add_message(request, messages.INFO,
                    "You have successfully created %s. Your listing is currently in under review. This may take up to a couple of hours." % listing.title)
            return HttpResponseRedirect(reverse('all_listing'))

    else:
        form = UploadListing()
    return render(request, 'artists/upload.html', {'artist': artist, "form": form})
Esempio n. 3
0
def upload(request):
    artist = request.user.artist

    if request.method == 'POST':
        fee = get_fee(artist)
        form = UploadListing(request.POST, request=request)
        if form.is_valid():
            listing = form.save(artist, request.POST)
            messages.add_message(
                request, messages.INFO,
                _("Your listing %s has been successfully created and submitted for review. Your listing will go live within the next couple of hours."
                  ) % listing.title)
            return HttpResponseRedirect(reverse('all_listing'))

    else:
        form = UploadListing()
        fee = get_fee(artist)

    return render(request, 'artists/upload.html', {
        'artist': artist,
        "form": form,
        "fee": fee
    })
Esempio n. 4
0
def sign_up(request):
    if request.GET.get("step") == '2':
        if request.method == "POST":

            form = ArtistDetails(request.POST, request.FILES, artist=request.user.artist)

            if form.is_valid():
                data = form.cleaned_data
                cropped_image = data['cropped_image']
                user = request.user
                
                if data["avatar"]:
                    path = form.handle_uploaded_file(cropped_image,user)
                    artist = Artist.objects.filter(user=request.user).update(style=int(data['style']),
                        specific_style=data["specific_style"],
                        avatar=path,
                        description=data['description'],
                        step=3,
                        )
                else:
                    artist = Artist.objects.filter(user=request.user).update(style=int(data['style']),
                        specific_style=data["specific_style"],
                        description=data['description'],
                        step=3,
                        )
                return HttpResponseRedirect(reverse('artists_sign_up')+"?step=3")

        else:
            form = ArtistDetails()

    elif request.GET.get("step") == '3':
        if request.method == "POST":

            form = LocationArtistDetails(request.POST)

            if form.is_valid():
                data = form.cleaned_data
                artist = Artist.objects.filter(user=request.user).update(
                            lat=data["lat"],
                            lng=data["lng"],
                            mobile_number=data['mobile_number'],
                            step=4,
                            )
                return HttpResponseRedirect(reverse('artists_sign_up')+"?step=4")
        else:
            form = LocationArtistDetails()

    elif request.GET.get("step") == '4':
        if request.method == "POST":
            artist = request.user.artist
            form = UploadListing(request.POST, request=request)

            if form.is_valid():
                data = form.cleaned_data
                listing = form.save(artist, request.POST)
                messages.add_message(request, messages.INFO,
                    "You have successfully created %s. Your listing is currently in under review. This may take up to a couple of hours." % listing.title)
                artist.step = 0
                artist.save()
                return HttpResponseRedirect(reverse('all_listing'))
        else:
            form = UploadListing()

    else:
        if request.method == "POST":

            request.GET.get("step")
            form = ArtistForm(request.POST)

            if form.is_valid():
                data = form.cleaned_data
                form.save()
                user = authenticate(
                    email=data['email'], password=data['password'])
                artist = Artist.objects.create(user=user);
                ReceiverAccount.objects.create(user=user, paypal_email=user.email)
                WorkTime.objects.create(artist=artist)

                if user is not None and user.is_active:
                        artist.step = 2
                        artist.save()
                        auth_login(request, user)
                        send_email(case=1, receiver=user)
                        return HttpResponseRedirect(reverse('artists_sign_up')+"?step=2")
        else:
            form = ArtistForm()

    return render(request, 'artists/sign_up.html', {'form': form})