Skip to content

Commit 92ec829

Browse files
author
Kátia Nakamura
committed
cfp: add ActiveModel
1 parent ef3a049 commit 92ec829

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 2.0.5 on 2018-08-12 18:39
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('cfp', '0009_auto_20180810_1859'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='cfp',
15+
name='active',
16+
field=models.BooleanField(default=True),
17+
preserve_default=False
18+
),
19+
]

pyconbalkan/cfp/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
from markdownx.utils import markdownify
1111
from slugify import slugify
1212
from taggit.managers import TaggableManager
13+
14+
from pyconbalkan.core.models import ActiveModel
1315
from . import const
1416

1517

16-
class Cfp(models.Model):
18+
class Cfp(ActiveModel):
1719
name = models.CharField(max_length=256)
1820
company = models.CharField(max_length=100, null=True, blank=True)
1921
email = models.EmailField()

pyconbalkan/cfp/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def cfp_view(request):
4141

4242
@login_required
4343
def cfp_list(request):
44-
cfps = Cfp.objects.annotate(
44+
cfps = Cfp.objects.filter(active=True).annotate(
4545
my_rating=Subquery(CFPRating.objects.filter(cfp=OuterRef('pk'), user=request.user).values('mark'))
4646
)
4747

@@ -53,7 +53,7 @@ def cfp_list(request):
5353

5454
@login_required
5555
def cfp_detail(request, slug):
56-
cfp = get_object_or_404(Cfp, slug=slug)
56+
cfp = get_object_or_404(Cfp, slug=slug, active=True)
5757
ratings = CFPRating.objects.filter(cfp=cfp)
5858
context = {
5959
'cfp': cfp,

0 commit comments

Comments
 (0)