def post(self):
        """Create a new competition."""
        user_id, user = self.get_user()
        if not user or not user.admin:
            self.redirect("/")

        title = self.request.get("comp-title")
        description = self.request.get("comp-description")
        month = int(self.request.get("comp-month"))
        year = int(self.request.get("comp-year"))

        errors = []

        if not title:
            errors.append("You forgot to give this competition a title.")

        comp = Competition.get_by_title_date(title, month, year)
        if comp:
            errors.append(
                "A competition already exists with this title (%s), month (%s), "
                "and year (%d)" % (title, MONTHS[month], year)
            )

        if errors:
            data = {"errors": errors, "page_title": "New Competition", "user": user, "months": MONTHS}
            self.render("competition-new.html", **data)
            return

        # no errors so create new competiton
        start = date(year, month, 1)
        end = date(year, month, monthrange(year, month)[1])
        new_comp = Competition(title=title, description=description, month=month, year=year, start=start, end=end)
        new_comp.put()
        self.redirect("/competition/admin")