示例#1
0
文件: tests.py 项目: dimagi/aremind
 def test_valid_twitter_feed(self):
     """A known-valid twitter feed will validate"""
     form = FeedForm(data={
         'name': "twitter",
         'feed_type': Feed.TYPE_TWIITER
     })
     self.assertTrue(form.is_valid())
示例#2
0
文件: tests.py 项目: dimagi/aremind
 def test_invalid_twitter_feed(self):
     """Don't allow creating an invalid twitter feed"""
     form = FeedForm(data={
         'name': "there's no such twitter feed",
         'feed_type': Feed.TYPE_TWIITER
     })
     self.assertFalse(form.is_valid())
示例#3
0
def create_edit_feed(request, feed_id=None):
    if feed_id:
        feed = get_object_or_404(Feed, pk=feed_id)
    else:
        feed = Feed()
    
    if request.method == 'POST':
        form = FeedForm(request.POST, instance=feed)
        if form.is_valid():
            feed = form.save()
            messages.info(request, "Message Feed saved successfully")
            return redirect('adherence-dashboard')
    else:
        form = FeedForm(instance=feed)

    context = {
        'feed': feed,
        'form': form,
    }
    return render(request, 'adherence/create_edit_feed.html', context)
示例#4
0
文件: tests.py 项目: dimagi/aremind
 def test_valid_twitter_feed(self):
     """A known-valid twitter feed will validate"""
     form = FeedForm(data={'name': "twitter",
                           'feed_type': Feed.TYPE_TWIITER})
     self.assertTrue(form.is_valid())
示例#5
0
文件: tests.py 项目: dimagi/aremind
 def test_invalid_twitter_feed(self):
     """Don't allow creating an invalid twitter feed"""
     form = FeedForm(data={'name': "there's no such twitter feed",
                           'feed_type': Feed.TYPE_TWIITER})
     self.assertFalse(form.is_valid())