Commits

Anonymous committed 2f3b072

sales model

Comments (0)

Files changed (9)

data/ultrasound.datastore

Binary file added.

django_ultrasound/events/admin.py

 from django.contrib import admin
 from events.models import *
 
+class LocationAdmin(admin.ModelAdmin):
+    list_display = ["locationName" ]
+admin.site.register(Location,LocationAdmin)
+
+class EventTypeAdmin(admin.ModelAdmin):
+    list_display = ["discriptionsType" ]
+admin.site.register(EventType,EventTypeAdmin)  
+
+class ConstraintAdmin(admin.ModelAdmin):
+    list_display = ["constraintDiscriptions", "constrainMethode" ]
+admin.site.register(Constraint,ConstraintAdmin)
+
+class AllocationAdmin(admin.ModelAdmin):
+    list_display = ["allocation_event","allocation_product","quantity_allocation","quantity_use","employee_get_allocation","allocation_price"]
+    list_filter = ["allocation_event","allocation_product","quantity_allocation","quantity_use","employee_get_allocation","allocation_price"]
+admin.site.register(Allocation,AllocationAdmin)    
 
 class EventAdmin(admin.ModelAdmin):
-    list_display = ["description","html_page","start_event","end_event","location","logo","employee_in_charge","marketing_employee"]
-    list_filter = ["start_event","employee_in_charge","marketing_employee"]
+    list_display = ["description",
+                    "type",
+                    "html_page",
+                    "event_year",
+                    "event_mounth",
+                    "start_houre",
+                    "end_houre",
+                    "location",
+                    "logo",
+                    "employee_in_charge",
+                    "marketing_employee",
+                    "constrain"]
+    list_filter = ["event_year",
+                   "type",
+                   "location",
+                   "employee_in_charge",
+                   "marketing_employee"]
     
-admin.site.register(Event, EventAdmin)
+admin.site.register(Event,EventAdmin)
+

django_ultrasound/events/models.py

 from django.db import models
 from django.utils.translation import ugettext_lazy as _
 from employees.models import Employee
+from products.models import Product
 # Create your models here.
 
 class HtmlPage(models.Model):
     title = models.CharField(_('title'), max_length=200)
     content = models.TextField(_('content'), blank=True)
+    
 class Location(models.Model):
-    discriptions = models.CharField(_('the place the event take place'),max_length=100)
+    locationName = models.CharField(_('the place the event take place'),max_length=100)
+    
+class EventType(models.Model):
+    discriptionsType = models.CharField(_('the type of the event '),max_length=100)
+    
+class Constraint(models.Model):
+    constraintDiscriptions = models.CharField(_('the decription of the constrain'),max_length=100)
+    constrainMethode = models.CharField(_('the name of the function'),max_length=100)
 
 class Event(models.Model):
     description = models.CharField(_('the descrition of the event'), max_length=500)
+    type = models.ForeignKey(EventType,verbose_name = _("the Type of the event"))
     html_page = models.ForeignKey(HtmlPage, verbose_name=_("HTML page"))
-    start_event = models.DateTimeField(_("start event"), auto_now=True)
-    end_event = models.DateTimeField(_("end event"), auto_now=True)
+    start_houre = models.DateTimeField(_("start event"), auto_now=True)
+    event_year = models.PositiveIntegerField(_("year"), help_text=_("Enter Year"), blank=True)
+    event_mounth = models.PositiveIntegerField(_("month"), help_text=_("Enter Mounth"),blank=True)
+    event_day = models.PositiveIntegerField(_("day"), help_text=_("Enter Day"),blank=True)
+    end_houre = models.DateTimeField(_("end event"), auto_now=True)
     location = models.ForeignKey(Location,verbose_name = _("location of the event"))
     logo = models.URLField(_("the address of the loge of the event"))
-    employee_in_charge = models.ForeignKey(Employee, verbose_name= ("the employee in charge"),related_name="employee1")
-    marketing_employee = models.ForeignKey(Employee, verbose_name= ("the employee in charge"),related_name="employee2")
+    employee_in_charge = models.ForeignKey(Employee, verbose_name= _("the employee in charge"),related_name="employee2",null=True, blank=True)
+    marketing_employee = models.ForeignKey(Employee, verbose_name= _("the employee in charge"),related_name="employee3",null=True, blank=True)
+    constrain = models.ForeignKey(Constraint,verbose_name= _("the constrain of this event"))
+
+class Allocation(models.Model):
+    allocation_event = models.ForeignKey(Event,verbose_name= _("the event that has allocation "),related_name="employee4",null=True, blank=True)
+    allocation_product = models.ForeignKey(Product,verbose_name= _("the products that as allocated"),related_name="employee5",null=True, blank=True)
+    quantity_allocation = models.PositiveIntegerField(_("the quantity that was alloceted"))
+    quantity_use = models.PositiveIntegerField(_("the quantity that was alloceted"))
+    employee_get_allocation = models.ForeignKey(Employee,verbose_name= _("the employee in charge"),related_name="employee1")
+    allocation_price = models.PositiveIntegerField(_("the price of the product that was alloceted"))
     
     

django_ultrasound/sales/__init__.py

Empty file added.

django_ultrasound/sales/admin.py

+from django.contrib import admin
+from sales.models import *
+
+class SaleStatusAdmin(admin.ModelAdmin):
+    list_display = ["discriptionsStatus"]
+admin.site.register(SaleStatus, SaleStatusAdmin)
+
+class SaleAdmin(admin.ModelAdmin):
+    list_display = ["event","product","customer","sales_man","sales_prices","status","status_date"]
+admin.site.register(Sale, SaleAdmin)

django_ultrasound/sales/models.py

+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+from customers.models import Customer
+from employees.models import Employee
+from products.models import Product
+from events.models import Event,Allocation
+# Create your models here.
+class SaleStatus(models.Model):
+    discriptionsStatus = models.CharField(_('the status  of the seles '),max_length=100)
+
+class Sale(models.Model):
+    event = models.ForeignKey(Event,verbose_name= _("event"),related_name="event1",null=True, blank=True)
+    product = models.ForeignKey(Product,verbose_name= _("product"),related_name="producr",null=True, blank=True)
+    customer = models.ForeignKey(Customer, verbose_name= _("the customer"),related_name="customer",null=True, blank=True)
+    sales_man = models.ForeignKey(Employee, verbose_name= _("the employee in charge"),related_name="employee10",null=True, blank=True)
+    sales_prices = models.DecimalField(_("price "), decimal_places=2,max_digits=5)
+    status = models.ForeignKey(SaleStatus, verbose_name= _("the status of the sales")) 
+    status_date =models.DateTimeField(_("statusupdteTime"), auto_now=True)

django_ultrasound/sales/tests.py

+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+

django_ultrasound/sales/views.py

+# Create your views here.

django_ultrasound/settings.py

     'employees',
     'customers',
     'products',
-    'events'
+    'events',
+    'sales'
 )