title: Get the currently logged in Django user in a models.py file?
body: <p>I'm trying to make a model that's stores basic information about an Article also store the name of the currently logged in user, is this possible? or is it something that needs to be done in the views.py file.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>from django.db import models
  from time import time
  
  from django.contrib.auth.models import User
  
  
  def get_upload_file_name(instance, filename):
      return "uploaded_files/%s_%s" % (str(time()).replace('.','_'), filename)
  
  
  # Create your models here.
  class Article(models.Model):
      title = models.CharField(max_length=200)
      author = models.CharField(User.get_username()) #AUTOMATICALLY STORE USERNAME
      body = models.TextField()
      pub_date = models.DateTimeField(auto_now=True)
      likes = models.IntegerField(default=0)
      thumbnail = models.FileField(upload_to=get_upload_file_name)
  
      def __unicode__(self):
          return self.title
  </code></pre>
  
  <p>Here's the function that handles the Article model located in views.py:</p>
  
  <pre><code>def create(request):
      if request.POST:
          form = ArticleForm(request.POST, request.FILES)
          if form.is_valid():
              form.save()
  
              return HttpResponseRedirect('/articles/all')
  
      else:
          form = ArticleForm()
  
      args = {}
      args.update(csrf(request))
  
      args['form'] = form 
  
      return render_to_response('create_article.html', args)
  </code></pre>
  
  <p>How can I make it so that when a new article is created, the username should be stored as the "author" the same way the "pub_date" automatically stores the current date? </p>