Permalink
Browse files

import project

  • Loading branch information...
1 parent ddeb2a0 commit 826898c61a578bbd5cbba67cec732124c0c23d79 @areski areski committed Jan 13, 2012
View
@@ -0,0 +1,55 @@
+Nova Style Commandments
+=======================
+
+Step 1: Read http://www.python.org/dev/peps/pep-0008/
+Step 2: Read http://www.python.org/dev/peps/pep-0008/ again
+Step 3: Read on
+
+Imports
+-------
+- thou shalt not import objects, only modules
+- thou shalt not import more than one module per line
+- thou shalt not make relative imports
+- thou shalt "from nova import vendor" before importing third party code
+- thou shalt organize your imports according to the following template
+
+::
+ # vim: tabstop=4 shiftwidth=4 softtabstop=4
+ {{stdlib imports in human alphabetical order}}
+ \n
+ from nova import vendor
+ {{vendor imports in human alphabetical order}}
+ \n
+ {{nova imports in human alphabetical order}}
+ \n
+ \n
+ {{begin your code}}
+
+
+General
+-------
+- thou shalt put two newlines twixt toplevel code (funcs, classes, etc)
+- thou shalt put one newline twixt methods in classes and anywhere else
+- thou shalt not write "except:", use "except Exception:" at the very least
+- thou shalt include your name with TODOs as in "TODO(termie)"
+- thou shalt not name anything the same name as a builtin or reserved word
+- thou shalt not violate causality in our time cone, or else
+
+
+Human Alphabetical Order Examples
+---------------------------------
+::
+ import httplib
+ import logging
+ import random
+ import StringIO
+ import time
+ import unittest
+
+
+
+Tool to make code PEP8 compliant
+--------------------------------
+- Install : https://github.com/cburroughs/pep8
+- Usage in your project directory : pep8 --statistics --filename=*.py --show-source --show-pep8 .
+
View
@@ -0,0 +1,15 @@
+
+
+1. Install requirement
+======================
+
+ > pip install -r requirements.txt
+
+
+2. Install
+==========
+
+ > python setup.py install
+
+
+
View
@@ -0,0 +1,18 @@
+Copyright (c) 2011 Star2Billing S.L. <info@star2billing.com>
+
+django-audiofield is distributed under the terms of the Mozilla Public License (MPL) Version 1.1
+
+
+The contents of this file are subject to the Mozilla Public License Version
+1.1 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the License.
+
+
+You must retain, in the Source form of any Derivative Works that You distribute, all
+copyright, patent, trademark, and attribution notices from the Source form of the Work
+and a copy of this License excluding those notices that do not pertain to any part of the Derivative Works.
View
@@ -0,0 +1,78 @@
+=======================
+django-country-dialcode
+=======================
+
+
+This Django application has for purpose to provide Dial Code and Country data, to reuse quickly into your django application.
+
+
+Installation
+============
+
+Install Django-Country-Dialcode::
+
+ python setup.py install
+
+
+Dependencies
+------------
+
+See requirements.txt file
+
+
+Settings
+========
+
+in your settings.py file::
+
+INSTALLED_APPS = INSTALLED_APPS + ('country_dialcode',)
+
+
+Usage
+=====
+
+In your models add the following ::
+
+ dialcode = models.ForeignKey(Prefix, verbose_name=_("Destination"), null=True,
+ blank=True, help_text=_("Select Prefix"))
+
+
+Contributing
+============
+
+If you've found a bug, implemented/improved a feature and think it is useful
+then please consider contributing. Patches, pull requests or just suggestions
+are welcome!
+
+Source code: http://github.com/Star2Billing/django-country-dialcode
+
+
+If you don’t like Github and Git you’re welcome to send regular patches.
+
+Bug tracker: https://github.com/Star2Billing/django-country-dialcode/issues
+
+
+Documentation
+=============
+
+Documentation is available on 'Read the Docs':
+http://django-country-dialcode.readthedocs.org
+
+
+License
+=======
+
+Copyright (c) 2011 Star2Billing S.L. <info@star2billing.com>
+
+django-country-dialcode is licensed under MIT, see `MIT-LICENSE.txt`.
+
+
+Credit
+======
+
+Django-country-dialcode is a Star2Billing-Sponsored Community Project, for more information visit
+http://www.star2billing.com or email us at info@star2billing.com
+
+
+
+
File renamed without changes.
@@ -0,0 +1,29 @@
+from django.contrib import admin
+from django.conf.urls.defaults import *
+from django.utils.translation import ugettext as _
+from django.db.models import *
+from prefix_country.models import *
+
+
+class CountryAdmin(admin.ModelAdmin):
+ list_display = ('countrycode', 'countryprefix', 'countryname')
+ search_fields = ('countryname', 'countryprefix')
+ ordering = ('id', )
+ list_filter = ['countryprefix', 'countrycode']
+
+ def __init__(self, *args, **kwargs):
+ super(CountryAdmin, self).__init__(*args, **kwargs)
+ self.list_display_links = ('countrycode', )
+admin.site.register(Country, CountryAdmin)
+
+
+class PrefixAdmin(admin.ModelAdmin):
+ search_fields = ('prefix', 'destination')
+ list_display = ('prefix', 'destination', 'country_name', 'carrier_name')
+ ordering = ('prefix', )
+ #list_filter = ['country_name', 'carrier_name']
+
+ def __init__(self, *args, **kwargs):
+ super(PrefixAdmin, self).__init__(*args, **kwargs)
+ #self.list_display_links = (None, )
+admin.site.register(Prefix, PrefixAdmin)
Oops, something went wrong.
@@ -0,0 +1,3 @@
+from django import forms
+# place form definition here
+
@@ -0,0 +1,74 @@
+from django.db import models
+from django.utils.translation import ugettext as _
+from datetime import *
+from common.intermediate_model_base_class import Model
+
+prefix_type_list = ((0, _("Landline")),
+ (1, _("Mobile")),
+ (2, _("NGN (Non Geographic Numbers)")))
+
+
+# Create your models here.
+class Country(Model):
+ """
+ Country
+
+ These are the countries and their country code, country prefix, name
+ For instance : USA, 1, United States
+ """
+ countrycode = models.CharField(max_length=240, verbose_name='Code',
+ help_text=_("Enter Country Code. e.g. USA"))
+ countryprefix = models.IntegerField(max_length=12,
+ verbose_name='Prefix',
+ help_text=_("Enter Country Prefix. e.g. 1"))
+ countryname = models.CharField(max_length=240, verbose_name='Name',
+ help_text=_("Enter Country Name. e.g. United States"))
+
+ class Meta:
+ db_table = 'simu_country'
+ app_label = _('prefix_country')
+ verbose_name = _("Country")
+ verbose_name_plural = _("Countries")
+
+ def __unicode__(self):
+ return "%s" % (self.countrycode)
+
+
+class Prefix(Model):
+ """
+ Prefix
+
+ These are the prefixes and destinations
+ For instance : 44 ; United Kingdom
+ """
+ prefix = models.IntegerField(primary_key=True, help_text=_("Enter Prefix"))
+ destination = models.CharField(max_length=180,
+ help_text=_("Enter Destination"))
+ country_id = models.ForeignKey(Country, db_column="country_id", null=True,
+ blank=True, verbose_name="Country Code",
+ help_text=_("Select Country"))
+ carrier_name = models.CharField(max_length=180,
+ help_text=_("Enter Carrier Name"))
+ prefix_type = models.IntegerField(choices=prefix_type_list, default=1,
+ verbose_name='Prefix Type',
+ help_text=_("Select Prefix Type"))
+
+ class Meta:
+ db_table = 'simu_prefix'
+ app_label = _('prefix_country')
+ verbose_name = _("Prefix")
+ verbose_name_plural = _("Prefixes")
+ ordering = ["prefix"]
+
+ def __unicode__(self):
+ return "%d" % (self.prefix)
+
+ def country_name(self):
+ """
+ Return country name on country listing (changeview_list)
+ """
+ if self.country_id is None:
+ return ""
+ else:
+ return self.country_id.countryname
+ country_name.short_description = _("Country Name")
Oops, something went wrong.

0 comments on commit 826898c

Please sign in to comment.