Add models

This commit is contained in:
Yohann D'ANELLO 2020-02-29 07:20:47 +01:00
parent 386013b137
commit ce6a169259
12 changed files with 74 additions and 8 deletions

View File

@ -0,0 +1 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay

17
apps/tbde/admin.py Normal file
View File

@ -0,0 +1,17 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from tbde.models import Ticket, Reward
@admin.register(Ticket)
class TicketAdmin(admin.ModelAdmin):
pass
@admin.register(Reward)
class RewardAdmin(admin.ModelAdmin):
pass

View File

@ -0,0 +1,8 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay
from django.apps import AppConfig
class TBDEConfig(AppConfig):
name = 'tbde'
verbose_name = _('tombola')

View File

@ -0,0 +1,37 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay
from django.db import models
from django.utils.translation import gettext_lazy as _
class Ticket(models.Model):
number = models.PositiveIntegerField(
verbose_name=_("number")
)
note = models.CharField(
max_length=255,
verbose_name=_("note")
)
class Reward(models.Model):
order = models.PositiveIntegerField(
verbose_name=_("order"),
)
name = models.CharField(
max_length=255,
verbose_name=_("name"),
)
image = models.ImageField(
verbose_name=_("image"),
)
rewarded_by = models.ForeignKey(
Ticket,
on_delete=models.PROTECT,
verbose_name=_("rewarded by")
)

View File

@ -0,0 +1 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay

View File

@ -1,10 +1,6 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# Copyright (C) 2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.http import HttpResponseRedirect
from urllib.parse import urlencode, parse_qs, urlsplit, urlunsplit
class TurbolinksMiddleware(object):
"""

View File

@ -1,3 +1,5 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay
import os
import re

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# Copyright (C) 2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
import os

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# Copyright (C) 2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
########################

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# Copyright (C) 2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
########################

View File

@ -1,3 +1,5 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay
"""tombola URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:

View File

@ -1,3 +1,5 @@
# Copyright (C) 2020 by BDE ENS Paris-Saclay
"""
WSGI config for tombola project.