from datetime import datetime, timedelta
from django.db import models

CHALLENGE_STATUS_CHOICES = (
    ('NW', 'New'),
    ('IP', 'In Progress'),
    ('CP', 'Completed'),
)

class Challenge(models.Model):
    title = models.CharField('Challenge Title', max_length = 200)
    starts = models.DateTimeField('Start Date', default = datetime.now)
    ends = models.DateTimeField('End Date', default = lambda: datetime.now() +
        timedelta(days=7))
    status = models.CharField('Challenge Status', max_length = 2,
        choices=CHALLENGE_STATUS_CHOICES)
    summary = models.TextField('Challenge Details')

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        return "/challenge/%i/" % self.id


from datetime import datetime, timedelta
from django.db import models
from django.core.urlresolvers import reverse

CHALLENGE_STATUS_CHOICES = (
    ('NW', 'New'),
    ('IP', 'In Progress'),
    ('CP', 'Completed'),
)

class Challenge(models.Model):
    title = models.CharField('Challenge Title', max_length = 200)
    starts = models.DateTimeField('Start Date', default = datetime.now)
    ends = models.DateTimeField('End Date', default = lambda: datetime.now() +
        timedelta(days=7))
    status = models.CharField('Challenge Status', max_length = 2,
        choices=CHALLENGE_STATUS_CHOICES)
    summary = models.TextField('Challenge Details')

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('challenge-details', args=[self.id,])


Use reverse() instead of a hardcoded url for Challenge
Use reverse() instead of a hardcoded url for Challenge

Instead of hardcoding the url in Challenge.get_absolute_url(), use
reverse().

Signed-off-by: Sebastian Nowicki <72cef2e23c539c1a2a17e6651ec7265f998b0d23@gmail.com>
