Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # view
- def music_add(request, music_id=None):
- if music_id is not None:
- operationType = "Alteração"
- music = get_object_or_404(Music, pk=music_id)
- else:
- operationType = "Cadastro"
- music = None
- { ... }
- if music_id:
- context = {'form':form, 'music_id':music_id, 'operationType':operationType,}
- else:
- context = {'form':form, 'operationType':operationType,}
- return render(request, 'repertory/music_add.html', context)
- # template
- <h2>{{ operationType }} de Música</h2>
- {% if music_id %}
- <form enctype="multipart/form-data" action="{% url 'repertory:music_edit' music_id %}" method="post">
- {% else %}
- <form enctype="multipart/form-data" action="{% url 'repertory:music_add' %}" method="post">
- { ... }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement