Commits

Udi Bauman  committed 432b25d

first report

  • Participants
  • Parent commits 6fbcdd8

Comments (0)

Files changed (8)

File django_ultrasound/customers/models.py

     class Meta:
         verbose_name=_("Customer Status")
         verbose_name_plural= _("statuses of Customers")
-        
+
     def __unicode__(self):
-        return self.name+self.code
+        return u"%s-%d" % (self.name, self.code)
 
 class CustomerAddress(models.Model):
     name = models.CharField(_("home Address"), max_length=100)
     id_number = models.PositiveIntegerField(_("ID number"), unique=True, help_text=_("Enter ID number"), null=True,
                                             blank=True)
     link_to_page = models.URLField(_("Link to FaceBook page"), verify_exists=False, max_length=500, null=True, blank=True)
-    customer_status = models.ForeignKey(CustomerStatus, verbose_name=_("Status"), related_name=_("customers"))
+    customer_status = models.ForeignKey(CustomerStatus, verbose_name=_("Status"), related_name="customers")
     check_data = models.BooleanField(_("check deatels on the enternce"), default=False)
     update_data = models.BooleanField(_("we have all the deatles we need"), default=False)
     sex = models.IntegerField(_("man/woman"), choices=((1, _("Man")), (2, _("Woman"))), null=True, blank=True)
     photo = models.FileField(_("photo"), upload_to="static/photos", null=True, blank=True)
     birth_day = models.DateField(_("birth day"), null=True, blank=True)
-    address = models.ForeignKey(CustomerAddress, verbose_name=_("home Address"), related_name=_("customer"), null=True,
+    address = models.ForeignKey(CustomerAddress, verbose_name=_("home Address"), related_name="customer", null=True,
                                 blank=True)
     education_institute = models.ForeignKey(CustomerEduInstitute, verbose_name=_("education institute"), null=True,
                                             blank=True)
 
+    class Meta:
+        verbose_name=_("Customer")
+        verbose_name_plural= _("Customers")
+
     def advance_status(self, save=False):
         new_status = {
             REQUESTING_TO_BE_CANDIDATE: CANDIDATE,

File django_ultrasound/employees/reports.py

+from django.shortcuts import render_to_response
+from django.contrib.auth.decorators import login_required
+from employees.models import Employee
+
+@login_required
+def list_employees(request):
+    employees = Employee.objects.all()#.order_by('employee_type')
+    employees_by_type = {}
+    for employee in employees:
+        et = employee.employee_type
+        employees_by_type.setdefault(et, [])
+        employees_by_type[et].append(employee)
+    types = employees_by_type.items()
+    return render_to_response('list_employees_report.html', locals())
+

File django_ultrasound/employees/templates/list_employees_report.html

+{% extends "admin/base_site.html" %}
+{% load i18n %}
+
+{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/dashboard.css" />{% endblock %}
+
+{% block coltype %}colMS{% endblock %}
+
+{% block bodyclass %}dashboard{% endblock %}
+
+{% block breadcrumbs %}{% endblock %}
+
+{% block content %}
+<div id="content-main">
+
+<table width="80%" border="1">
+
+    {% for et in types %}
+
+        <tr style="background-color:silver">
+            <th colspan="4">{{ et.0 }}</th>
+
+        </tr>
+
+        {% for employee in et.1 %}
+
+            <tr>
+                <td>{{ employee.id }}</td>
+                <td>{{ employee.user.username }}</td>
+                <td>{{ employee.user.first_name }}</td>
+                <td>{{ employee.user.last_name }}</td>
+            </tr>
+
+        {% endfor %}
+
+    {% endfor %}
+
+
+</table>
+
+
+</div>
+{% endblock %}

File django_ultrasound/employees/urls.py

+from django.conf.urls.defaults import *
+from django.views.generic.simple import direct_to_template
+
+
+urlpatterns = patterns('',
+
+    (r'^reports/list_employees/', 'employees.reports.list_employees'),
+)

File django_ultrasound/employees/views.py

                 { "name": _("reports"),
                   "app_url": "",
                   "models": [
-                              {"name": _("Man power report"), "admin_url": "/reports/man_power_report/",},
+                              {"name": _("Man power report"), "admin_url": "/reports/list_employees/",},
                             ]
                 },
         ]

File django_ultrasound/locale/he/LC_MESSAGES/django.mo

Binary file modified.

File django_ultrasound/products/models.py

     supplier_name = models.CharField(_("home Address"), max_length=100)
     
     def __unicode__(self):
-        return self.name
+        return self.supplier_name
     
         
     

File django_ultrasound/urls.py

     (r'^home/', 'customers.views.customer_home'),
     (r'^employee_home/', 'employees.views.employee_home'),
 
+
+    (r'^', include('employees.urls')),
+
     (r'^$', 'customers.views.customer_home'),
 
 #    url(r'^$', direct_to_template, {'template': 'login.html'}, name='login'),