Oleg Dolya avatar Oleg Dolya committed f75641a

Added currency models

Comments (0)

Files changed (4)

 recursive-include l10n *.po *.mo *.html *.xml *.json
 recursive-include scripts *.rules
-include README TODO ez_setup.py
+include README.txt TODO ez_setup.py
 # -*- mode: python; coding: utf-8; -*-
-__version__ = "0.2.2"
+__version__ = "0.2.3"

l10n/fixtures/test_currency.json

+[
+ {
+  "pk": 73, 
+  "model": "l10n.currencycode", 
+  "fields": {
+   "name": "US Dollar", 
+   "symbol": "$", 
+   "numcode": 840, 
+   "active": true, 
+   "orderings": 10, 
+   "iso3_code": "USD"
+  }
+ }, 
+ {
+  "pk": 65, 
+  "model": "l10n.currencycode", 
+  "fields": {
+   "name": "Euro", 
+   "symbol": "\u20ac", 
+   "numcode": 978, 
+   "active": true, 
+   "orderings": 9, 
+   "iso3_code": "EUR"
+  }
+ } 
+]
     def get_absolute_url(self):
         return ('Currencies', [self.id])
 
+class CurrenciesManager(models.Manager):
+    def get_query_set(self):
+        qs = super(CurrenciesManager, self).get_query_set()
+        qs = qs.filter(active=True).order_by('-orderings')
+        return qs
+        
+    def currency_list(self):
+        """"""
+        return self.values_list('iso3_code', 'name')
+
+class Currencies(CurrencyCode):
+    objects = CurrenciesManager()
+    
+    
+    
+    def __unicode__(self):
+        return self.name
+    
+    class Meta:
+        proxy = True
+
 import config
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.