Skip to content

Commit

Permalink
Refactor (#9)
Browse files Browse the repository at this point in the history
* better footer

* added admin panel
  • Loading branch information
angusgoody authored Nov 25, 2024
1 parent 90be18c commit 561d056
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
19 changes: 18 additions & 1 deletion message/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
from django.contrib import admin
from django.template.defaultfilters import truncatechars

from message.models import Message


@admin.register(Message)
class MessageURLAdmin(admin.ModelAdmin):

# Define a method to truncate content
def short_content(self, obj):
return truncatechars(obj.content, 35)

short_content.short_description = 'Short Content' # Optional: Customize the column header

# Display the new fields in the admin list view
list_display = ('slug', 'short_content', 'created_at')
search_fields = ('slug', 'content')
list_filter = ['created_at']

# Register your models here.
2 changes: 1 addition & 1 deletion poo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
path("admin/", admin.site.urls),
path('', include('shortener.urls')), # Main app routing

path('message/', include('message.urls')), # Messager app routing
path('message/', include('message.urls')), # Message app routing
]


Expand Down
22 changes: 11 additions & 11 deletions templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
</div>

<footer class="bg-emerald-800 text-white">
<div class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-between">
<span class="text-sm text-gray-50 sm:text-center ">© <span id="year"></span> <strong>Poo</strong> | Designed by <a href="https://angusgoody.com/" target="_blank"><strong>Angus Goody</strong></a>
</span>
<ul class="flex flex-wrap items-center mt-3 text-sm font-medium sm:mt-0">
<li>
<a href="{% url 'shorten_url' %}" class="hover:underline me-4 md:me-6">Shortener</a>
</li>
<li>
<a href="{% url 'create_message' %}" class="hover:underline me-4 md:me-6">Create a message</a>
</li>
</ul>
<div class="w-full mx-auto max-w-screen-xl p-4 flex flex-col justify-center md:flex-row md:items-center md:justify-between">
<span class="text-sm text-gray-50 text-center">© <span id="year"></span> <strong>Poo</strong> | Designed by <a href="https://angusgoody.com/" target="_blank"><strong>Angus Goody</strong></a>
</span>
<ul class="flex flex-wrap justify-center items-center mt-3 text-sm font-medium sm:mt-0">
<li>
<a href="{% url 'shorten_url' %}" class="hover:underline me-4 md:me-6">Shortener</a>
</li>
<li>
<a href="{% url 'create_message' %}" class="hover:underline me-4 md:me-6">Create a message</a>
</li>
</ul>
</div>
</footer>

Expand Down

0 comments on commit 561d056

Please sign in to comment.