Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #---------------------settings/base.py-----------------------------------
- # ---DESPUES DE HACER EL PIP INSTALL TANTO COLORFUL Y COLORFIELD---------
- #----- LO AGREGUE EN INSTALLED_APPS, DESPUES DE ESTO LE HICE-------------
- #------ ./manage.py collectstatic ---------------------------------------
- #------ y con esto pense que ya podia usarlo en el forms/__init__py------
- """
- Django settings for pac_gateway project.
- Generated by 'django-admin startproject' using Django 1.9.5.
- For more information on this file, see
- https://docs.djangoproject.com/en/1.9/topics/settings/
- For the full list of settings and their values, see
- https://docs.djangoproject.com/en/1.9/ref/settings/
- """
- import os
- DEBUG = False
- if os.environ.get('DJANGO_DEBUG', False):
- DEBUG = True
- # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
- BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- # Quick-start development settings - unsuitable for production
- # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
- # SECURITY WARNING: keep the secret key used in production secret!
- SECRET_KEY = 'nbqoc-^@f#1(g#cux^w*$%14opecsr8np@m^h2vykctm+76!pw'
- ALLOWED_HOSTS = []
- # Application definition
- INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'django.contrib.postgres',
- 'rest_framework.authtoken',
- 'rest_framework',
- 'corsheaders',
- 'rest_framework_swagger',
- 'anymail',
- 'pac_gateway.cfd',
- 'daterange_filter',
- 'colorfield',
- 'colorful',
- ]
- # INSTALLED_APPS.append('colorful'),
- MIDDLEWARE_CLASSES = [
- 'django.middleware.security.SecurityMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'corsheaders.middleware.CorsMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django.middleware.clickjacking.XFrameOptionsMiddleware',
- ]
- CORS_ORIGIN_ALLOW_ALL = True
- CORS_ALLOW_CREDENTIALS = True
- ROOT_URLCONF = 'pac_gateway.urls'
- TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [os.path.join(BASE_DIR, 'templates'), ],
- 'APP_DIRS': True,
- 'OPTIONS': {
- 'context_processors': [
- 'django.template.context_processors.debug',
- 'django.template.context_processors.request',
- 'django.contrib.auth.context_processors.auth',
- 'django.contrib.messages.context_processors.messages',
- ],
- 'debug': DEBUG
- },
- },
- ]
- WSGI_APPLICATION = 'pac_gateway.wsgi.application'
- # Password validation
- # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
- AUTH_PASSWORD_VALIDATORS = [
- {
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
- },
- ]
- # Internationalization
- # https://docs.djangoproject.com/en/1.9/topics/i18n/
- LANGUAGE_CODE = 'es'
- TIME_ZONE = 'UTC'
- USE_I18N = True
- # USE_L10N = True
- USE_TZ = True
- LOCALE_PATHS = (
- os.path.join(BASE_DIR, 'locale'),
- )
- # Static files (CSS, JavaScript, Images)
- # https://docs.djangoproject.com/en/1.9/howto/static-files/
- STATIC_URL = '/static/'
- STATIC_ROOT = os.path.join(BASE_DIR, 'static')
- # Rest Framework
- REST_FRAMEWORK = {
- 'DEFAULT_PERMISSION_CLASSES': (
- 'rest_framework.permissions.IsAuthenticated',
- ),
- 'DEFAULT_FILTER_BACKENDS': (
- 'rest_framework.filters.DjangoFilterBackend',
- 'rest_framework.filters.SearchFilter'
- ),
- 'DEFAULT_AUTHENTICATION_CLASSES': (
- 'rest_framework.authentication.SessionAuthentication',
- 'rest_framework.authentication.TokenAuthentication'
- ),
- 'DEFAULT_PAGINATION_CLASS': (
- 'rest_framework.pagination.LimitOffsetPagination'
- )
- }
- LOGIN_REDIRECT_URL = "/api/docs/"
- # PAC Gateway setup
- CFDI_DEFAULT_VERSION = '3.2'
- CFDI_IR_SCHEMA_PATH = os.path.join(BASE_DIR, 'share', 'schemas',
- 'comprobante.json')
- PAC_GATEWAY_ENCRYPTION_KEY = os.environ.get('PAC_GATEWAY_ENCRYPTION_KEY', '')
- FINKOK_USERNAME = os.environ.get('FINKOK_USERNAME', '')
- FINKOK_PASSWORD = os.environ.get('FINKOK_PASSWORD', '')
- PAC_GATEWAY_AVAIL_SHEETS_WARNING_PCT = 0.125
- PAC_GATEWAY_DEFAULT_CERTIFICATION_DAYS = 3
- PAC_GATEWAY_FROM_EMAIL = "support@f-ambit.mx"
- # SAT Formats
- SAT_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S'
- # Default prefixes
- PAC_GATEWAY_DEFAULT_GLOBAL_INVOICE_PREFIX = 'FG'
- PAC_GATEWAY_DEFAULT_GLOBAL_CREDIT_NOTE_PREFIX = 'NCG'
- PAC_GATEWAY_DEFAULT_CREDIT_NOTE_PREFIX = 'NC'
- # Payment form strings
- PAC_GATEWAY_PAYMENT_FORM_SINGLE = 'Pago en una sola exhibición'
- PAC_GATEWAY_PAYMENT_FORM_MULTIPLE = 'Parcialidad {part} de {total_parts}'
- # Invoice defaults
- PAC_GATEWAY_DEFAULT_SAT_PAYMENT_METHOD = '01'
- PAC_GATEWAY_DEFAULT_UNIT = 'Unidad'
- PAC_GATEWAY_INSTALLED_APPS = {
- 'lightspeed-retail': ('pac_gateway.applications.lightspeed'
- '.retail.LightSpeedRetailHandler')
- }
- DEFAULT_PAF_CONFIG = {
- 'palette': {
- 'bg': '#F9F9F9',
- 'header_bg': '#FDFDFD',
- 'container_bg': '#FFFFFF',
- 'title_bg': '#E31818',
- 'form_footer_bg': '#F5F5F5',
- 'footer_bg': '#FDFDFD',
- 'primary_button_bg': '#E31818',
- 'secondary_button_bg': '#A0A0A0',
- 'font_color': '#838383',
- 'title_color': '#FFFFFF',
- 'link_color': '#337AB7',
- 'primary_button_color': '#FFFFFF',
- 'secondary_button_color': '#FFFFFF',
- 'form_footer_color': '#838383',
- 'footer_color': '#838383'
- }
- }
- # Invoice PDF setup
- INVOICE_PDF_PAGESIZE = 'letter'
- INVOICE_PDF_ORIENTATION = 'portrait'
- INVOICE_PDF_MARGIN = '1cm'
- INVOICE_PDF_PADDING = '0'
- # Swagger settings
- SWAGGER_SETTINGS = {
- 'api_version': '0.1',
- 'api_path': '/api/v1/',
- 'enabled_methods': [
- 'get',
- 'post',
- ],
- 'is_authenticated': True,
- 'permission_denied_handler': 'pac_gateway.cfd.views.permission_denied_handler',
- 'info': {
- 'contact': 'team@uakami.com',
- 'description': 'API Pac Gateway to search, claim and stamp invoices. ',
- # 'license': 'Apache 2.0',
- # 'licenseUrl': 'http://www.apache.org/licenses/LICENSE-2.0.html',
- # 'termsOfServiceUrl': 'http://helloreverb.com/terms/',
- 'title': 'Ambit - API Pac Gateway',
- }
- }
- # Anymail settings
- ANYMAIL = {
- "MAILGUN_API_KEY": os.environ.get('MAILGUN_API_KEY', None)
- }
- EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
- DEFAULT_FROM_EMAIL = "no-reply@f-ambit.mx"
- #---------------------forms/__init__.py-----------------------------------
- #---------------AQUI ES DONDE QUIERO USARLO-------------------------------
- # from colorful.fields import RGBColorField
- # from colorful.fields import RGBColorField
- # from colorfield.fields import ColorField
- from django import forms
- from django.contrib.admin.widgets import AdminSplitDateTime
- from django.utils.translation import ugettext_lazy as _
- from pac_gateway.cfd.models import CFD
- from pac_gateway.cfd.models import OrganizationCertificate
- from .fields import ColorField
- class OrganizationCertificateForm(forms.ModelForm):
- pwd = forms.CharField(
- max_length=64,
- label=_('Certificate Password'),
- help_text=_('Only for setting the password'),
- required=False,
- widget=forms.PasswordInput
- )
- def save(self, *args, **kwargs):
- self.instance.pwd = self.cleaned_data['pwd']
- return super(OrganizationCertificateForm, self).save(*args, **kwargs)
- class Meta:
- model = OrganizationCertificate
- fields = ('der_certificate', 'der_key',
- 'pwd',)
- class PAFConfigForm(forms.Form):
- # Backgrounds
- bg = ColorField(
- label=_('Main Background'),
- required=False,
- )
- header_bg = ColorField(
- label=_('Header Background'),
- required=False,
- )
- container_bg = ColorField(
- label=_('Container bg'),
- required=False,
- )
- title_bg = ColorField(
- label=_('Title bg'),
- required=False,
- )
- footer_bg = ColorField(
- label=_('Footer bg'),
- required=False,
- )
- form_footer_bg = ColorField(
- label=_('Form footer bg'),
- required=False,
- )
- primary_button_bg = ColorField(
- label=_('Primary btn bg'),
- required=False,
- )
- secondary_button_bg = ColorField(
- label=_('Secondary btn bg'),
- required=False,
- )
- # Font colors
- font_color = ColorField(
- label=('Font color'),
- required=False,
- )
- title_color = ColorField(
- label=_('Title color'),
- required=False,
- )
- link_color = ColorField(
- label=_('Link color'),
- required=False,
- )
- primary_button_color = ColorField(
- label=_('Primary btn color'),
- required=False,
- )
- secondary_button_color = ColorField(
- label=_('secondary btn color'),
- required=False,
- )
- form_footer_color = ColorField(required=False)
- footer_color = ColorField(required=False)
- # Images
- logo = forms.CharField(
- label=_('Image: Logo (250x125)'),
- required=False
- )
- # URLs and contact
- website_url = forms.URLField(
- label=_('Website Url'),
- required=False
- )
- email = forms.EmailField(
- label=_('Email')
- )
- phone_number = forms.CharField(
- label=_('Phone Number')
- )
- # Copies
- claiming_period_text = forms.CharField(
- required=False,
- widget=forms.Textarea,
- label=_('Claim')
- )
- support_text = forms.CharField(
- required=False,
- widget=forms.Textarea,
- label=_('Support')
- )
- class AllocateTaxSheetsForm(forms.Form):
- sheets = forms.IntegerField(
- label=_('Number of sheets'),
- help_text=_(
- 'Total number of tax sheets to allocate for the organization'
- ),
- )
- class ClosingDateForm(forms.Form):
- CLASS_GLOBAL_CHOICES = (
- (CFD.CLASS_GLOBAL_INVOICE, _('Global Invoice')),
- (CFD.CLASS_GLOBAL_CREDIT_NOTE, _('Global Credit Note'))
- )
- invoice_class = forms.ChoiceField(
- choices=CLASS_GLOBAL_CHOICES,
- initial=CFD.CLASS_GLOBAL_INVOICE,
- help_text=_('Class of the global invoice'),
- label=_('Global invoice class')
- )
- date = forms.SplitDateTimeField(
- label=_('Closing date and time'),
- help_text=_(
- 'Date and time for the closing of the global invoice or credit note'
- ),
- widget=AdminSplitDateTime
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement