aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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