Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
384b0ee
Initial plan
Copilot Nov 16, 2025
f72c1bd
Add fields to ManagementCommandLog model and update views/templates
Copilot Nov 16, 2025
e9f2d1a
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 16, 2025
52d9ae7
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 16, 2025
79948ce
Apply pre-commit fixes
github-actions[bot] Nov 17, 2025
0b1fa86
Update migration file header comment format
DonnieBLT Nov 17, 2025
0c25058
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 17, 2025
fb7b13c
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 17, 2025
53d6033
Apply pre-commit fixes
github-actions[bot] Nov 17, 2025
ae57a52
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 17, 2025
589d2d1
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 17, 2025
a444556
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 22, 2025
8fb3d30
Merge branch 'main' into copilot/add-field-for-file-datetime
github-actions[bot] Nov 22, 2025
76dd43c
Merge branch 'main' into copilot/add-field-for-file-datetime
github-actions[bot] Nov 22, 2025
f746ad4
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 23, 2025
2ca35cf
Apply pre-commit fixes
github-actions[bot] Nov 23, 2025
e79d34c
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 23, 2025
d974de0
Bump migration number to 0250 and update dependencies
Copilot Nov 23, 2025
1753c55
Merge branch 'main' into copilot/add-field-for-file-datetime
DonnieBLT Nov 23, 2025
642f4b0
Bump migration to 0251 and create merge migration 0252
Copilot Nov 23, 2025
1bdf949
Remove merge migration and update 0251 dependency to 0250
Copilot Nov 23, 2025
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
37 changes: 37 additions & 0 deletions website/migrations/0251_add_fields_to_management_command_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by - Django 5.1.8 on 2025-11-16 23:39

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("website", "0250_add_forumpost_links"),
]

operations = [
migrations.AddField(
model_name="managementcommandlog",
name="execution_time",
field=models.FloatField(blank=True, help_text="Execution time in seconds", null=True),
),
migrations.AddField(
model_name="managementcommandlog",
name="file_modified",
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name="managementcommandlog",
name="file_path",
field=models.CharField(blank=True, max_length=512, null=True),
),
migrations.AddField(
model_name="managementcommandlog",
name="github_url",
field=models.URLField(blank=True, max_length=512, null=True),
),
migrations.AddField(
model_name="managementcommandlog",
name="output",
field=models.TextField(blank=True, help_text="Command execution output", null=True),
),
]
5 changes: 5 additions & 0 deletions website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,11 @@ class ManagementCommandLog(models.Model):
success = models.BooleanField(default=True)
error_message = models.TextField(blank=True, null=True)
run_count = models.IntegerField(default=0)
file_path = models.CharField(max_length=512, blank=True, null=True)
file_modified = models.DateTimeField(blank=True, null=True)
github_url = models.URLField(max_length=512, blank=True, null=True)
execution_time = models.FloatField(blank=True, null=True, help_text="Execution time in seconds")
output = models.TextField(blank=True, null=True, help_text="Command execution output")

