Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 57 additions & 16 deletions cmp/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,62 @@ class Meta:


class editPowCampForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.label_class = 'form-label'
name = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input'
})
)
nearest_city = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input'
}),
required=False
)
notes = forms.CharField(
widget=forms.Textarea(attrs={
'class': 'wide-input'
}),
required=False
)
wartime_country = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input'
}),
required=False
)
latitude = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input'
}),
required=False
)
longitude = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input'
}),
required=False
)

class Meta:
model = PowCamp
fields = "__all__"
fields = '__all__'


class editCemeteryForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.label_class = 'form-label'
name = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input',
'style': 'width: 500px;'
})
)
country = forms.ModelChoiceField(
queryset=Country.objects.all().order_by('name'),
empty_label="Select a country"
)

class Meta:
model = Cemetery
fields = "__all__"
model = Cemetery
fields = ['name', 'country', 'latitude', 'longitude']


class editCountryForm(forms.ModelForm):
Expand Down Expand Up @@ -90,13 +129,15 @@ class Meta:


class editRankForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.label_class = 'form-label'
name = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'wide-input',
})
)

class Meta:
model = Rank
fields = "__all__"
fields = '__all__'


class editSoldierDeathForm(forms.ModelForm):
Expand Down
8 changes: 8 additions & 0 deletions cmp/static/cmp/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,12 @@
.ellipsis {
color: #666;
font-weight: 600;
}

.wide-input {
width: 500px !important; /* Same width as cemetery form */
max-width: 100%;
padding: 8px;
margin: 5px 0;
box-sizing: border-box;
}
44 changes: 23 additions & 21 deletions cmp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


urlpatterns = [
# For creating new records (no ID)
# ... your other URL patterns ...

path("", views.index, name="index"),
path('soldier/<int:soldier_id>/', views.soldier, name='soldier'),
Expand Down Expand Up @@ -37,33 +37,39 @@

# Companies
path("mgmt/companies", views.edit_companies, name="edit-companies"),
path("mgmt/companies/<int:company_id>/", views.detail_companies, name="companies"),
path("mgmt/companies/edit/<int:company_id>", views.edit_companies, name="edit-companies"),
path("mgmt/companies/<int:id>/", views.detail_companies, name="companies"),
path("mgmt/companies/edit/<int:id>/", views.edit_companies, name='edit-companies'),
path("mgmt/companies/search/", views.search_companies, name='search-companies'),
path('mgmt/companies/delete/<int:id>/', views.delete_company, name='delete-company'),

# Decorations
path("mgmt/decorations", views.edit_decorations, name="edit-decorations"),
path("mgmt/decorations/<int:decoration_id>/", views.detail_decorations, name="decorations"),
path("mgmt/decorations/edit/<int:decoration_id>", views.edit_decorations, name="edit-decorations"),
path("mgmt/decorations/edit/", views.edit_decorations, name="add-decoration"),
path("mgmt/decorations/search/", views.search_decorations, name='search-decorations'),
path("mgmt/decorations/delete/<int:id>/", views.delete_decoration, name='delete-decoration'),

# Cemeteries
path("mgmt/cemeteries", views.edit_cemeteries, name="edit-cemeteries"),
path("mgmt/cemeteries/<int:cemetery_id>/", views.detail_cemeteries, name="cemeteries"),
path("mgmt/cemeteries/edit/<int:cemetery_id>", views.edit_cemeteries, name="edit-cemeteries"),
path("mgmt/cemeteries/edit/<int:id>/", views.edit_cemeteries, name='edit-cemetery'),
path("mgmt/cemeteries/edit/", views.edit_cemeteries, name='add-cemetery'),
path("mgmt/cemeteries/search/", views.search_cemeteries, name='search-cemeteries'),
path("mgmt/cemeteries/delete/<int:id>/", views.delete_cemetery, name="delete-cemetery"),

# POW Camps
path("mgmt/prisoner-of-war-camps", views.edit_powcamps, name="edit-powcamps"),
path("mgmt/prisoner-of-war-camps/<int:powcamp_id>/", views.detail_powcamps, name="powcamps"),
path("mgmt/prisoner-of-war-camps/edit/<int:powcamp_id>", views.edit_powcamps, name="edit-prisoner-of-war-camps"),
path("mgmt/prisoner-of-war-camps/search/", views.search_powcamps, name='search-prisoner-of-war-camps'),
path("mgmt/pow-camps/search/", views.search_powcamps, name='search-powcamps'),
path("mgmt/pow-camps/edit/<int:id>/", views.edit_powcamps, name='edit-powcamps'),
path("mgmt/pow-camps/edit/", views.edit_powcamps, name='edit-powcamps'),
path("mgmt/pow-camps/delete/<int:id>/", views.delete_powcamp, name='delete-powcamp'),

# Ranks
path("mgmt/ranks", views.edit_ranks, name="edit-ranks"),
path("mgmt/ranks/<int:rank_id>/", views.detail_ranks, name="ranks"),
path("mgmt/ranks/edit/<int:rank_id>", views.edit_ranks, name="edit-ranks"),
path('mgmt/ranks/search/', views.search_ranks, name='search-ranks'),
path("mgmt/ranks/search/", views.search_ranks, name='search-ranks'),
path("mgmt/ranks/edit/<int:id>/", views.edit_ranks, name='edit-ranks'),
path("mgmt/ranks/edit/", views.edit_ranks, name='add-rank'),
path("mgmt/ranks/delete/<int:id>/", views.delete_rank, name='delete-rank'),
path("mgmt/ranks/<int:id>/", views.detail_ranks, name="ranks"),

# Acknowledgements
path("mgmt/acknowledgement/<int:acknowledgement_id>/", views.detail_acknowledgement, name="acknowledgement"),
Expand All @@ -80,15 +86,11 @@
path('soldiers/', views.soldiers, name='soldiers'),

# Soldier management
path("mgmt/soldiers", views.edit_soldiers, name="soldiersa"),
path("mgmt/soldiers/<int:soldier_id>/", views.detail_soldiers, name="soldiersb"),
path("mgmt/soldiers/edit/<int:soldier_id>", views.edit_soldiers, name="edit-soldiers"),
path('mgmt/soldiers/search/', views.search_soldiers, name='search-soldiers'),


#path("soldier-search/", views.soldier_search, name="soldier-search" ),
#path("soldier-search/<str:surname>" , views.soldier_search , name="soldier-search" ),

path("mgmt/soldiers/search/", views.search_soldiers, name='search-soldiers'),
path("mgmt/soldiers/edit/<int:id>/", views.edit_soldier, name='edit-soldier'),
path("mgmt/soldiers/edit/", views.edit_soldier, name='edit-soldier'),
path("mgmt/soldiers/delete/<int:id>/", views.delete_soldier, name='delete-soldier'),
path("mgmt/soldiers/<int:id>/", views.detail_soldiers, name='soldier-detail'),

]

Expand Down
Loading