def publisher_settings_feeds_edit(request, id): ''' View to allow a Publisher to edit a DataFeed ''' from forms import PublisherFeedForm feed = get_object_or_404(request.organization.publisherdatafeed_set, id=id) if request.method == "POST": form = PublisherFeedForm(request.POST, org=request.organization) if form.is_valid(): feed.advertiser = form.cleaned_data['advertiser'] feed.datafeed_type = form.cleaned_data['datafeed_type'] feed.datafeed_format = form.cleaned_data['datafeed_format'] feed.username = form.cleaned_data['username'] or '' feed.password = form.cleaned_data['password'] or '' feed.server = form.cleaned_data['server'] or '' feed.save() return HttpResponseRedirect('/publisher/settings/feeds/') else: feed_dict = feed.__dict__ feed_dict['advertiser'] = feed.advertiser.id form = PublisherFeedForm(initial=feed_dict, org=request.organization) return AQ_render_to_response(request, 'publisher/settings/feeds-edit.html', { 'form': form, 'feed': feed, }, context_instance=RequestContext(request))
def publisher_settings_feeds_add(request): ''' View to allow a Publisher to add a DataFeed ''' from atrinsic.base.models import PublisherDataFeed from forms import PublisherFeedForm if request.method == "POST": form = PublisherFeedForm(request.POST, org=request.organization) if form.is_valid(): df = PublisherDataFeed.objects.create( publisher=request.organization, advertiser=form.cleaned_data["advertiser"], datafeed_type=form.cleaned_data['datafeed_type'], datafeed_format=form.cleaned_data['datafeed_format'], username=form.cleaned_data['username'] or '', password=form.cleaned_data['password'] or '', server=form.cleaned_data['server'] or '') if df.datafeed_type != DATAFEEDTYPE_FTPPULL: # XXX Call function to send messages to network admins?? return AQ_render_to_response( request, 'publisher/settings/feeds-notice.html', { 'feed': df, }, context_instance=RequestContext(request)) return HttpResponseRedirect('/publisher/settings/feeds/') else: form = PublisherFeedForm(org=request.organization) return AQ_render_to_response(request, 'publisher/settings/feeds-add.html', { 'form': form, }, context_instance=RequestContext(request))
def publisher_settings_feeds_edit(request, id): ''' View to allow a Publisher to edit a DataFeed ''' from forms import PublisherFeedForm feed = get_object_or_404(request.organization.publisherdatafeed_set, id=id) if request.method == "POST": form = PublisherFeedForm(request.POST,org=request.organization) if form.is_valid(): feed.advertiser = form.cleaned_data['advertiser'] feed.datafeed_type = form.cleaned_data['datafeed_type'] feed.datafeed_format = form.cleaned_data['datafeed_format'] feed.username = form.cleaned_data['username'] or '' feed.password = form.cleaned_data['password'] or '' feed.server = form.cleaned_data['server'] or '' feed.save() return HttpResponseRedirect('/publisher/settings/feeds/') else: feed_dict = feed.__dict__ feed_dict['advertiser'] = feed.advertiser.id form = PublisherFeedForm(initial=feed_dict,org=request.organization) return AQ_render_to_response(request, 'publisher/settings/feeds-edit.html', { 'form' : form, 'feed': feed, }, context_instance=RequestContext(request))
def publisher_settings_feeds_add(request): ''' View to allow a Publisher to add a DataFeed ''' from atrinsic.base.models import PublisherDataFeed from forms import PublisherFeedForm if request.method == "POST": form = PublisherFeedForm(request.POST,org=request.organization) if form.is_valid(): df = PublisherDataFeed.objects.create(publisher=request.organization, advertiser=form.cleaned_data["advertiser"], datafeed_type=form.cleaned_data['datafeed_type'], datafeed_format=form.cleaned_data['datafeed_format'], username=form.cleaned_data['username'] or '', password=form.cleaned_data['password'] or '', server=form.cleaned_data['server'] or '') if df.datafeed_type != DATAFEEDTYPE_FTPPULL: # XXX Call function to send messages to network admins?? return AQ_render_to_response(request, 'publisher/settings/feeds-notice.html', { 'feed': df, }, context_instance=RequestContext(request)) return HttpResponseRedirect('/publisher/settings/feeds/') else: form = PublisherFeedForm(org=request.organization) return AQ_render_to_response(request, 'publisher/settings/feeds-add.html', { 'form' : form, }, context_instance=RequestContext(request))
def publisher_settings_feeds(request,page=None): ''' View a Publishers Feed Settings ''' from atrinsic.base.models import PublisherDataFeed from forms import PublisherFeedForm if request.method == "POST": form = PublisherFeedForm(request.POST,org=request.organization) if form.is_valid(): df = PublisherDataFeed.objects.create(publisher=request.organization, advertiser=form.cleaned_data["advertiser"], datafeed_type=form.cleaned_data['datafeed_type'], datafeed_format=form.cleaned_data['datafeed_format'], username=form.cleaned_data['username'] or '', password=form.cleaned_data['password'] or '', server=form.cleaned_data['server'] or '') if df.datafeed_type != DATAFEEDTYPE_FTPPULL: # XXX Call function to send messages to network admins?? return AQ_render_to_response(request, 'publisher/settings/feeds-notice.html', { 'feed': df, }, context_instance=RequestContext(request)) return HttpResponseRedirect('/publisher/settings/feeds/') else: form = PublisherFeedForm(org=request.organization) qs = request.organization.publisherdatafeed_set.all() return object_list(request, queryset=qs, allow_empty=True, page=page, template_name='publisher/settings/feeds.html', paginate_by=50, extra_context={ 'total_results' : qs.count(), 'form' : form, })
def publisher_settings_feeds(request, page=None): ''' View a Publishers Feed Settings ''' from atrinsic.base.models import PublisherDataFeed from forms import PublisherFeedForm if request.method == "POST": form = PublisherFeedForm(request.POST, org=request.organization) if form.is_valid(): df = PublisherDataFeed.objects.create( publisher=request.organization, advertiser=form.cleaned_data["advertiser"], datafeed_type=form.cleaned_data['datafeed_type'], datafeed_format=form.cleaned_data['datafeed_format'], username=form.cleaned_data['username'] or '', password=form.cleaned_data['password'] or '', server=form.cleaned_data['server'] or '') if df.datafeed_type != DATAFEEDTYPE_FTPPULL: # XXX Call function to send messages to network admins?? return AQ_render_to_response( request, 'publisher/settings/feeds-notice.html', { 'feed': df, }, context_instance=RequestContext(request)) return HttpResponseRedirect('/publisher/settings/feeds/') else: form = PublisherFeedForm(org=request.organization) qs = request.organization.publisherdatafeed_set.all() return object_list(request, queryset=qs, allow_empty=True, page=page, template_name='publisher/settings/feeds.html', paginate_by=50, extra_context={ 'total_results': qs.count(), 'form': form, })