Fixes for the icon in the eventtypes

This commit is contained in:
Vivek
2025-12-20 02:28:15 +05:30
parent 2d43d4b1e3
commit d1e618e06b
4 changed files with 32 additions and 20 deletions

View File

@@ -50,8 +50,8 @@ MIDDLEWARE = [
CORS_ALLOWED_ORIGINS = [ CORS_ALLOWED_ORIGINS = [
"http://localhost:5173", "http://localhost:5173",
"https://prototype.eventifyplus.com/", "https://prototype.eventifyplus.com",
"https://eventifyplus.com/" "https://eventifyplus.com"
] ]
ROOT_URLCONF = 'eventify.urls' ROOT_URLCONF = 'eventify.urls'
@@ -74,24 +74,24 @@ TEMPLATES = [
WSGI_APPLICATION = 'eventify.wsgi.application' WSGI_APPLICATION = 'eventify.wsgi.application'
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql', 'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'eventify_uat_db', # your DB name 'NAME': BASE_DIR / 'db.sqlite3',
'USER': 'eventify_uat', # your DB user
'PASSWORD': 'eventifyplus@!@#$', # your DB password
'HOST': '0.0.0.0', # or IP/domain
'PORT': '5440', # default PostgreSQL port
} }
} }
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'eventify_uat_db', # your DB name
# 'USER': 'eventify_uat', # your DB user
# 'PASSWORD': 'eventifyplus@!@#$', # your DB password
# 'HOST': '0.0.0.0', # or IP/domain
# 'PORT': '5440', # default PostgreSQL port
# }
# }
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},

View File

@@ -5,7 +5,12 @@ from .models import EventType
class EventTypeForm(forms.ModelForm): class EventTypeForm(forms.ModelForm):
class Meta: class Meta:
model = EventType model = EventType
fields = ['event_type'] fields = ['event_type', 'event_type_icon']
widgets = { widgets = {
'event_type': forms.TextInput(attrs={'class': 'form-control'}), 'event_type': forms.TextInput(attrs={'class': 'form-control'}),
'event_type_icon': forms.FileInput(attrs={'class': 'form-control'}),
}
labels = {
'event_type': 'Event Type',
'event_type_icon': 'Event Type Icon',
} }

View File

@@ -3,7 +3,7 @@
<div class="container mt-4"> <div class="container mt-4">
<h3>{% if object %}Edit{% else %}Add{% endif %} Event</h3> <h3>{% if object %}Edit{% else %}Add{% endif %} Event</h3>
<form method="post" novalidate> <form method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %} {% csrf_token %}
{% for field in form %} {% for field in form %}

View File

@@ -5,19 +5,26 @@
<a class="btn btn-success" href="{% url 'master_data:event_type_add' %}">Add Category</a> <a class="btn btn-success" href="{% url 'master_data:event_type_add' %}">Add Category</a>
</div> </div>
<table class="table table-striped"> <table class="table table-striped">
<thead><tr><th>#</th><th>Event Type</th><th>Actions</th></tr></thead> <thead><tr><th>#</th><th>Event Type</th><th>Icon</th><th>Actions</th></tr></thead>
<tbody> <tbody>
{% for c in categories %} {% for c in categories %}
<tr> <tr>
<td>{{ forloop.counter }}</td> <td>{{ forloop.counter }}</td>
<td>{{ c.event_type }}</td> <td>{{ c.event_type }}</td>
<td>
{% if c.event_type_icon %}
<img src="{{ c.event_type_icon.url }}" width="50" height="50" alt="{{ c.event_type }}">
{% else %}
<span class="text-muted">No icon</span>
{% endif %}
</td>
<td> <td>
<a class="btn btn-sm btn-primary" href="{% url 'master_data:event_type_edit' c.pk %}">Edit</a> <a class="btn btn-sm btn-primary" href="{% url 'master_data:event_type_edit' c.pk %}">Edit</a>
<a class="btn btn-sm btn-danger" href="{% url 'master_data:event_type_delete' c.pk %}">Delete</a> <a class="btn btn-sm btn-danger" href="{% url 'master_data:event_type_delete' c.pk %}">Delete</a>
</td> </td>
</tr> </tr>
{% empty %} {% empty %}
<tr><td colspan="3">No categories yet.</td></tr> <tr><td colspan="4">No categories yet.</td></tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>