Renomeações "new"->"create"
Padronizado todos os arquivos.html, rotas e funções a utilizarem o termo "create" ao invés de "new" para ação de criar um registro. Anteriormente ambos os termos eram utilizados, gerando inconsistência e confusão.
This commit is contained in:
1 parent
ae0483ddf1
commit
04fc99bd3e
14 files changed
+27
-27
No files matched your search
@@ -26,7 +26,7 @@ def _get_batch_by_id(request, batch_id):
|
|||||||
return get_object_or_404(Batch, pk=batch_id, is_active=True)
|
return get_object_or_404(Batch, pk=batch_id, is_active=True)
|
||||||
|
|
||||||
# Animal Services
|
# Animal Services
|
||||||
def get_animal_new_context():
|
def get_animal_create_context():
|
||||||
form = AnimalCreateForm()
|
form = AnimalCreateForm()
|
||||||
|
|
||||||
context = {}
|
context = {}
|
||||||
@@ -91,7 +91,7 @@ def delete_animal(request, animal_id):
|
|||||||
|
|
||||||
|
|
||||||
# Batch Services
|
# Batch Services
|
||||||
def get_batch_new_context(request):
|
def get_batch_create_context(request):
|
||||||
form = BatchForm()
|
form = BatchForm()
|
||||||
form.fields['animals'].queryset = _get_farms_active_animals(request)
|
form.fields['animals'].queryset = _get_farms_active_animals(request)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def get_farm_home_context(request):
|
|||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
def get_farm_new_context():
|
def get_farm_create_context():
|
||||||
form = FarmCreateForm()
|
form = FarmCreateForm()
|
||||||
|
|
||||||
context = {}
|
context = {}
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,11 +8,11 @@ urlpatterns = [
|
|||||||
path('list/', AnimalListView.as_view(), name='animal_list'),
|
path('list/', AnimalListView.as_view(), name='animal_list'),
|
||||||
path('batch/list/', BatchListView.as_view(), name='batch_list'),
|
path('batch/list/', BatchListView.as_view(), name='batch_list'),
|
||||||
|
|
||||||
path('new/', views.animal_new, name='animal_create'),
|
path('create/', views.animal_create, name='animal_create'),
|
||||||
path('update/<int:animal_id>', views.animal_update, name='animal_update'),
|
path('update/<int:animal_id>', views.animal_update, name='animal_update'),
|
||||||
path('delete/<int:animal_id>', views.animal_delete, name='animal_delete'),
|
path('delete/<int:animal_id>', views.animal_delete, name='animal_delete'),
|
||||||
|
|
||||||
path('batch/new/', views.batch_new, name='batch_create'),
|
path('batch/create/', views.batch_create, name='batch_create'),
|
||||||
path('batch/update/<int:batch_id>', views.batch_update, name='batch_update'),
|
path('batch/update/<int:batch_id>', views.batch_update, name='batch_update'),
|
||||||
path('batch/delete/<int:batch_id>', views.batch_delete, name='batch_delete'),
|
path('batch/delete/<int:batch_id>', views.batch_delete, name='batch_delete'),
|
||||||
]
|
]
|
||||||
@@ -9,15 +9,15 @@ urlpatterns = [
|
|||||||
path('paddock/list/', PaddockListView.as_view(), name='paddock_list'),
|
path('paddock/list/', PaddockListView.as_view(), name='paddock_list'),
|
||||||
path('paddock/group/list/', PaddockGroupListView.as_view(), name='paddock_group_list'),
|
path('paddock/group/list/', PaddockGroupListView.as_view(), name='paddock_group_list'),
|
||||||
|
|
||||||
path('new/', views.farm_new, name='farm_create'),
|
path('create/', views.farm_create, name='farm_create'),
|
||||||
path('update/<int:farm_id>', views.farm_update, name='farm_update'),
|
path('update/<int:farm_id>', views.farm_update, name='farm_update'),
|
||||||
path('delete/<int:farm_id>', views.farm_delete, name='farm_delete'),
|
path('delete/<int:farm_id>', views.farm_delete, name='farm_delete'),
|
||||||
|
|
||||||
path('paddock/new/', views.paddock_new, name='paddock_create'),
|
path('paddock/create/', views.paddock_create, name='paddock_create'),
|
||||||
path('paddock/update/<int:paddock_id>', views.paddock_update, name='paddock_update'),
|
path('paddock/update/<int:paddock_id>', views.paddock_update, name='paddock_update'),
|
||||||
path('paddock/delete/<int:paddock_id>', views.paddock_delete, name='paddock_delete'),
|
path('paddock/delete/<int:paddock_id>', views.paddock_delete, name='paddock_delete'),
|
||||||
|
|
||||||
path('paddock_group/new/', views.paddock_group_new, name='paddock_group_create'),
|
path('paddock_group/create/', views.paddock_group_create, name='paddock_group_create'),
|
||||||
path('paddock_group/update/<int:paddock_group_id>', views.paddock_group_update, name='paddock_group_update'),
|
path('paddock_group/update/<int:paddock_group_id>', views.paddock_group_update, name='paddock_group_update'),
|
||||||
path('paddock_group/delete/<int:paddock_group_id>', views.paddock_group_delete, name='paddock_group_delete'),
|
path('paddock_group/delete/<int:paddock_group_id>', views.paddock_group_delete, name='paddock_group_delete'),
|
||||||
]
|
]
|
||||||
@@ -8,6 +8,6 @@ app_name = 'rotation'
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', RotationListView.as_view(), name='rotation_home'),
|
path('', RotationListView.as_view(), name='rotation_home'),
|
||||||
|
|
||||||
path('new/', views.rotation_create, name='rotation_create'),
|
path('create/', views.rotation_create, name='rotation_create'),
|
||||||
path('delete/<int:rotation_id>', views.rotation_delete, name='rotation_delete'),
|
path('delete/<int:rotation_id>', views.rotation_delete, name='rotation_delete'),
|
||||||
]
|
]
|
||||||
@@ -6,16 +6,16 @@ from ..services import animal as services
|
|||||||
|
|
||||||
# Animal Views
|
# Animal Views
|
||||||
@farm_required
|
@farm_required
|
||||||
def animal_new(request):
|
def animal_create(request):
|
||||||
context = services.get_animal_new_context()
|
context = services.get_animal_create_context()
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render(request, 'animal/animal_new.html', context)
|
return render(request, 'animal/animal_create.html', context)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if services.create_animal(request):
|
if services.create_animal(request):
|
||||||
return redirect('entities:animal:animal_list')
|
return redirect('entities:animal:animal_list')
|
||||||
context['error'] = "Não foi possível registrar o animal"
|
context['error'] = "Não foi possível registrar o animal"
|
||||||
return render(request, 'animal/animal_new.html', context)
|
return render(request, 'animal/animal_create.html', context)
|
||||||
|
|
||||||
|
|
||||||
@farm_required
|
@farm_required
|
||||||
@@ -45,16 +45,16 @@ def animal_delete(request, animal_id):
|
|||||||
|
|
||||||
# Batch Views
|
# Batch Views
|
||||||
@farm_required
|
@farm_required
|
||||||
def batch_new(request):
|
def batch_create(request):
|
||||||
context = services.get_batch_new_context(request)
|
context = services.get_batch_create_context(request)
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render(request, 'batch/batch_new.html', context)
|
return render(request, 'batch/batch_create.html', context)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if services.create_batch(request):
|
if services.create_batch(request):
|
||||||
return redirect('entities:animal:batch_list')
|
return redirect('entities:animal:batch_list')
|
||||||
context['error'] = "Não foi possível criar o lote"
|
context['error'] = "Não foi possível criar o lote"
|
||||||
return render(request, 'batch/batch_new.html', context)
|
return render(request, 'batch/batch_create.html', context)
|
||||||
|
|
||||||
|
|
||||||
@farm_required
|
@farm_required
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ def farm_home(request):
|
|||||||
|
|
||||||
|
|
||||||
@farm_required
|
@farm_required
|
||||||
def farm_new(request):
|
def farm_create(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
context = services.get_farm_new_context()
|
context = services.get_farm_create_context()
|
||||||
return render(request, 'farm/farm_new.html', context)
|
return render(request, 'farm/farm_create.html', context)
|
||||||
|
|
||||||
elif request.method == 'POST':
|
elif request.method == 'POST':
|
||||||
success = services.create_farm(request)
|
success = services.create_farm(request)
|
||||||
@@ -44,10 +44,10 @@ def farm_delete(request, farm_id):
|
|||||||
|
|
||||||
# Paddock Views
|
# Paddock Views
|
||||||
@farm_required
|
@farm_required
|
||||||
def paddock_new(request):
|
def paddock_create(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
context = services.get_paddock_new_context()
|
context = services.get_paddock_create_context()
|
||||||
return render(request, 'paddock/paddock_new.html', context)
|
return render(request, 'paddock/paddock_create.html', context)
|
||||||
|
|
||||||
elif request.method == 'POST':
|
elif request.method == 'POST':
|
||||||
success = services.create_paddock(request)
|
success = services.create_paddock(request)
|
||||||
@@ -77,10 +77,10 @@ def paddock_delete(request, paddock_id):
|
|||||||
|
|
||||||
# Paddock Group Views
|
# Paddock Group Views
|
||||||
@farm_required
|
@farm_required
|
||||||
def paddock_group_new(request):
|
def paddock_group_create(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
context = services.get_paddock_group_new_context()
|
context = services.get_paddock_group_create_context()
|
||||||
return render(request, 'paddock_group/paddock_group_new.html', context)
|
return render(request, 'paddock_group/paddock_group_create.html', context)
|
||||||
|
|
||||||
elif request.method == 'POST':
|
elif request.method == 'POST':
|
||||||
success = services.create_paddock_group(request)
|
success = services.create_paddock_group(request)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ def rotation_home(request):
|
|||||||
|
|
||||||
@farm_required
|
@farm_required
|
||||||
def rotation_create(request):
|
def rotation_create(request):
|
||||||
return render(request, 'rotation/rotation_new.html')
|
return render(request, 'rotation/rotation_create.html')
|
||||||
|
|
||||||
@farm_required
|
@farm_required
|
||||||
def rotation_delete(request):
|
def rotation_delete(request):
|
||||||
|
|||||||
Reference in new issue
Block a user