Revision 67980f56 snf-astakos-app/astakos/im/forms.py

b/snf-astakos-app/astakos/im/forms.py
627 627
        return super(ExtendedSetPasswordForm, self).save(commit=commit)
628 628

  
629 629

  
630

  
631

  
632
app_name_label       =  "Project name"
633
app_name_placeholder = _("myproject.mylab.ntua.gr")
634
app_name_validator   =  validators.RegexValidator(
635
                            DOMAIN_VALUE_REGEX,
636
                            _(astakos_messages.DOMAIN_VALUE_ERR),
637
                            'invalid')
638
app_name_help        =  _("""
639
        The Project's name should be in a domain format.
640
        The domain shouldn't neccessarily exist in the real
641
        world but is helpful to imply a structure.
642
        e.g.: myproject.mylab.ntua.gr or
643
        myservice.myteam.myorganization""")
644
app_name_widget      =  forms.TextInput(
645
                            attrs={'placeholder': app_name_placeholder})
646

  
647

  
648
app_home_label       =  "Homepage URL"
649
app_home_placeholder =  'http://myteam.myinstitution.org/myproject/'
650
app_home_help        =  _("""
651
        URL pointing at your project's site.
652
        e.g.: http://myteam.myinstitution.org/myproject.
653
        Leave blank if there is no website.""")
654
app_home_widget      =  forms.TextInput(
655
                            attrs={'placeholder': app_home_placeholder})
656

  
657
app_desc_label       =  _("Description")
658
app_desc_help        =  _("""
659
        Please provide a short but descriptive abstract of your Project,
660
        so that anyone searching can quickly understand
661
        what this Project is about.""")
662

  
663
app_comment_label    =  _("Comments for review (private)")
664
app_comment_help     =  _("""
665
        Write down any comments you may have for the reviewer
666
        of this application (e.g. background and rationale to
667
        support your request).
668
        The comments are strictly for the review process
669
        and will not be published.""")
670

  
671
app_start_date_label =  _("Start date")
672
app_start_date_help  =  _("""
673
        Provide a date when your need your project to be created,
674
        and members to be able to join and get resources.
675
        This date is only a hint to help prioritize reviews.""")
676

  
677
app_end_date_label   =  _("Termination date")
678
app_end_date_help    =  _("""
679
        At this date, the project will be automatically terminated
680
        and its resource grants revoked from all members.
681
        Unless you know otherwise,
682
        it is best to start with a conservative estimation.
683
        You can always re-apply for an extension, if you need.""")
684

  
685
join_policy_label    =  _("Joining policy")
686
leave_policy_label   =  _("Leaving policy")
687

  
688
max_members_label    =  _("Maximum member count")
689
max_members_help     =  _("""
690
        Specify the maximum number of members this project may have,
691
        including the owner. Beyond this number, no new members
692
        may join the project and be granted the project resources.
693
        Unless you certainly for otherwise,
694
        it is best to start with a conservative limit.
695
        You can always request a raise when you need it.""")
696

  
697
join_policies = PROJECT_MEMBER_JOIN_POLICIES.iteritems()
698
leave_policies = PROJECT_MEMBER_LEAVE_POLICIES.iteritems()
699

  
630 700
class ProjectApplicationForm(forms.ModelForm):
701

  
631 702
    name = forms.CharField(
632
        validators=[validators.RegexValidator(
633
            DOMAIN_VALUE_REGEX,
634
            _(astakos_messages.DOMAIN_VALUE_ERR),
635
            'invalid'
636
        )],
637
        widget=forms.TextInput(
638
            attrs={'placeholder': 'myproject.mylab.ntua.gr'}),
639
            help_text="""The Project's name should be in a domain format.
640
                         The domain shouldn't neccessarily exist in the real
641
                         world but is helpful to imply a structure.
642
                         e.g.: myproject.mylab.ntua.gr or
643
                         myservice.myteam.myorganization"""
644
    )
703
        label     = app_name_label,
704
        help_text = app_name_help,
705
        widget    = app_name_widget,
706
        validators = [app_name_validator])
707

  
645 708
    homepage = forms.URLField(
646
        label="Homepage Url",
647
        help_text="""This should be a URL pointing at your project's site.
648
                     e.g.: http://myproject.com""",
649
        widget=forms.TextInput(attrs={'placeholder': 'http://myproject.com'}),
709
        label     = app_home_label,
710
        help_text = app_home_help,   
711
        widget    = app_home_widget,
712
        required  = False)
713

  
714
    description = forms.CharField(
715
        label     = app_desc_label,
716
        help_text = app_desc_help,
717
        widget    = forms.Textarea,
718
        required  = False)
719

  
720
    comments = forms.CharField(
721
        label     = app_comment_label,
722
        help_text = app_comment_help,
723
        widget    = forms.Textarea,
724
        required  = False)
725

  
726
    start_date = forms.DateTimeField(
727
        label     = app_start_date_label,
728
        help_text = app_start_date_help,
729
        required  = False)
730

  
731
    end_date = forms.DateTimeField(
732
        label     = app_end_date_label,
733
        help_text = app_end_date_help)
734

  
735
    member_join_policy  = forms.ChoiceField(
736
        label     = join_policy_label,
737
        choices   = join_policies)
650 738

  
651
        required=False
652
     )
653
    comments = forms.CharField(widget=forms.Textarea, required=False)
654
    member_join_policy = forms.ChoiceField(
655
        choices=PROJECT_MEMBER_JOIN_POLICIES.iteritems())
656 739
    member_leave_policy = forms.ChoiceField(
657
        choices=PROJECT_MEMBER_LEAVE_POLICIES.iteritems())
740
        label     = leave_policy_label,
741
        choices   = leave_policies)
742

  
743
    limit_on_members_number = forms.IntegerField(
744
        label     = max_members_label,
745
        help_text = max_members_help,
746
        required  = False)
658 747

  
659 748
    class Meta:
660 749
        model = ProjectApplication
661
        exclude = (
662
            'project',
663
            'resource_grants', 'id', 'applicant', 'owner',
664
            'precursor_application', 'state', 'issue_date')
750
        #include = ( 'name', 'homepage', 'description',
751
        #            'start_date', 'end_date', 'comments')
665 752

  
666 753
    def __init__(self, *args, **kwargs):
667 754
        self.precursor_application = kwargs.get('instance')

Also available in: Unified diff