use dry principle possible and added example project
This commit is contained in:
46 files changed
+3521
-772
No files matched your search
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Nepali Fields Demo - Add</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; margin: 20px; }
|
||||
.form-group { margin-bottom: 15px; }
|
||||
label { display: block; margin-bottom: 5px; }
|
||||
input, select { width: 300px; padding: 8px; }
|
||||
</style>
|
||||
{{ form.media }}
|
||||
</head>
|
||||
<body>
|
||||
<h1>Add New Person</h1>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="form-group">
|
||||
{{ field.label_tag }}
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<small style="color: grey">{{ field.help_text }}</small>
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<p style="color: red">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
<br>
|
||||
<a href="{% url 'demo:person-list' %}">Back to List</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,48 @@
|
||||
{% load nepali %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Nepali Fields Demo - List</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; margin: 20px; }
|
||||
table { border-collapse: collapse; width: 100%; }
|
||||
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
||||
th { background-color: #f2f2f2; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Person List</h1>
|
||||
<a href="{% url 'demo:person-create' %}">Add New Person</a>
|
||||
<hr>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Birth Date (BS)</th>
|
||||
<th>Birth Date (Devanagari)</th>
|
||||
<th>Phone</th>
|
||||
<th>Province</th>
|
||||
<th>District</th>
|
||||
<th>Municipality</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for person in persons %}
|
||||
<tr>
|
||||
<td>{{ person.name }}</td>
|
||||
<td>{{ person.birth_date|nepali_date }}</td>
|
||||
<td>{{ person.birth_date|nepali_date_ne }}</td>
|
||||
<td>{{ person.phone_number }}</td>
|
||||
<td>{{ person.province }}</td>
|
||||
<td>{{ person.district }}</td>
|
||||
<td>{{ person.municipality }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="7">No records found.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user