Resloved, datetime format issue, More see stackoverflow



在 2016年9月5日星期一 UTC+8上午12:15:35,广宏伟写道:
>
> I use django version 1.10, When a add LocaleMiddleware into settings.py, 
> form valid error. I have been makemessage and compile it
>
> Here is my model and form, 
>
>
>
> class User(AbstractUser):
>>     ...   
>>     is_first_login = models.BooleanField(default=False)
>>     date_expired = models.DateTimeField(default=date_expired_default, 
>> blank=True, null=True, verbose_name='Date expired')
>>     created_by = models.CharField(max_length=30, default='')
>>
>>
>> class UserAddForm(ModelForm):
>>     class Meta:
>>         model = User
>>         fields = [
>>             'username', 'name', 'email', 'groups', 'wechat',
>>             'phone', 'enable_otp', 'role', 'date_expired', 'comment',
>>         ]
>>
>>         help_texts = {
>>             'username': '* required',
>>             'email': '* required',
>>         }
>>
>>
> And settings.py
>
> MIDDLEWARE = [
>     'django.middleware.security.SecurityMiddleware',
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.middleware.common.CommonMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
>     'django.middleware.locale.LocaleMiddleware',
>     'django.middleware.clickjacking.XFrameOptionsMiddleware',
> ]
>
>
>  
> I also ask on stackoverflow 
> http://stackoverflow.com/questions/39318887/django-form-datetime-field-valid-error-after-add-django-middleware-locale-locale
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4f8fcd5c-d992-45dd-b57f-41622a302deb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to