Пример #1
0
def edit_musician(request, artist_id):
    info_musician = Musician.objects.get(pk=artist_id)
    form = forms.MusicianForm(instance=info_musician)
    diction = {'form': form}
    if request.method == 'POST':
        form = forms.MusicianForm(request.POST, instance=info_musician)
        if form.is_valid():
            form.save(commit=True)
            return album_list(request, artist_id)
    return render(request, 'First_app/edit_musician.html', context=diction)
Пример #2
0
def edit_artist(request, artist_id):
    artist_info = Musician.objects.get(pk=artist_id)
    form = forms.MusicianForm(instance=artist_info)
    if request.method == 'POST':
        form = forms.MusicianForm(request.POST, instance=artist_info)
        if form.is_valid():
            form.save(commit=True)
            return album_list(request, artist_id)
    diction = {'edit_artist': form, 'artist_info': artist_info}
    return render(request, 'first_app/edit_artist.html', context=diction)
Пример #3
0
def musician_form(request):
    add_musician = forms.MusicianForm()
    diction = {'form': 'ADD Musician', 'add_musician': add_musician}
    if request.method == 'POST':
        add_musician = forms.MusicianForm(request.POST)
        if add_musician.is_valid():
            add_musician.save(commit=True)
            return index(request)

    return render(request, 'First_app/musician_form.html', context=diction)
Пример #4
0
def musician_form(request):
    form = forms.MusicianForm()
    if request.method == 'POST':
        form = forms.MusicianForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            return index(request)

    diction = {'title': "Add Musician", 'musician': form}
    return render(request, 'first_app/musician_form.html', context=diction)
Пример #5
0
def form(request):
    new_form = forms.MusicianForm()

    if request.method == 'POST':
        new_form = forms.MusicianForm(request.POST)

        if new_form.is_valid():
            new_form.save(commit=True)
            return index(request)
    diction = {'test_form': new_form, 'heading_1': 'Add new Musicians'}
    return render(request, 'first_app/form.html', context=diction)
def musician_form(request):
    mform = forms.MusicianForm()  #Creating a Musician form object

    if request.method == "POST":
        mform = forms.MusicianForm(request.POST)

        if mform.is_valid():
            mform.save(commit=True)
            return first(request)
    dic = {'title': "Add Musician", 'musician_form': mform}
    return render(request, 'first_app/musician_form.html', context=dic)
def edit_artist(request, artist_id):
    artist_info = Musician.objects.get(pk=artist_id)
    mform = forms.MusicianForm(
        instance=artist_info)  #Creates the form with the existing info
    if request.method == "POST":
        mform = forms.MusicianForm(request.POST, instance=artist_info)

        if mform.is_valid():
            mform.save(commit=True)
            return album_list(request, artist_id)

    dic = {'title': "Edit Information", 'edit_artist': mform}
    return render(request, 'first_app/edit_artist.html', context=dic)
Пример #8
0
def edit_artist(request, artist_id):
    artist_info = Musician.objects.get(pk=artist_id)
    # instance value gula load kore
    form = forms.MusicianForm(instance=artist_info)

    if request.method == 'POST':
        # ager value , porer shob gula ana lage
        form = forms.MusicianForm(request.POST, instance=artist_info)
        if form.is_valid():
            form.save(commit=True)
            return album_list(request, artist_id)

    diction = {'edit_form': form}
    return render(request, 'first_app/edit_artist.htm', context=diction)
Пример #9
0
def musician_form(request):
    form = forms.MusicianForm()

    # action for submit button
    if request.method == 'POST':
        # info gula shob form a overwrite
        form = forms.MusicianForm(request.POST)

        if form.is_valid():
            form.save(commit=True)
            return index(request)

    diction = {'title': "Add Musician", 'musician_form': form}
    return render(request, 'first_app/musician_form.htm', context=diction)
Пример #10
0
def editArtist(request, id):
    artist_info = Musician.objects.get(pk=id)
    new_form = forms.MusicianForm(instance=artist_info)

    if request.method == "POST":
        new_form = forms.MusicianForm(request.POST, instance=artist_info)
        if new_form.is_valid():
            new_form.save(commit=True)
            return albumList(request, artist_info.id)

    diction = {
        'title': "Edit Musician",
        'Musician_Form' : new_form
    }
    return render(request, 'first_app/edit_artist.html', context=diction)