diff --git a/envanter/envanter/00admins.py b/envanter/envanter/00admins.py deleted file mode 100644 index 069e76d..0000000 --- a/envanter/envanter/00admins.py +++ /dev/null @@ -1,69 +0,0 @@ -from django.contrib import admin -from .models import Category, Component, Manufacturer, W, Ohm, DocumentType, Document, Datasheet, Package, LocationType, Location, Supplier, Purchase, ComponentDocumentLink, PurchaseDetail, PictureURL - - -@admin.register(Category) -class CategoryAdmin(admin.ModelAdmin): - list_display = ('name', 'description') - -@admin.register(Component) -class ComponentAdmin(admin.ModelAdmin): - list_display = ('model', 'manufacturer', 'category', 'stock') - -@admin.register(Manufacturer) -class ManufacturerAdmin(admin.ModelAdmin): - list_display = ('name',) - - -@admin.register(W) -class WAdmin(admin.ModelAdmin): - list_display = ('value',) - -@admin.register(Ohm) -class OhmAdmin(admin.ModelAdmin): - list_display = ('value',) - -@admin.register(DocumentType) -class DocumentTypeAdmin(admin.ModelAdmin): - list_display = ('name',) - -@admin.register(Document) -class DocumentAdmin(admin.ModelAdmin): - list_display = ('title', 'document_type') - -@admin.register(Datasheet) -class DatasheetAdmin(admin.ModelAdmin): - list_display = ('title', 'document') - -@admin.register(Package) -class PackageAdmin(admin.ModelAdmin): - list_display = ('name',) - -@admin.register(LocationType) -class LocationTypeAdmin(admin.ModelAdmin): - list_display = ('name',) - -@admin.register(Location) -class LocationAdmin(admin.ModelAdmin): - list_display = ('name', 'location_type') - -@admin.register(Supplier) -class SupplierAdmin(admin.ModelAdmin): - list_display = ('name',) - -@admin.register(Purchase) -class PurchaseAdmin(admin.ModelAdmin): - list_display = ('supplier', 'date') - -@admin.register(ComponentDocumentLink) -class ComponentDocumentLinkAdmin(admin.ModelAdmin): - list_display = ('component', 'document') - -@admin.register(PurchaseDetail) -class PurchaseDetailAdmin(admin.ModelAdmin): - list_display = ('purchase', 'component', 'quantity') - -@admin.register(PictureURL) -class PictureURLAdmin(admin.ModelAdmin): - list_display = ('component', 'url') - diff --git a/envanter/envanter/00models.py b/envanter/envanter/00models.py deleted file mode 100644 index 6f0fb57..0000000 --- a/envanter/envanter/00models.py +++ /dev/null @@ -1,145 +0,0 @@ -from django.db import models -import os -from datetime import datetime - -class W(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - description = models.CharField(max_length=500, null=True, blank=True) - parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True) - - def __str__(self): - return self.name - -class Ohm(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - description = models.CharField(max_length=500, null=True, blank=True) - parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True) - - def __str__(self): - return self.name -class Category(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - description = models.CharField(max_length=500, null=True, blank=True) - parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True) - - def __str__(self): - return self.name - -class DocumentType(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - -class Document(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - description = models.CharField(max_length=500, null=True, blank=True) - document_type = models.ForeignKey(DocumentType, on_delete=models.CASCADE) - document_path = models.CharField(max_length=500) - - def __str__(self): - return self.name - -class Manufacturer(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - -class Package(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - -class LocationType(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - -class Location(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - location_type = models.ForeignKey(LocationType, on_delete=models.CASCADE) - parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True) - - def __str__(self): - return self.name - -class Supplier(models.Model): - id = models.AutoField(primary_key=True) - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - -class Purchase(models.Model): - id = models.AutoField(primary_key=True) - date = models.DateField() - supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE) - - def __str__(self): - return f"Purchase #{self.id}" - -class Component(models.Model): - id = models.AutoField(primary_key=True) - model = models.CharField(max_length=100) - description = models.CharField(max_length=500, null=True, blank=True) - manufacturer = models.ForeignKey(Manufacturer, on_delete=models.SET_NULL, null=True, blank=True) - category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True, blank=True) - package = models.ForeignKey(Package, on_delete=models.SET_NULL, null=True, blank=True) - location = models.ForeignKey(Location, on_delete=models.SET_NULL, null=True, blank=True) - stock = models.IntegerField(default=0) - - def __str__(self): - return self.model - -class ComponentDocumentLink(models.Model): - id = models.AutoField(primary_key=True) - document = models.ForeignKey(Document, on_delete=models.CASCADE) - component = models.ForeignKey(Component, on_delete=models.CASCADE) - - def __str__(self): - return f"Link #{self.id}" - -class PurchaseDetail(models.Model): - id = models.AutoField(primary_key=True) - purchase = models.ForeignKey(Purchase, on_delete=models.CASCADE) - component = models.ForeignKey(Component, on_delete=models.CASCADE) - quantity = models.IntegerField() - cost = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) - total_cost = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) - - def __str__(self): - return f"Purchase Detail #{self.id}" - -class Datasheet(models.Model): - id = models.AutoField(primary_key=True) - date = models.DateField() - component = models.ForeignKey(Component, on_delete=models.CASCADE) - quantity = models.IntegerField() - cost = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) - total_cost = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) - - def __str__(self): - return f"Data Sheet #{self.id}" - -class PictureURL(models.Model): - id = models.AutoField(primary_key=True) - component = models.ForeignKey(Component, on_delete=models.CASCADE) - url = models.CharField(max_length=500) - - def __str__(self): - return f"Picture URL #{self.id}" - - - diff --git a/envanter/envanter/authentication.py b/envanter/envanter/authentication.py deleted file mode 100644 index bf8d31b..0000000 --- a/envanter/envanter/authentication.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.shortcuts import redirect -from django.urls import reverse - -class LoginRequiredMiddleware: - def __init__(self, get_response): - self.get_response = get_response - - def __call__(self, request): - if not request.user.is_authenticated and request.path != reverse('login'): - return redirect('login') # Kullanıcı giriş yapmamışsa ve giriş yapma sayfasına yönlendirilir. - - response = self.get_response(request) - return response diff --git a/envanter/envanter/forms.py b/envanter/envanter/forms.py index 54615fb..827e1fc 100644 --- a/envanter/envanter/forms.py +++ b/envanter/envanter/forms.py @@ -16,6 +16,7 @@ class Meta: 'manufacturer', 'birim_fiyat', 'stock', + 'location_type', 'ohm', 'w', 'technical_specifications', diff --git a/envanter/envanter/teplates/component_detail.html b/envanter/envanter/teplates/component_detail.html deleted file mode 100644 index 5d4ced1..0000000 --- a/envanter/envanter/teplates/component_detail.html +++ /dev/null @@ -1,28 +0,0 @@ - - -
- - -Model | -Açıklama | -Üretici | -Kategori | -Paket | -Konum | -Stok | -
---|---|---|---|---|---|---|
{{ component.model }} | -{{ component.description }} | -{{ component.manufacturer }} | -{{ component.category }} | -{{ component.package }} | -{{ component.location }} | -{{ component.stock }} | -
Model: {{ selected_component.model }}
-Açıklama: {{ selected_component.description }}
- - Düzenle - Sil - {% else %} -Bir parça seçilmedi.
- {% endif %} - -{{ message }}
-