old_contents: from django.http import HttpResponse, HttpResponseRedirect
  from django.views.generic import View
  from django.utils.decorators import method_decorator
  from django.template import RequestContext, loader
  from django.core.exceptions import PermissionDenied
  from django.contrib.auth.decorators import login_required
  from django.shortcuts import get_object_or_404, render_to_response, render
  
  
  class IndexView(View):
      template_name = 'tviit/index.html'
  
      @method_decorator(login_required(login_url='/login/'))
      def get(self, request, *args, **kwargs):
          context = RequestContext(request, {
          })
  
          return render(request, self.template_name, context)
  
  
new_contents: from django.http import HttpResponse, HttpResponseRedirect
  from django.views.generic import View
  from django.utils.decorators import method_decorator
  from django.template import RequestContext, loader
  from django.core.exceptions import PermissionDenied
  from django.contrib.auth.decorators import login_required
  from django.shortcuts import get_object_or_404, render_to_response, render
  from .models import Tviit, TviitForm
  import uuid
  
  
  class IndexView(View):
  
      @method_decorator(login_required(login_url='/login/'))
      def get(self, request, *args, **kwargs):
          template = loader.get_template('tviit/index.html')
          context = {
  
          }
          return HttpResponse(template.render(context, request))
  
  
  @login_required(login_url='/login/')
  def create_tviit(request):
      if request.method == 'POST':
          form = TviitForm(request.POST, request.FILES)
  
          if form.is_valid():
              f = form.save(commit=False)
              f.uuid = uuid.uuid4().int
              f.sender = request.user
              print request.FILES
              f.image = request.FILES['image']
              f.save()
              return HttpResponse(status=201) # Created
  
  
      else:
          return HttpResponse(status=400) # Bad Content
  
  '''
  def reply_tviit(request):
      if request.method == 'POST':
          post_text = request.POST.get('the_post')
          response_data = {}
  
          post = Post(text=post_text, author=request.user)
          post.save()
  
          response_data['result'] = 'Create post successful!'
          response_data['postpk'] = post.pk
          response_data['text'] = post.text
          response_data['created'] = post.created.strftime('%B %d, %Y %I:%M %p')
          response_data['author'] = post.author.username
  
          return HttpResponse(
              json.dumps(response_data),
              content_type="application/json"
          )
      else:
          return HttpResponse(
              json.dumps({"nothing to see": "this isn't happening"}),
              content_type="application/json"
          )
  def like_tviit(request):
      if request.method == 'POST':
          post_text = request.POST.get('the_post')
          response_data = {}
  
          post = Post(text=post_text, author=request.user)
          post.save()
  
          response_data['result'] = 'Create post successful!'
          response_data['postpk'] = post.pk
          response_data['text'] = post.text
          response_data['created'] = post.created.strftime('%B %d, %Y %I:%M %p')
          response_data['author'] = post.author.username
  
          return HttpResponse(
              json.dumps(response_data),
              content_type="application/json"
          )
      else:
          return HttpResponse(
              json.dumps({"nothing to see": "this isn't happening"}),
              content_type="application/json"
          )
  '''
subject: Add tviit creation function into Views Create placeholders for reply and like