Autosave: 20260205-122703
This commit is contained in:
parent
3f9709efef
commit
5c5625595e
Binary file not shown.
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from .models import Device
|
||||
from .models import (
|
||||
Category, Unit, Product, Customer, Supplier,
|
||||
Sale, SaleItem, SalePayment,
|
||||
@ -87,3 +88,9 @@ class LoyaltyTransactionAdmin(admin.ModelAdmin):
|
||||
list_display = ('customer', 'transaction_type', 'points', 'created_at')
|
||||
list_filter = ('transaction_type', 'created_at')
|
||||
search_fields = ('customer__name',)
|
||||
|
||||
@admin.register(Device)
|
||||
class DeviceAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'device_type', 'connection_type', 'ip_address', 'is_active')
|
||||
list_filter = ('device_type', 'connection_type', 'is_active')
|
||||
search_fields = ('name', 'ip_address')
|
||||
|
||||
27
core/migrations/0024_device.py
Normal file
27
core/migrations/0024_device.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.2.7 on 2026-02-05 12:23
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0023_alter_product_min_stock_level_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Device',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100, verbose_name='Device Name')),
|
||||
('device_type', models.CharField(choices=[('printer', 'Printer'), ('scanner', 'Scanner'), ('scale', 'Weight Scale'), ('display', 'Customer Display'), ('other', 'Other')], max_length=20, verbose_name='Device Type')),
|
||||
('connection_type', models.CharField(choices=[('network', 'Network (IP)'), ('usb', 'USB'), ('bluetooth', 'Bluetooth')], default='network', max_length=20, verbose_name='Connection Type')),
|
||||
('ip_address', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP Address')),
|
||||
('port', models.PositiveIntegerField(blank=True, null=True, verbose_name='Port')),
|
||||
('is_active', models.BooleanField(default=True, verbose_name='Active')),
|
||||
('config_json', models.JSONField(blank=True, help_text='Additional driver configuration in JSON format', null=True, verbose_name='Configuration')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0024_device.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0024_device.cpython-311.pyc
Normal file
Binary file not shown.
@ -375,6 +375,33 @@ class SystemSetting(models.Model):
|
||||
def __str__(self):
|
||||
return self.business_name
|
||||
|
||||
|
||||
class Device(models.Model):
|
||||
DEVICE_TYPES = [
|
||||
('printer', _('Printer')),
|
||||
('scanner', _('Scanner')),
|
||||
('scale', _('Weight Scale')),
|
||||
('display', _('Customer Display')),
|
||||
('other', _('Other')),
|
||||
]
|
||||
CONNECTION_TYPES = [
|
||||
('network', _('Network (IP)')),
|
||||
('usb', _('USB')),
|
||||
('bluetooth', _('Bluetooth')),
|
||||
]
|
||||
|
||||
name = models.CharField(_("Device Name"), max_length=100)
|
||||
device_type = models.CharField(_("Device Type"), max_length=20, choices=DEVICE_TYPES)
|
||||
connection_type = models.CharField(_("Connection Type"), max_length=20, choices=CONNECTION_TYPES, default='network')
|
||||
ip_address = models.GenericIPAddressField(_("IP Address"), blank=True, null=True)
|
||||
port = models.PositiveIntegerField(_("Port"), blank=True, null=True)
|
||||
is_active = models.BooleanField(_("Active"), default=True)
|
||||
config_json = models.JSONField(_("Configuration"), blank=True, null=True, help_text=_("Additional driver configuration in JSON format"))
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} ({self.get_device_type_display()})"
|
||||
|
||||
class UserProfile(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile")
|
||||
image = models.ImageField(_("Profile Picture"), upload_to="profile_pics/", blank=True, null=True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user