# Path: core/models.py
# class Board(models.Model):
# 
#     name = models.CharField(max_length=100)
#     webhook_activate = models.BooleanField(default=False)
#     trello_board_id = models.CharField(max_length=100)
#     trello_token = models.CharField(max_length=100)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         ordering = ["name"]
#         verbose_name_plural = "boards"
# 
#     def __str__(self):
#         return self.name
# 
#     def __unicode__(self):
#         return "{}".format(self.name)
# 
# class Webhook(models.Model):
# 
#     name = models.CharField(max_length=50)
#     incoming_webhook_url = models.CharField(max_length=300, unique=True)
# 
#     icon_url = models.CharField(
#         max_length=250,
#         default="http://maffrigby.com/wp-content/uploads/2015/05/trello-icon.png",
#     )
#     username = models.CharField(max_length=30, default="Matterllo")
# 
#     board = models.ManyToManyField(Board)
# 
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         ordering = ["name"]
#         verbose_name_plural = "webhooks"
# 
#     def __str__(self):
#         return "{} :: {}".format(self.name, self.incoming_webhook_url)
# 
#     def __unicode__(self):
#         return "{} :: {}".format(self.name, self.incoming_webhook_url)


from os import getenv
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.utils.text import slugify
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.utils.decorators import method_decorator
from trello import TrelloClient
from core.models import Board, Webhook
# -*- coding: utf-8 -*-





class BoardView(ListView):
    """List boards from Trello and create each board into database.
    Create the trello Hook also.
    Then returns the board template.
    """


# Path: core/models.py
# class Board(models.Model):
# 
#     name = models.CharField(max_length=100)
#     webhook_activate = models.BooleanField(default=False)
#     trello_board_id = models.CharField(max_length=100)
#     trello_token = models.CharField(max_length=100)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         ordering = ["name"]
#         verbose_name_plural = "boards"
# 
#     def __str__(self):
#         return self.name
# 
#     def __unicode__(self):
#         return "{}".format(self.name)
# 
# class Webhook(models.Model):
# 
#     name = models.CharField(max_length=50)
#     incoming_webhook_url = models.CharField(max_length=300, unique=True)
# 
#     icon_url = models.CharField(
#         max_length=250,
#         default="http://maffrigby.com/wp-content/uploads/2015/05/trello-icon.png",
#     )
#     username = models.CharField(max_length=30, default="Matterllo")
# 
#     board = models.ManyToManyField(Board)
# 
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         ordering = ["name"]
#         verbose_name_plural = "webhooks"
# 
#     def __str__(self):
#         return "{} :: {}".format(self.name, self.incoming_webhook_url)
# 
#     def __unicode__(self):
#         return "{} :: {}".format(self.name, self.incoming_webhook_url)


# Path: core/views/board.py
from os import getenv
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.utils.text import slugify
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.utils.decorators import method_decorator
from trello import TrelloClient
from core.models import Board, Webhook

# -*- coding: utf-8 -*-





class BoardView(ListView):
    """List boards from Trello and create each board into database.
    Create the trello Hook also.
    Then returns the board template.
    """


    model = Board