from django.db import models

class Playbook(models.Model):

    class Meta:
        verbose_name_plural = "playbooks"

    name = models.CharField(max_length=200)
    path = models.CharField(max_length=200, default="~/")
    ansible_config = models.CharField(max_length=200, default="~/")
    inventory = models.CharField(max_length=200, default="hosts")
    user = models.CharField(max_length=200, default="ubuntu")

    def __str__(self):
        return "Playbook name: %s" % self.playbook.name

from django.db import models

class Playbook(models.Model):

    class Meta:
        verbose_name_plural = "playbooks"

    name = models.CharField(max_length=200)
    path = models.CharField(max_length=200, default="~/")
    ansible_config = models.CharField(max_length=200, default="~/")
    inventory = models.CharField(max_length=200, default="hosts")
    user = models.CharField(max_length=200, default="ubuntu")

    def __str__(self):
        return "%s" % self.name

Fix string output of Playbook
Fix string output of Playbook

  from django.db import models
  
  class Playbook(models.Model):
  
      class Meta:
          verbose_name_plural = "playbooks"
  
      name = models.CharField(max_length=200)
      path = models.CharField(max_length=200, default="~/")
      ansible_config = models.CharField(max_length=200, default="~/")
      inventory = models.CharField(max_length=200, default="hosts")
      user = models.CharField(max_length=200, default="ubuntu")
  
      def __str__(self):
-         return "Playbook name: %s" % self.playbook.name
+         return "%s" % self.name
  
Fix string output of Playbook
## Code Before:
from django.db import models

class Playbook(models.Model):

    class Meta:
        verbose_name_plural = "playbooks"

    name = models.CharField(max_length=200)
    path = models.CharField(max_length=200, default="~/")
    ansible_config = models.CharField(max_length=200, default="~/")
    inventory = models.CharField(max_length=200, default="hosts")
    user = models.CharField(max_length=200, default="ubuntu")

    def __str__(self):
        return "Playbook name: %s" % self.playbook.name

## Instruction:
Fix string output of Playbook
## Code After:
from django.db import models

class Playbook(models.Model):

    class Meta:
        verbose_name_plural = "playbooks"

    name = models.CharField(max_length=200)
    path = models.CharField(max_length=200, default="~/")
    ansible_config = models.CharField(max_length=200, default="~/")
    inventory = models.CharField(max_length=200, default="hosts")
    user = models.CharField(max_length=200, default="ubuntu")

    def __str__(self):
        return "%s" % self.name