class Meta:
get_latest_by = "last_run"
Expand Down
141 changes: 87 additions & 54 deletions website/templates/management_commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ <h1 class="text-2xl font-bold mb-6">Management Commands</h1>
{% endif %}
</a>
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
File Info
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Execution Time
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Actions
</th>
Expand All @@ -158,9 +164,9 @@ <h1 class="text-2xl font-bold mb-6">Management Commands</h1>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100">
<div class="flex items-center">
<span>{{ command.name }}</span>
{% if command.arguments %}
{% if command.arguments or command.output %}
<button class="ml-2 text-gray-400 dark:text-gray-600 hover:text-gray-600 focus:outline-none"
title="Show arguments">
title="Show details">
<svg xmlns="http://www.w3.org/2000/svg"
class="h-4 w-4"
fill="none"
Expand Down Expand Up @@ -225,6 +231,32 @@ <h1 class="text-2xl font-bold mb-6">Management Commands</h1>
</div>
{% endif %}
</td>
<td class="px-6 py-4 text-sm text-gray-500">
{% if command.file_modified %}
<div class="flex flex-col">
<span class="text-xs text-gray-600">Modified: {{ command.file_modified|timesince }} ago</span>
{% if command.github_url %}
<a href="{{ command.github_url }}"
target="_blank"
class="text-[#e74c3c] hover:underline text-xs mt-1 flex items-center">
<svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
View on GitHub
</a>
{% endif %}
</div>
{% else %}
<span class="text-gray-400 text-xs">N/A</span>
{% endif %}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{% if command.execution_time %}
<span class="text-xs">{{ command.execution_time|floatformat:3 }}s</span>
{% else %}
<span class="text-gray-400 text-xs">N/A</span>
{% endif %}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-500">
<div class="flex items-center space-x-2">
{% if request.user.is_superuser %}
Expand Down Expand Up @@ -266,58 +298,59 @@ <h1 class="text-2xl font-bold mb-6">Management Commands</h1>
</div>
</td>
</tr>
{% if command.arguments %}
<tr class="hidden bg-gray-50 dark:bg-gray-900"
id="args-{{ command.name }}">
<td colspan="7" class="px-6 py-4">
<div class="bg-gray-50 dark:bg-gray-900 p-4 rounded-lg">
<h3 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Command Arguments</h3>
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
<thead>
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Argument
</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Flags
</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Description
</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">Type</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Required
</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-500 uppercase tracking-wider">
Default
</th>
</tr>
</thead>
<tbody>
{% for arg in command.arguments %}
<tr>
<td class="px-4 py-2 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100">{{ arg.name }}</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500 dark:text-gray-500">{{ arg.flags }}</td>
<td class="px-4 py-2 text-sm text-gray-500 dark:text-gray-500">{{ arg.help }}</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500 dark:text-gray-500">{{ arg.type }}</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500 dark:text-gray-500">
{% if arg.required %}
<span class="text-red-500">Yes</span>
{% else %}
No
{% endif %}
</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500 dark:text-gray-500">
{% if arg.default %}
{{ arg.default }}
{% else %}
<span class="text-gray-400 dark:text-gray-600">None</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if command.arguments or command.output %}
<tr class="hidden bg-gray-50" id="args-{{ command.name }}">
<td colspan="9" class="px-6 py-4">
<div class="bg-gray-50 p-4 rounded-lg space-y-4">
{% if command.arguments %}
<div>
<h3 class="text-sm font-medium text-gray-700 mb-2">Command Arguments</h3>
<table class="min-w-full divide-y divide-gray-200">
<thead>
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Argument</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Flags</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Description</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Required</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Default</th>
</tr>
</thead>
<tbody>
{% for arg in command.arguments %}
<tr>
<td class="px-4 py-2 whitespace-nowrap text-sm font-medium text-gray-900">{{ arg.name }}</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500">{{ arg.flags }}</td>
<td class="px-4 py-2 text-sm text-gray-500">{{ arg.help }}</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500">{{ arg.type }}</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500">
{% if arg.required %}
<span class="text-red-500">Yes</span>
{% else %}
No
{% endif %}
</td>
<td class="px-4 py-2 whitespace-nowrap text-sm text-gray-500">
{% if arg.default %}
{{ arg.default }}
{% else %}
<span class="text-gray-400">None</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if command.output %}
<div>
<h3 class="text-sm font-medium text-gray-700 mb-2">Last Execution Output</h3>
<div class="bg-gray-900 text-green-400 p-4 rounded-lg font-mono text-xs overflow-x-auto max-h-96 overflow-y-auto">
<pre class="whitespace-pre-wrap">{{ command.output }}</pre>
</div>
</div>
{% endif %}
</div>
</td>
</tr>
Expand Down
Loading
Loading