Exemplo n.º 1
0
    def form_valid(self, form):
        subject = form.cleaned_data['subject']
        message = form.cleaned_data['message']
        filters = form.cleaned_data['filters']

        resource = LotResource()
        orm_filters = resource.build_filters(filters=filters)
        lot_pks = resource.apply_filters(self.request, orm_filters).values_list('pk', flat=True)

        participant_types = orm_filters.get('participant_types', [])

        if 'organizers' in participant_types:
            self._mail_organizers(lot_pks, subject, message)

        return super(MailParticipantsView, self).form_valid(form)
Exemplo n.º 2
0
    def form_valid(self, form):
        subject = form.cleaned_data["subject"]
        message = form.cleaned_data["message"]
        filters = form.cleaned_data["filters"]

        resource = LotResource()
        orm_filters = resource.build_filters(filters=filters)
        lot_pks = resource.apply_filters(self.request, orm_filters).values_list("pk", flat=True)

        participant_types = orm_filters.get("participant_types", [])

        if "organizers" in participant_types:
            self._mail_organizers(lot_pks, subject, message)

        return super(MailParticipantsView, self).form_valid(form)
Exemplo n.º 3
0
 def get_lots(self):
     resource = LotResource()
     orm_filters = resource.build_filters(filters=self.request.GET)
     return resource.apply_filters(self.request, orm_filters)
Exemplo n.º 4
0
 def get_lots(self):
     resource = LotResource()
     orm_filters = resource.build_filters(filters=self.request.GET)
     return resource.apply_filters(self.request, orm_filters)
Exemplo n.º 5
0
from tastypie.api import Api

from lots.api import OwnerResource, LotResource, LotListResource

v1_api = Api(api_name='v1')
v1_api.register(OwnerResource())
v1_api.register(LotResource())
v1_api.register(LotListResource())