• GitHub
  • Documentation
  • Discord
  • Donate
search
  • chevron_right Threads
  • label Dev Development

How to create an app that sends information to base.html?

sadako
Feb. 7, 2021
chat_bubble_outline 5
  • link
    sadako
    Members 9 posts
    Feb. 7, 2021, 7:58 p.m. Feb. 7, 2021, 7:58 p.m.
    link

    Hi!

    I am currently working on a project that uses Misago as a base to create a Forum specialized in the COVID situation. Right now my task is to render COVID news into Misago's base.html, so it would look something like this...
    Expectation
    ^ As you can see I am displaying some cards and in theNews card, I use GoogleNews to change the new's title and image daily

    Right now I am trying to inject my code into Misago, and I already have the layout of where I will place the cards
    Current progress

    So, I decided to create a new app inside Misago that would control the logic and would send the GoogleNews information to the template I used for the cards.
    Right now, the structure looks like this:
    CodeStructure for Cards app
    ^ As a test, for now I am just trying to send the greetings variable

    The problem is that I am not receiving the data in the template and I believe that the problem is in the urls folder.

    This is what I have in api.py
    Urls/api.py

    And this is what I have in init.py
    urls/init.py

  • link
    sadako
    Members 9 posts
    Feb. 7, 2021, 8:01 p.m. Feb. 7, 2021, 8:01 p.m.
    link

    To be honest, I just followed what I saw other folders had in api.py and __init__.py because in other projects I just create a urls.py which has a different structure. Hopefully, you can help me to find the problem

  • link
    sadako
    Members 9 posts
    Feb. 7, 2021, 8:22 p.m. Feb. 7, 2021, 8:22 p.m.
    link

    I just discovered that when I add /news to the URL, then I receive the information xD
    localhost:8000/news

    But the template is then destroyed ┐(‘~`;)┌

    I don't know if the problem is in my template so I will include it here:
    gallery.html

  • link
    rafalp
    Project Lead 1976 posts
    Feb. 7, 2021, 11:22 p.m. Feb. 7, 2021, 11:22 p.m.
    link

    Your template is not extending the base template, so it renders without any layout HTML as well as <head> section containing JS and CSS.

  • link
    sadako
    Members 9 posts
    Feb. 7, 2021, 11:36 p.m. Feb. 7, 2021, 11:36 p.m.
    link
    @rafalp

    Your template is not extending the base template, so it renders without any layout HTML as well as <head> section containing JS and CSS.

    Thank you so much! I was able to solve it!!
    Sorry, I have been writing dumb questions but it has helped me to learn a lot

  • link
    rafalp
    Project Lead 1976 posts
    Feb. 7, 2021, 11:37 p.m. Feb. 7, 2021, 11:37 p.m.
    link

    Please spend few moments to familiarize yourself with the Django Framework, that will make it much easier to work with Misago's codebase.

arrow_upward Go to top
  • This site uses cookies to gather statistical data for use in traffic analysis.
  • GitHub
  • Documentation
  • Discord
  • Donate
  • Terms of service
  • Privacy policy
powered by misago