Re: Question on creating a contact form app using bootstrap template

2014-08-19 Thread Mario Gudelj
Some other options:

- Install https://github.com/dyve/django-bootstrap-toolkit and use {{
form|as_bootstrap }}. See the docs for more options.

- http://django-crispy-forms.readthedocs.org/en/latest/ Crispy Forms is
amazing BTW (by the way)

- Render your labels with {{form.field_name.label}} and fields with
{{form.field_name}} and errors with {{form.field_name.errors}} inside that
boostrap markup. You'll have to do this individually for every field
though. As for the attributes, such as placeholder, classes and data
attributes, you have to pass the to the widget class inside attr={}

Cheers,

M





On 19 August 2014 20:15, Martin Spasov  wrote:

> Maybe you could copy the classes and id's from the template and put them
> in your form like this :
>
> class  SomeForm(forms.Form):
> name=forms.CharField(attrs={'class':'form-control', 'id':'name'})
> message=forms.CharField(widget=forms.TextInput(attrs={'class':'the
> class name thats on the templates form for the text input'})
>
> And then pass the SomeForm to the view as some context variable, for
> example 'form'.
> In your template :
>   novalidate>
> 
>{%for field in form%}
>{{field.label}} {{field}}
>{%endfor%}
> Send Message
>  
>
> This is just advice from beginner to beginner and if there is an easier
> way please correct me! If you choose this way Kim and you don't understand
> something please ask!
>
> On Tuesday, August 19, 2014 9:36:55 AM UTC+2, Kim wrote:
>>
>> Thank you for the advice, Collin!
>> However, If I have this HTML below, where should I put {{ form.[name] }}?
>>
>>  > novalidate>
>> 
>> > class="form-control" placeholder="Your Name *" id="name" required
>> data-validation-required-message="Please enter your name.">
>> 
>> 
>> Send Message
>>  
>>
>> 2014年8月19日火曜日 10時42分19秒 UTC+9 Collin Anderson:
>>>
>>> I recommend making the same contact form in django first, then merge the
>>> two. Your starter template only makes the form look good, it doesn't
>>> provide much functionality.
>>>
>>  --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c25c646e-bbc2-44c5-a4d4-fe36296c9b88%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkgxCVe5buPNj-e0h4okhNkvFO6DZbcW_pRiOC1DXW9Uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question on creating a contact form app using bootstrap template

2014-08-19 Thread Martin Spasov
Maybe you could copy the classes and id's from the template and put them in 
your form like this :

class  SomeForm(forms.Form):
name=forms.CharField(attrs={'class':'form-control', 'id':'name'})
message=forms.CharField(widget=forms.TextInput(attrs={'class':'the 
class name thats on the templates form for the text input'})

And then pass the SomeForm to the view as some context variable, for 
example 'form'.
In your template :
 

   {%for field in form%}
   {{field.label}} {{field}}
   {%endfor%}
Send Message
 

This is just advice from beginner to beginner and if there is an easier way 
please correct me! If you choose this way Kim and you don't understand 
something please ask!

On Tuesday, August 19, 2014 9:36:55 AM UTC+2, Kim wrote:
>
> Thank you for the advice, Collin! 
> However, If I have this HTML below, where should I put {{ form.[name] }}?
>
>   novalidate>
> 
>  class="form-control" placeholder="Your Name *" id="name" required 
> data-validation-required-message="Please enter your name.">
> 
> 
> Send Message
>  
>
> 2014年8月19日火曜日 10時42分19秒 UTC+9 Collin Anderson:
>>
>> I recommend making the same contact form in django first, then merge the 
>> two. Your starter template only makes the form look good, it doesn't 
>> provide much functionality.
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c25c646e-bbc2-44c5-a4d4-fe36296c9b88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question on creating a contact form app using bootstrap template

2014-08-19 Thread Kim
Thank you for the advice, Collin! 
However, If I have this HTML below, where should I put {{ form.[name] }}?

 




Send Message
 

2014年8月19日火曜日 10時42分19秒 UTC+9 Collin Anderson:
>
> I recommend making the same contact form in django first, then merge the 
> two. Your starter template only makes the form look good, it doesn't 
> provide much functionality.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ede60587-679b-4059-b380-cd0b1f02bed4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question on creating a contact form app using bootstrap template

2014-08-18 Thread Collin Anderson
I recommend making the same contact form in django first, then merge the 
two. Your starter template only makes the form look good, it doesn't 
provide much functionality.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a536de0d-9723-4c23-819e-6a7107e342ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question on creating a contact form app using bootstrap template

2014-08-18 Thread Kim
Anyone? 

2014年8月18日月曜日 16時13分28秒 UTC+9 Kim:
>
> Hi,
>
> I'm learning python/django and am building my personal page using this 
> template (http://startbootstrap.com/templates/agency/). 
>
> Since it already has a contact form, I would like to integrate django form 
> app on that to actually work. 
>
> I was looking at the django doc (
> https://docs.djangoproject.com/en/dev/topics/forms/) but I wasn't sure 
> how to structure the system. 
>
> Could anyone suggest me how to integrate the backend system into the 
> template?
>
> I would appreciate very much if you could give me sample code examples!
>
> Thanks,
> Kim
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cf4db0e4-4a5c-4f1e-9dc2-032477580809%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Question on creating a contact form app using bootstrap template

2014-08-18 Thread Kim
Hi,

I'm learning python/django and am building my personal page using this 
template (http://startbootstrap.com/templates/agency/). 

Since it already has a contact form, I would like to integrate django form 
app on that to actually work. 

I was looking at the django doc 
(https://docs.djangoproject.com/en/dev/topics/forms/) but I wasn't sure how 
to structure the system. 

Could anyone suggest me how to integrate the backend system into the 
template?

I would appreciate very much if you could give me sample code examples!

Thanks,
Kim

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62e997bf-53b7-464f-8632-d00d6f3ed020%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.