Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#305 - Add the accept_proposals_at on Event Form #311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deck/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class Meta:
'class': 'inline-input',
'placeholder': 'Due Date'
}),
'accept_proposals_at': CustomDateTimeWidget(attrs={
'id': 'id_accept_proposals',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be id_accept_proposals_at

'class': 'inline-input',
'placeholder': 'Date Accept Proposals'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be translated.

Copy link
Author

@chawki27000 chawki27000 Oct 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i write this chunk of code, because when the template generates the html page, it puts inline-input as a class and Date Accept Proposals as placeholder to input tag

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What i mean was that you need to use the ugettext function. _('Date Accept Proposals'), it would be something like this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I don't see the ugettext function

}),
}


Expand Down
20 changes: 20 additions & 0 deletions deck/migrations/0018_event_accept_proposals_at.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-10 17:59
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('deck', '0017_auto_20170922_1704'),
]

operations = [
migrations.AddField(
model_name='event',
name='accept_proposals_at',
field=models.DateTimeField(blank=True, null=True),
),
]
2 changes: 2 additions & 0 deletions deck/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ class Event(DeckBaseModel):
anonymous_voting = models.BooleanField(
_('Anonymous Voting?'), default=False)

accept_proposals_at = models.DateTimeField(null=True, blank=True)

class Meta:
ordering = ['-due_date', '-created_at']
verbose_name = _('Event')
Expand Down
1 change: 1 addition & 0 deletions deck/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_create_event(self):
event_data['due_date'] = (
event_data['due_date'].strftime('%d/%m/%Y %H:%M')
)
event_data['accept_proposals_at'] = (now() + timedelta(days=-20)).strftime('%d/%m/%Y %H:%M')
with self.settings(LANGUAGE_CODE='pt-BR'):
response = self.client.post(reverse('create_event'),
event_data, follow=True)
Expand Down
3 changes: 3 additions & 0 deletions deck/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def test_assert_event_jury_should_not_be_required(self):
def test_assert_event_jury_should_have_a_related_name(self):
self.assertEquals('event', self.fields['jury'].rel.related_name)

def test_assert_event_date_accept_proposals_should_not_be_required(self):
self.assertEquals(True, self.fields['accept_proposals_at'].null)
self.assertEquals(True, self.fields['accept_proposals_at'].blank)

class EventObjectTest(TestCase):
def setUp(self):
Expand Down