Anonymous avatar Anonymous committed 37712aa Merge

merge

Comments (0)

Files changed (13)

django_ultrasound/customers/admin.py

 from django.utils.translation import ugettext as _
 
 
+
+def advance_status(modeladmin, request, queryset):
+    print queryset # the selected objects
+    for customer in queryset:
+        try:
+            customer.advance_status(save=True)
+        except:
+            print "Failed to advance customer status of %s" % customer.user.username
+    msg = _("Customers status have been advanced")
+    modeladmin.message_user(request, "%s" % msg)
+    advance_status.short_description = _("Advance customer status")
+
+
+    
 def render_color_box(color, value=""):
     return '<input type="text" value="%s" readonly="true" tabindex="-1" size="30" style="text-align:center; color: white; background-color: %s"/>' % (value, color)
 
 class CustomerAdmin(admin.ModelAdmin):
     list_display = ["user", "sex","customer_status_box", "facebook_page"]
     list_filter = ["address", "customer_status"]
+    actions = [advance_status]
 
     def customer_status_box(self, obj):
         return render_color_box(obj.customer_status.color, obj.customer_status.name)

django_ultrasound/customers/fixtures/initial_data.json

+[
+    {
+        "pk": 4, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05d3\u05e3 \u05de\u05d1\u05e7\u05e9 \u05de\u05d5\u05e2\u05de\u05d3\u05d5\u05ea"
+        }
+    }, 
+    {
+        "pk": 8, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05de\u05d5\u05e2\u05de\u05d3 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05d3\u05e3 \u05de\u05d5\u05e2\u05de\u05d3"
+        }
+    }, 
+    {
+        "pk": 12, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05ea\u05d5\u05d3\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05e4\u05e8\u05d8\u05d9\u05dd \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05d3\u05e3 \u05de\u05d5\u05e2\u05de\u05d3 \u05e2\u05dd \u05e4\u05e8\u05d8\u05d9\u05dd"
+        }
+    }, 
+    {
+        "pk": 16, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05dc\u05e7\u05d5\u05d7 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05d3\u05e3 \u05dc\u05e7\u05d5\u05d7"
+        }
+    }, 
+    {
+        "pk": 20, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05d1\u05dc \u05d1\u05dc \u05d1\u05dc\u05d4\r\n\u05dc\u05e7\u05d5\u05d7 \u05de\u05d9\u05d5\u05d7\u05e1\r\n\u05d1\u05dc \u05d1\u05dc\u05d4\r\n", 
+            "title": "\u05d3\u05e3 \u05dc\u05e7\u05d5\u05d7 \u05de\u05d9\u05d5\u05d7\u05e1"
+        }
+    }, 
+    {
+        "pk": 24, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05d1\u05dc \u05d4\u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05e2\u05d3 \u05dc\u05d1\u05d9\u05e8\u05d5\u05e8 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05d3\u05e3 \u05dc\u05e7\u05d5\u05d7 \u05de\u05d5\u05e9\u05d4\u05d4 \u05d6\u05de\u05e0\u05d9\u05ea"
+        }
+    }, 
+    {
+        "pk": 28, 
+        "model": "customers.htmlpage", 
+        "fields": {
+            "content": "\u05dc\u05e6\u05e2\u05e8\u05e0\u05d5 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05de\u05d5\u05e9\u05d4\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05d3\u05e3 \u05dc\u05e7\u05d5\u05d7 \u05de\u05d5\u05e9\u05d4\u05d4"
+        }
+    }, 
+    {
+        "pk": 6, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "silver", 
+            "code": 1, 
+            "name": "\u05de\u05d1\u05e7\u05e9 \u05de\u05d5\u05e2\u05de\u05d3\u05d5\u05ea", 
+            "html_page": 4
+        }
+    }, 
+    {
+        "pk": 10, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "grey", 
+            "code": 2, 
+            "name": "\u05de\u05d5\u05e2\u05de\u05d3", 
+            "html_page": 8
+        }
+    }, 
+    {
+        "pk": 14, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "cyan", 
+            "code": 3, 
+            "name": "\u05de\u05d5\u05e2\u05de\u05d3 \u05d0\u05e9\u05e8 \u05de\u05d9\u05dc\u05d0 \u05e4\u05e8\u05d8\u05d9\u05dd", 
+            "html_page": 12
+        }
+    }, 
+    {
+        "pk": 18, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "green", 
+            "code": 4, 
+            "name": "\u05dc\u05e7\u05d5\u05d7", 
+            "html_page": 16
+        }
+    }, 
+    {
+        "pk": 22, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "blue", 
+            "code": 5, 
+            "name": "\u05dc\u05e7\u05d5\u05d7 \u05de\u05d9\u05d5\u05d7\u05e1", 
+            "html_page": 20
+        }
+    }, 
+    {
+        "pk": 26, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "orange", 
+            "code": 6, 
+            "name": "\u05de\u05d5\u05e9\u05d4\u05d4 \u05d6\u05de\u05e0\u05d9\u05ea", 
+            "html_page": 24
+        }
+    }, 
+    {
+        "pk": 30, 
+        "model": "customers.customerstatus", 
+        "fields": {
+            "color": "red", 
+            "code": 7, 
+            "name": "\u05de\u05d5\u05e9\u05d4\u05d4", 
+            "html_page": 28
+        }
+    }, 
+    {
+        "pk": 33, 
+        "model": "customers.customer", 
+        "fields": {
+            "update_data": false, 
+            "id_number": 22222, 
+            "photo": "", 
+            "customer_status": 6, 
+            "sex": 1, 
+            "link_to_page": "", 
+            "user": 1, 
+            "address": null, 
+            "birth_day": "1978-01-05", 
+            "fb_key": "11111", 
+            "check_data": false, 
+            "education_institute": null
+        }
+    }
+]

