Repository: CiviWiki/OpenCiviWiki

Issue:
Profile Error - partials/account/tabs/my_bills.html doesn't exist
Internal Server Error: /profile/ani

Error - django.template.exceptions.TemplateDoesNotExist: partials/account/tabs/my_bills.html

I checked and found that my_bills.html was deleted in b600ead9fc563eef6086fb1c46120d71dba97703


Discussion:
Good catch. We removed (most) functionality related to bills/legislation but seem to have overlooked this template. Please consider removing the reference to the template and any similar code you may find.
You may assign it to me
https://github.com/CiviWiki/OpenCiviWiki/blob/76d49d5a01de3ae0e89c71a8b4499c7b5625e8de/project/threads/templates/threads/account.html#L74

I made this change - `src="{% static 'js/account.js' %}"`
And removed references to mybills

Now on opening profile, it just continues to load indefinitely (Might be related to #914)

Also take a look at the error in console - 

![Screenshot (373)](https://user-images.githubusercontent.com/40134444/128339314-6339af02-45b3-4763-a7cc-7f743195cc92.png)

I visited the url shown in the console and got this error - 

Internal Server Error: /api/account_profile/ani/
Traceback (most recent call last):
  File "C:\Users\HP\Desktop\OpenCiviWiki\env\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\HP\Desktop\OpenCiviWiki\env\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\HP\Desktop\OpenCiviWiki\project\api\read.py", line 51, in get_profile
    result = Account.objects.summarize(a)
  File "C:\Users\HP\Desktop\OpenCiviWiki\project\api\models\account.py", line 40, in summarize
    "history": [
  File "C:\Users\HP\Desktop\OpenCiviWiki\project\api\models\account.py", line 41, in <listcomp>
    Civi.objects.serialize(c)
  File "C:\Users\HP\Desktop\OpenCiviWiki\project\api\models\civi.py", line 46, in serialize
    "hashtags": [hashtag.title for hashtag in civi.hashtags.all()],
AttributeError: 'Civi' object has no attribute 'hashtags'
Do I need to change the files in `project\staticfiles` folder or would they be automatically changed?
Well, we're in the process of replacing the JavaScript UI with static templates that get rendered by Django. So the ideal outcome here would be to replace this template with a Django-only template and delete the deprecated JS for this particular view. You can feel free to take creative liberty with the rendered output but it might be worth using the existing styles since they are fairly nice.
For the specific error, it looks like we changed the `hashtags` field to just `tags` and neglected to update the related code.

https://github.com/CiviWiki/OpenCiviWiki/blob/76d49d5a01de3ae0e89c71a8b4499c7b5625e8de/project/api/models/civi.py#L107

It might be worth searching the project for uses of the `hashtags` field and replacing it with `tags` to see how far we get.

Resolving patch:
diff --git a/project/api/models/civi.py b/project/api/models/civi.py
--- a/project/api/models/civi.py
+++ b/project/api/models/civi.py
@@ -43,7 +43,7 @@ def serialize(self, civi, filter=None):
                 "first_name": civi.author.first_name,
                 "last_name": civi.author.last_name,
             },
-            "hashtags": [hashtag.title for hashtag in civi.hashtags.all()],
+            "tags": [tag.title for tag in civi.tags.all()],
             "created": "{0} {1}, {2}".format(
                 month_name[civi.created.month], civi.created.day, civi.created.year
             ),
@@ -73,7 +73,7 @@ def serialize_s(self, civi, filter=None):
                 first_name=civi.author.first_name,
                 last_name=civi.author.last_name,
             ),
-            "hashtags": [h.title for h in civi.hashtags.all()],
+            "tags": [h.title for h in civi.tags.all()],
             "created": "{0} {1}, {2}".format(
                 month_name[civi.created.month], civi.created.day, civi.created.year
             ),
@@ -267,7 +267,7 @@ def dict_with_score(self, req_acct_id=None):
             ],
             "created": self.created_date_str,
             # Not Implemented Yet
-            "hashtags": [],
+            "tags": [],
             "attachments": [
                 {"id": img.id, "url": img.image_url} for img in self.images.all()
             ],
diff --git a/project/api/read.py b/project/api/read.py
--- a/project/api/read.py
+++ b/project/api/read.py
@@ -134,7 +134,7 @@ def get_thread(request, thread_id):
         data = {
             "title": t.title,
             "summary": t.summary,
-            "hashtags": t.hashtags.all().values(),
+            "tags": t.tags.all().values(),
             "author": {
                 "username": t.author.user.username,
                 "profile_image": t.author.profile_image.url


Test patch: