Django
This commit is contained in:
0
apps/charts/__init__.py
Normal file
0
apps/charts/__init__.py
Normal file
3
apps/charts/admin.py
Normal file
3
apps/charts/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
apps/charts/apps.py
Normal file
6
apps/charts/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ChartsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.charts'
|
||||
0
apps/charts/migrations/__init__.py
Normal file
0
apps/charts/migrations/__init__.py
Normal file
3
apps/charts/models.py
Normal file
3
apps/charts/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
apps/charts/tests.py
Normal file
3
apps/charts/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
7
apps/charts/urls.py
Normal file
7
apps/charts/urls.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from apps.charts import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="charts"),
|
||||
]
|
||||
13
apps/charts/views.py
Normal file
13
apps/charts/views.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.shortcuts import render
|
||||
from django.core import serializers
|
||||
from apps.pages.models import *
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def index(request):
|
||||
products = serializers.serialize('json', Product.objects.all())
|
||||
context = {
|
||||
'segment': 'charts',
|
||||
'products': products
|
||||
}
|
||||
return render(request, 'charts/index.html', context)
|
||||
Reference in New Issue
Block a user