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

Re: How can I add attrs in ModelChoiceField?

2017-08-01 Thread
\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", > 'rows' : 3 , &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

Re: How to get extra data in clean_data?

2017-07-18 Thread
ng-fields-that-depend-on-each-other > > > > > Cheers > > > > Tom > > > > On Tue, Jul 18, 2017 at 10:19 AM, 李余通 <liyutong...@gmail.com > > wrote: > >> My mind is here: > >> > >> class Register(forms.Form): &g

Re: How to get extra data in clean_data?

2017-07-18 Thread
m/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 > > > Cheers > > Tom > > On Tue, Jul 18, 2017 at 10:19 AM, 李余通 <liyutong...@gmail.com &

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 =

What Way is best to extend User in Django 1.11?

2017-07-18 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.

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

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

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