jinja2 to print doesn't exist Variables

2017-08-15 Thread
Hello every: http://jinja.pocoo.org/docs/2.9/templates/#variables In Django template language: if {{ var }} doesn't exist,it will print nothing,the jinja2's document said it will print noting default,however it print "{{ var }}"?how to change it to noting whithout chang tags "{{ var }}". ps : {{

how to use dj_pagination in Django1.11

2017-08-03 Thread
dj_pagination say: 1. If it’s not already added in your setup, add the request context processor. Note that context processors are set by default implicitly, so to set them explicitly, you need to copy and paste this code into your under the value TEMPLATE_CONTEXT_PROCESS

Re: How can I add attrs in ModelChoiceField?

2017-07-31 Thread
n\u5168\u90e8\n\U0001f436\n 在 2017年8月1日星期二 UTC+8上午10:59:12,李余通写道: > > Hello,Everyone, > I know charField can use > > forms.TextInput(attrs={'class' : 'form-control', > }), > or > forms.Textarea(attrs={'class' : "form-control", &g

How can I add attrs in ModelChoiceField?

2017-07-31 Thread
Hello,Everyone, I know charField can use forms.TextInput(attrs={'class' : 'form-control', }), or forms.Textarea(attrs={'class' : "form-control", 'rows' : 3 , }) to set widgets but ModelChoiceField? I have no idea,Django telled me "'module' object has no attrib

Re: How to get extra data in clean_data?

2017-07-18 Thread
.com/en/1.8/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other > > > > > Cheers > > > > Tom > > > > On Tue, Jul 18, 2017 at 10:19 AM, 李余通 > wrote: > >> My mind is here: > >> > >> class Regi

Re: How to get extra data in clean_data?

2017-07-18 Thread
her field, you do so in the clean() > method: > > https://docs.djangoproject.com/en/1.8/ref/forms/validation/ > > and in detail > > > https://docs.djangoproject.com/en/1.8/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other > > &

How to get extra data in clean_data?

2017-07-18 Thread
My mind is here: class Register(forms.Form): passwd = forms.CharField(max_length=20,label='密码',widget=forms.PasswordInput) repasswd = forms.CharField(max_length=20,label='重复密码',widget=forms.PasswordInput) def clean_passwd(self): passwd = self.cleaned_data['passwd'] repasswd = se

What Way is best to extend User in Django 1.11?

2017-07-17 Thread
How to extend User?I find many ways; 1. Use Profile eg: class UserProfile(models.Model): user = models.OneToOneField(User) major = models.TextField(default='', blank=True) This way is easy to understand,However,it will create a new table in sql,I heard this will add System burden. 2

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread
uot; header, that would be enough. Why do you post > data manually though? > > On 15 Jun 2017, at 16:33, 李余通 > wrote: > > Ture,my way is wrong,should i send cookies? > > 在 2017年6月15日星期四 UTC+8下午9:29:17,Александр Христюхин写道: >> >> CSRF token value is passed in D

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread
Ture,my way is wrong,should i send cookies? 在 2017年6月15日星期四 UTC+8下午9:29:17,Александр Христюхин写道: > > CSRF token value is passed in Django's response headers. > And anyway, you're no supposed to post data like that. Do you do that in > tests? > > On 15 Jun 2017, at 16:20, liyutong...@gmail.com w