title: How to use username as a string in model in django?
body: <p>I want to use the username of the account in which my django is running as a string to load the model fields specific to that username. I have created a file 'survey.py' which returns a dictionary and I want the keys as the fields.
  How can I get the username as string? </p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from multiselectfield import MultiSelectField
  from survey_a0_duplicate import details, analysis                                                                           
  import ast
  
  class HomeForm1(models.Model):
      user= models.OneToOneField(User, on_delete=models.CASCADE,)
  
  
  
      details.loadData(survey_name = user)#&lt;=====This loads the data for specific user&lt;======
  
      global f1
      f1=analysis.getQuestion(in_json=False)#&lt;====We get the dictionary here&lt;========                      
  
      d=list(f1.keys())
  
  
      ###################assign the filters####################################################### 
      for k in d:
          q=list(f1[k].keys())
          q.sort()
          choices=tuple(map(lambda f: (f,f),q))
          locals()[k]=MultiSelectField(max_length=1000,choices=choices,blank=True)
  
  
      def save(self, *args, **kwargs):
          if self.pk is None:
              self.user= self.user.username
          super(HomeForm1,self).save(*args,**kwargs)
  
  
  
      def __str__(self):
          return self.title
  </code></pre>