コード例 #1
0
    def setUp(self):
        super(TestMeetingCreateFormView, self).setUp()
        Conference.remove()
        self.user = AuthUserFactory()
        self.request = RequestFactory().post('/fake_path')
        self.view = MeetingCreateFormView
        mod_data = dict(data)
        mod_data.update({'admins': self.user.emails.first().address})
        self.form = MeetingForm(data=mod_data)
        self.form.is_valid()

        self.url = reverse('meetings:create')
コード例 #2
0
 def dispatch(self, request, *args, **kwargs):
     endpoint = kwargs.get('endpoint')
     try:
         self.conf = Conference.get_by_endpoint(endpoint, active=False)
     except ConferenceError:
         raise Http404(
             'Meeting with endpoint "{}" not found'.format(endpoint))
     return super(MeetingFormView, self).dispatch(request, *args, **kwargs)
コード例 #3
0
ファイル: views.py プロジェクト: erinspace/osf.io
 def dispatch(self, request, *args, **kwargs):
     endpoint = kwargs.get('endpoint')
     try:
         self.conf = Conference.get_by_endpoint(endpoint, active=False)
     except ConferenceError:
         raise Http404('Meeting with endpoint "{}" not found'.format(
             endpoint
         ))
     return super(MeetingFormView, self).dispatch(request, *args, **kwargs)
コード例 #4
0
ファイル: views.py プロジェクト: darshanman40/osf.io
 def form_valid(self, form):
     custom_fields, data = get_custom_fields(form.cleaned_data)
     endpoint = data.pop('endpoint')
     self.kwargs.setdefault('endpoint', endpoint)
     # Form validation already checks emails for existence
     admin_users = get_admin_users(data.pop('admins'))
     # Note - Mongo was OK with having this in the payload, but Postgres is not
     # This edit variable was unused in the past, but keeping it in case we want to use it in the future.
     data.pop('edit')
     # Form validation already catches if a conference endpoint exists
     new_conf = Conference(endpoint=endpoint, **data)
     new_conf.save()
     new_conf.admins = admin_users
     new_conf.field_names.update(custom_fields)
     new_conf.save()
     return super(MeetingCreateFormView, self).form_valid(form)
コード例 #5
0
ファイル: views.py プロジェクト: erinspace/osf.io
 def form_valid(self, form):
     custom_fields, data = get_custom_fields(form.cleaned_data)
     endpoint = data.pop('endpoint')
     self.kwargs.setdefault('endpoint', endpoint)
     # Form validation already checks emails for existence
     admin_users = get_admin_users(data.pop('admins'))
     # Note - Mongo was OK with having this in the payload, but Postgres is not
     # This edit variable was unused in the past, but keeping it in case we want to use it in the future.
     data.pop('edit')
     # Form validation already catches if a conference endpoint exists
     new_conf = Conference(
         endpoint=endpoint,
         **data
     )
     new_conf.save()
     new_conf.admins = admin_users
     new_conf.field_names.update(custom_fields)
     new_conf.save()
     return super(MeetingCreateFormView, self).form_valid(form)
コード例 #6
0
ファイル: views.py プロジェクト: adlius/osf.io
 def get_queryset(self):
     return Conference.find()
コード例 #7
0
 def setUp(self):
     super(TestMeetingListView, self).setUp()
     Conference.remove()
     ConferenceFactory()
     ConferenceFactory()
     ConferenceFactory()
コード例 #8
0
ファイル: views.py プロジェクト: darshanman40/osf.io
 def get_queryset(self):
     return Conference.find()