title: Using a list of classes as a model for table class in django_tables2
body: <p>I tried to create a table using a class that is not related to my database in django and this class is stored in <code>models.py</code> as shown below (<code>InfoServer</code> is the class). What I wanted to do is to use this class to populate my table using <code>django_tables2</code>. Add <code>models.Model</code> as a parameter is not an option because I don't want to save this class in the database.</p>
  
  <p>Whenever I define the <code>model = InfoServer</code> in <code>tables.py</code> I got this error and I suppose it's because <code>InfoServer</code> did not take <code>models.Model</code> as a parameter. </p>
  
  <blockquote>
    <p>TypeError: descriptor '<strong>repr</strong>' of 'object' object needs an argument</p>
  </blockquote>
  
  <p>Any help is appreciated.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class TestServeur(models.Model):
      nom = models.CharField(max_length=200)
      pid = models.CharField(max_length=200)
      memoire = models.IntegerField(null=True)
  
  class InfoServer:
      # "This is a class to test my knowledge of python"
      def __init__(self,p = '',c = 0,m = 0):
          self.pid = p
          self.cpu = c
          self.memoire = m
  
      def getData(self):
          return ("A server with %s memory and %s cpu" % (self.cpu,self.memoire))
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def index(request):
      return HttpResponse("Hello, world. You're at the index.")
  
  def cpu_view(request):
      liste = []
      proc1 = Popen(['ps','-eo','pid,%cpu,%mem,comm'], stdout=PIPE, stderr=PIPE)
      proc2 = Popen(['grep','java'], stdin=proc1.stdout, stdout=PIPE)
      proc1.stdout.close()
  
      for line in iter(proc2.stdout.readlines()):
          clean_line = line.decode("utf-8")
          info_utiles = clean_line.split()
          pid,cpu,mem,*rest = info_utiles
          i1 = InfoServer(pid,cpu,mem)
          liste.append(i1)
  
      table = TestServeur(liste)
      RequestConfig(request).configure(table)
      return render(request, 'server/cpu.html', {'output': table})
  </code></pre>
  
  <p><strong>tables.py</strong></p>
  
  <pre><code>class TableServeur(tables.Table):
      class Meta:
          # model = InfoServer
          fields = ['pid', 'memory', 'cpu']
          template_name = 'django_tables2/bootstrap4.html'
  </code></pre>