# Create your views here.
from django.shortcuts import render_to_response
from models import *
from settings import TWITTER_ID
import twitter
from django.template import RequestContext
from django import forms
from django.forms.widgets import Textarea

class ContactForm(forms.Form):
    email = forms.EmailField()
    name = forms.CharField(max_length=255)
    message = forms.CharField(widget=Textarea(attrs={'cols': 10, 'rows': 6}))

    '''
    class Meta:
        widgets = {
            'message': Textarea(attrs={'cols': 80, 'rows': 20})
        }
    '''

def index(request):
    try:
      tApi = twitter.Api()
      statuses = tApi.GetUserTimeline(TWITTER_ID)
    except:
      statuses = []
    boxes = SliderBox.objects.all()
    return render_to_response("noel/index.html", RequestContext(request, {
        'tweets': statuses[0:5],
        'boxes': boxes
    }))

def contact(request):
#    form = ContactForm()
    return render_to_response("registration/contact.html", RequestContext(request, {
        'form': ContactForm()
    }))

