P
P
Pan Propan2016-02-18 19:58:31
Django
Pan Propan, 2016-02-18 19:58:31

How to make Django recognize Cyrillic?

65569b338fcc4874b3ea548ab078eb17.png
Tell me please.
Python3.4
Django==1.9.2
Here is the model itself

from datetime import date, timedelta, datetime
from django.db import models

class Customer(models.Model):       
    firstname = models.CharField(max_length=100, verbose_name="Имя", blank=False, null=True)
    lastname = models.CharField(max_length=300, verbose_name="Фамилия", blank=False, null=True)
    MAN = 'M'
    FEMALE = 'F'
    GENDER_CHOICES = (
        (MAN, 'Мужской'),
        (FEMALE, 'Женский'),
    )
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES, default=MAN, verbose_name="Пол",)
    midle_name = models.CharField(max_length=300, verbose_name="Отчетство", blank=True, null=True)
    birthday = models.DateField(verbose_name="Дата рождения")
    phone = models.CharField(max_length=20, verbose_name="Номер телефона")
    email = models.EmailField(max_length=200, verbose_name="Электронный адрес")

    class Meta:
        verbose_name = 'Пациент'
        verbose_name_plural = 'Пациенты'

    def __str__(self):
        return "%s %s" % (self.firstname, self.lastname)

Here is the Admin
from django.contrib import admin
from .models import Customer


class CustomerAdmin(admin.ModelAdmin):
    list_display = ('firstname', 'lastname', 'email')

admin.site.register(Customer, CustomerAdmin)

# -*- coding: utf-8 -*-
Tried adding to the beginning of the file, didn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2016-02-18
@mgis

It looks like a problem with the base encoding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question