This commit is contained in:
Andros Fenollosa
2021-06-22 15:43:26 +02:00
parent 3ce1665ca0
commit a901b8d54a
26 changed files with 368 additions and 0 deletions

0
app/web/__init__.py Normal file
View File

3
app/web/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
app/web/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class WebConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'app.web'

View File

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}{% endblock %} | Djanker News</title>
</head>
<body>
<header>
<ul>
<li>
<a href="{% url 'list' %}">List</a>
</li>
<li>
<a href="{% url 'add-news' %}">Add News</a>
</li>
</ul>
</header>
<main>
<h1>Djanker News</h1>
{% block main %}{% endblock %}
</main>
<footer>
2021 Djanker News
</footer>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,12 @@
{% extends 'layouts/base.html' %}
{% block title %}Welcome{% endblock %}
{% block main %}
{% for item in news %}
<article>
<h2>{{ item.title }}</h2>
<p>
<a href="{{ item.url }}">Ver completo</a>
</p>
</article>
{% endfor %}
{% endblock %}

3
app/web/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

12
app/web/views.py Normal file
View File

@ -0,0 +1,12 @@
from django.shortcuts import render
from app.api.models import News
def home(request):
return render(request, 'pages/list.html', {
'news': News.objects.all()
})
def add_news(request):
return render(request, 'pages/add-news.html', {})