aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-11-02 17:42:31 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-11-02 17:42:31 +0100
commitd84e10ac976c38e95f340b397d566e8ac3e89c39 (patch)
treed10540a0e867ca3e72da2a28b1394c7e827fe69e /pyaggr3g470r
parentAnother minor bugfix... (diff)
downloadnewspipe-d84e10ac976c38e95f340b397d566e8ac3e89c39.tar.gz
newspipe-d84e10ac976c38e95f340b397d566e8ac3e89c39.tar.bz2
newspipe-d84e10ac976c38e95f340b397d566e8ac3e89c39.zip
Bugfix when deleting an entire feed.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/models.py4
-rw-r--r--pyaggr3g470r/views.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py
index 82c0be15..1234b0a8 100644
--- a/pyaggr3g470r/models.py
+++ b/pyaggr3g470r/models.py
@@ -43,6 +43,10 @@ class Feed(EmbeddedDocument):
'ordering': ['+title']
}
+ def __eq__(self, other):
+ return self.title == other.title
+
+
def __str__(self):
return 'Feed: %s' % self.title
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 9b940381..f93f276f 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -129,7 +129,7 @@ def delete(article_id=None):
@app.route('/delete_feed/<feed_id>', methods=['GET'])
@login_required
def delete_feed(feed_id=None):
- user = models.User.objects(email=g.user.email, feeds__oid=feed_id).first()
+ user = models.User.objects(email=g.user.email).first()
# delete all articles (Document objects)
for feed in user.feeds:
if str(feed.oid) == feed_id:
@@ -137,7 +137,7 @@ def delete_feed(feed_id=None):
article.delete()
feed.articles = []
# delete the feed (EmbeddedDocument object)
- models.User.objects(email=g.user.email, feeds__oid=feed_id).update_one(pull__feeds__oid = feed_id)
+ user.feeds.remove(feed)
user.save()
return redirect(url_for('home'))
bgstack15