diff --git a/scipost/forms.py b/scipost/forms.py index 99d66613e1a86d19eb1064e909ad9c7a918c4224..082dc0bda83b2b6d6f045eb40a44702632d58c18 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -5,6 +5,9 @@ from django_countries.widgets import CountrySelectWidget from django_countries.fields import LazyTypedChoiceField from captcha.fields import CaptchaField +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Layout, Div, Field, Fieldset, HTML, Submit + from .models import * @@ -43,7 +46,19 @@ class RegistrationInvitationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(RegistrationInvitationForm, self).__init__(*args, **kwargs) self.fields['personal_message'].widget.attrs.update({'placeholder': 'NOTE: a personal phrase or two. The bulk of the text will be auto-generated.'}) - + self.helper = FormHelper() + self.helper.layout = Layout( + Div( + Div( + Field('title'), Field('first_name'), Field('last_name'), Field('email_address'), Field('invitation_type'), + css_class="col-6"), + Div( + Field('message_style'), + Field('personal_message'), + Submit('submit', 'Send invitation'), + css_class="col-6"), + css_class="row"), + ) class UpdateUserDataForm(forms.ModelForm): class Meta: diff --git a/scipost/templates/scipost/registration_invitations.html b/scipost/templates/scipost/registration_invitations.html index c4445ff757d0f54c30a22f7823e8cd4b46841f9d..53eb88e6ca4153f356340a9fb767562917645c53 100644 --- a/scipost/templates/scipost/registration_invitations.html +++ b/scipost/templates/scipost/registration_invitations.html @@ -16,10 +16,8 @@ </div> <form action="{% url 'scipost:registration_invitations' %}" method="post"> {% csrf_token %} - <table> - {{ reg_inv_form.as_table }} - </table> - <input type="submit" value="Submit" /> + {% load crispy_forms_tags %} + {% crispy reg_inv_form %} </form> </section> <hr class="hr12"/> diff --git a/scipost/utils.py b/scipost/utils.py index 016f43f8c2ea1076e3f6a051358e4b64a9c10ef2..cafdf91df9287b3d2cc46064010654877d4d0e9b 100644 --- a/scipost/utils.py +++ b/scipost/utils.py @@ -117,10 +117,10 @@ class Utils(object): cls.invitation.save() email_text = 'Dear ' if cls.invitation.message_style == 'F': - email_text += title_dict[cls.invitation.title] + ' ' + cls.invitation.last_name + ',\n\n' + email_text += title_dict[cls.invitation.title] + ' ' + cls.invitation.last_name else: - email_text += cls.invitation.first_name + ',\n\n' + cls.invitation.personal_message + '\n\n' - + email_text += cls.invitation.first_name + email_text += ',\n\n' + cls.invitation.personal_message + '\n\n' email_text += ('You will have noticed that the world of scientific publishing is currently undergoing many changes, but you will ll perhaps agree that it is not completely clear that the best interests of science and scientists are being served. In recent times, and after much thinking of how best to address this issue, I have decided to forge ahead and implement a new online publication portal by and for scientists.\n\nThe initiative, called SciPost, can in a sense be viewed as an extra layer on arXiv.org. To summarize, SciPost will be a complete scientific publication platform, run by and for professional scientists, providing:\n\n' + '- a means to comment on all existing literature\n\n' + '- a repository of links to theses (Habilitation, PhD, Master’s)\n\n' + diff --git a/scipost/views.py b/scipost/views.py index ad1f667a3014e810c2da81c65c4d263131f45ec4..3b6717125a58c245136ffbe475ebfd17bcda2b21 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -207,6 +207,8 @@ def accept_invitation(request, key): elif invitation.responded: errormessage = 'This invitation token has already been used.' else: + invitation.reponded = True + invitation.save() form = RegistrationForm() form.fields['last_name'].initial = invitation.last_name form.fields['first_name'].initial = invitation.first_name