django_ultrasound/customers/models.py

     education_institute = models.ForeignKey(CustomerEduInstitute, verbose_name=_("education institute"), null=True,
                                             blank=True)
 
+    def advance_status(self, save=False):
+        new_status = {
+            REQUESTING_TO_BE_CANDIDATE: CANDIDATE,
+            CANDIDATE: CANDIDATE_WITH_DETAILS,
+            CANDIDATE_WITH_DETAILS: CUSTOMER,
+            CUSTOMER:  DISTINGUISHED_CUSTOMER,
+            DISTINGUISHED_CUSTOMER: DISTINGUISHED_CUSTOMER,
+            TEMPORARILY_POSTPONED: TEMPORARILY_POSTPONED,
+            POSTPONED: POSTPONED,
+        }[self.customer_status.code]
+
+        if new_status != self.customer_status.code:
+            self.customer_status = CustomerStatus.objects.get(code=new_status)
+            if save:
+                self.save()
+
 
     def __init__(self, *args, **kwargs):
         super(Customer, self).__init__(*args, **kwargs)
     def get_old_value(self, field_name):
         return self.original.get(field_name, None)
 
+    def __unicode__(self):
+        return self.user.username
 
+

django_ultrasound/employees/admin.py

 
 
 class ActivityAdmin(admin.ModelAdmin):
-    list_display = ["employee", "activity", "old_customer_status", "new_customer_status", "date_of_activity"]
-    list_filter = ["employee", "activity", "customer", "old_customer_status", "new_customer_status"]
+    list_display = ["employee", "activity", "customer", "old_customer_status", "new_customer_status", "date_of_activity"]
+    list_filter = ["employee", "activity", "old_customer_status", "new_customer_status", "customer"]
     
     
 admin.site.register(Activity, ActivityAdmin)

django_ultrasound/employees/fixtures/initial_data.json

+[
+    {
+        "pk": 54, 
+        "model": "employees.employeetype", 
+        "fields": {
+            "name": "\u05d9\u05d7\u05e6\u05df"
+        }
+    }, 
+    {
+        "pk": 56, 
+        "model": "employees.employee", 
+        "fields": {
+            "id_number": 1111, 
+            "last_update": "2011-01-05 10:08:33", 
+            "user": 1, 
+            "fb_key": "2222", 
+            "boss": null, 
+            "employee_type": 54
+        }
+    }, 
+    {
+        "pk": 34, 
+        "model": "employees.activity", 
+        "fields": {
+            "customer": 33, 
+            "date_of_activity": "2011-01-05 10:05:41", 
+            "activity": 1, 
+            "employee": 1, 
+            "old_customer_status": null, 
+            "new_customer_status": 6
+        }
+    }
+]

django_ultrasound/events/fixtures/initial_data.json

