diff --git a/bambu_run/templates/bambu_run/filament_color_list.html b/bambu_run/templates/bambu_run/filament_color_list.html
index b4061b9..c777595 100644
--- a/bambu_run/templates/bambu_run/filament_color_list.html
+++ b/bambu_run/templates/bambu_run/filament_color_list.html
@@ -9,9 +9,11 @@
Manage filament colors for auto-matching
+ {% if not is_basic_user %}
Add New Color
+ {% endif %}
Back to Inventory
@@ -70,8 +72,10 @@
{{ color.brand }} |
+ {% if not is_basic_user %}
Edit
Delete
+ {% endif %}
|
{% empty %}
diff --git a/bambu_run/templates/bambu_run/filament_detail.html b/bambu_run/templates/bambu_run/filament_detail.html
index 0adf548..c9c1d53 100644
--- a/bambu_run/templates/bambu_run/filament_detail.html
+++ b/bambu_run/templates/bambu_run/filament_detail.html
@@ -13,7 +13,9 @@
Filament Spool Details
@@ -78,6 +80,7 @@
+ {% if not is_basic_user %}
+ {% endif %}
@@ -199,6 +203,7 @@
{% block extra_js %}
+{% if not is_basic_user %}
+{% else %}
+
+{% endif %}
{% endblock %}
diff --git a/bambu_run/templates/bambu_run/filament_form.html b/bambu_run/templates/bambu_run/filament_form.html
index 98d18a7..6a03453 100644
--- a/bambu_run/templates/bambu_run/filament_form.html
+++ b/bambu_run/templates/bambu_run/filament_form.html
@@ -145,7 +145,7 @@
Cancel
- {% if form.instance.pk %}
+ {% if form.instance.pk and not is_basic_user %}
diff --git a/bambu_run/templates/bambu_run/filament_list.html b/bambu_run/templates/bambu_run/filament_list.html
index 92366eb..e83052a 100644
--- a/bambu_run/templates/bambu_run/filament_list.html
+++ b/bambu_run/templates/bambu_run/filament_list.html
@@ -12,6 +12,7 @@
Filament Inventory
Manage your 3D printer filament spools
+ {% if not is_basic_user %}
+ {% endif %}
@@ -158,7 +160,9 @@
{{ filament.last_used|date:"Y-m-d H:i"|default:"Never" }} |
View
+ {% if not is_basic_user %}
Edit
+ {% endif %}
|
{% empty %}
diff --git a/bambu_run/templates/bambu_run/filament_type_list.html b/bambu_run/templates/bambu_run/filament_type_list.html
index aa36884..b112cbc 100644
--- a/bambu_run/templates/bambu_run/filament_type_list.html
+++ b/bambu_run/templates/bambu_run/filament_type_list.html
@@ -9,9 +9,11 @@
Manage filament types (material, sub-type, brand)
+ {% if not is_basic_user %}
Add New Type
+ {% endif %}
Back to Inventory
@@ -60,8 +62,10 @@
{{ ft.brand }} |
+ {% if not is_basic_user %}
Edit
Delete
+ {% endif %}
|
{% empty %}
diff --git a/bambu_run/templates/bambu_run/printer_dashboard.html b/bambu_run/templates/bambu_run/printer_dashboard.html
index 614de65..df5496c 100644
--- a/bambu_run/templates/bambu_run/printer_dashboard.html
+++ b/bambu_run/templates/bambu_run/printer_dashboard.html
@@ -203,6 +203,7 @@
+ {% if not is_basic_user %}
+ {% endif %}
@@ -372,6 +374,7 @@
+{% if not is_basic_user %}
+{% else %}
+
+{% endif %}
{% endblock %}
diff --git a/bambu_run/views.py b/bambu_run/views.py
index e15e1ca..54d1fa9 100644
--- a/bambu_run/views.py
+++ b/bambu_run/views.py
@@ -17,6 +17,11 @@ from .forms import FilamentForm, FilamentColorForm, FilamentTypeForm
class PrinterDashboardView(LoginRequiredMixin, TemplateView):
template_name = "bambu_run/printer_dashboard.html"
+ def _get_date_range(self, request):
+ """Return (start_dt, end_dt) for the dashboard query. Override for custom date logic."""
+ time_24h_ago = timezone.now() - timedelta(hours=24)
+ return time_24h_ago, None # None means "now"
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['bambu_run_base_template'] = app_settings.BASE_TEMPLATE
@@ -34,11 +39,14 @@ class PrinterDashboardView(LoginRequiredMixin, TemplateView):
tz = zoneinfo.ZoneInfo(app_settings.TIMEZONE)
- # Last 24 hours of live data
- time_24h_ago = timezone.now() - timedelta(hours=24)
+ # Get date range (overridable by subclasses)
+ start_dt, end_dt = self._get_date_range(self.request)
metrics = PrinterMetrics.objects.filter(
- device=printer_device, timestamp__gte=time_24h_ago
- ).prefetch_related('filament_snapshots').order_by("timestamp")
+ device=printer_device, timestamp__gte=start_dt
+ )
+ if end_dt:
+ metrics = metrics.filter(timestamp__lte=end_dt)
+ metrics = metrics.prefetch_related('filament_snapshots').order_by("timestamp")
latest_metric = metrics.last()