+[
+    {
+        "pk": 47, 
+        "model": "events.htmlpage", 
+        "fields": {
+            "content": "\u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05e9\u05d9\u05e9\u05d9 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4 \u05e9\u05e0\u05ea 2011 \u05d1\u05dc\u05d4 \u05d1\u05dc\u05d4", 
+            "title": "\u05de\u05e1\u05d9\u05d1\u05ea \u05e9\u05d9\u05e9\u05d9 \u05ea\u05d7\u05d9\u05dc\u05ea \u05d4\u05e9\u05e0\u05d4"
+        }
+    }, 
+    {
+        "pk": 41, 
+        "model": "events.location", 
+        "fields": {
+            "locationName": "\u05d0\u05d5\u05dc\u05d8\u05e8\u05d4\u05e1\u05d0\u05d5\u05e0\u05d3"
+        }
+    }, 
+    {
+        "pk": 44, 
+        "model": "events.eventtype", 
+        "fields": {
+            "discriptionsType": "\u05de\u05e1\u05d9\u05d1\u05d5\u05ea \u05d9\u05d5\u05dd \u05e9\u05d9\u05e9\u05d9"
+        }
+    }, 
+    {
+        "pk": 38, 
+        "model": "events.constraint", 
+        "fields": {
+            "constraint_code": "customer.age >= 20 and customer.age <= 25", 
+            "description": "\u05d2\u05d9\u05dc\u05d0\u05d9 20-25"
+        }
+    }, 
+    {
+        "pk": 58, 
+        "model": "events.event", 
+        "fields": {
+            "end_houre": "2011-01-05 10:08:38", 
+            "html_page": 47, 
+            "description": "\u05de\u05e1\u05d9\u05d1\u05ea \u05e9\u05d9\u05e9\u05d9 \u05ea\u05d7\u05d9\u05dc\u05ea \u05d4\u05e9\u05e0\u05d4", 
+            "start_houre": "2011-01-05 10:08:38", 
+            "event_mounth": 1, 
+            "marketing_employee": null, 
+            "event_year": 2011, 
+            "event_day": 7, 
+            "logo": "http://www.waze.co.il/images/nav/logo.gif", 
+            "constrain": 38, 
+            "employee_in_charge": null, 
+            "type": 44, 
+            "location": 41
+        }
+    }, 
+    {
+        "pk": 59, 
+        "model": "events.allocation", 
+        "fields": {
+            "allocation_event": 58, 
+            "allocation_product": 50, 
+            "quantity_use": 0, 
+            "allocation_price": 25, 
+            "employee_get_allocation": 56, 
+            "quantity_allocation": 50
+        }
+    }
+]

django_ultrasound/events/views.py

-# Create your views here.

django_ultrasound/initial_auth_data.json

+[
+    {
+        "pk": 1, 
+        "model": "auth.user", 
+        "fields": {
+            "username": "admin", 
+            "first_name": "", 
+            "last_name": "", 
+            "is_active": true, 
+            "is_superuser": true, 
+            "is_staff": true, 
+            "last_login": "2011-01-05 10:01:19", 
+            "password": "sha1$49bfc$49236facb2436f8095ca63e0ecbcf20c507c6df0", 
+            "email": "rami.zlingher@gmail.com", 
+            "date_joined": "2011-01-05 10:01:15"
+        }
+    }
+]

django_ultrasound/products/fixtures/initial_data.json

+[
+    {
+        "pk": 50, 
+        "model": "products.product", 
+        "fields": {
+            "supplier": null, 
+            "price": "30.00", 
+            "title": "\u05db\u05e8\u05d8\u05d9\u05e1 \u05db\u05e0\u05d9\u05e1\u05d4"
+        }
+    }
+]

django_ultrasound/sales/fixtures/initial_data.json

+[]

django_ultrasound/sales/models.py

 from customers.models import Customer
 from employees.models import Employee
 from products.models import Product
-from events.models import Event,Allocation
+from events.models import Event
 # Create your models here.
 
 class SaleStatus(models.Model):

django_ultrasound/settings.py

 INSTALLED_APPS = (
     'djangoappengine',
 #    'django.contrib.admin',
-#    'django.contrib.auth',
+    'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'djangotoolbox',

django_ultrasound/templates/admin/base_site.html

+{% extends "admin/base.html" %}
+{% load i18n %}
+
+{% block title %}{{ title }} | {% trans 'UltraSound managament' %}{% endblock %}
+
+{% block branding %}
+<h1 id="site-name">{% trans 'UltraSound management' %}</h1>
+{% endblock %}
+
+{% block nav-global %}{% endblock %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.