Add docker support

This commit is contained in:
Jesús
2022-01-13 18:08:28 -05:00
parent b77c06257f
commit 4317b0ba5d
66 changed files with 324 additions and 1061 deletions

View File

17
django/social/admin.py Normal file
View File

@@ -0,0 +1,17 @@
from django.contrib import admin
from .models import Link
# Register your models here.
class LinkAdmin(admin.ModelAdmin):
readonly_fields = ('created', 'updated')
def get_readonly_fields(self, request, obj=None):
if request.user.groups.filter(name='Personal').exists():
return ('key', 'name')
else:
return ('created', 'updated')
admin.site.register(Link, LinkAdmin)

6
django/social/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class SocialConfig(AppConfig):
name = 'social'
verbose_name = "Redes Sociales"

View File

34
django/social/models.py Normal file
View File

@@ -0,0 +1,34 @@
from django.db import models
class Link(models.Model):
key = models.SlugField(
verbose_name="Nombre clave",
max_length=100,
unique=True)
name = models.CharField(
verbose_name="Red social",
max_length=200)
url = models.URLField(
verbose_name="Enlace",
max_length=200,
null=True,
blank=True)
created = models.DateTimeField(
auto_now_add=True,
verbose_name='Fecha de creación')
updated = models.DateTimeField(
auto_now=True,
verbose_name='Fecha de modificación')
class Meta:
verbose_name = 'enlace'
verbose_name_plural = 'enlaces'
ordering = ["name"]
def __str__(self):
return self.name

View File

@@ -0,0 +1,9 @@
from .models import Link
def ctx_dict(request):
ctx = {}
links = Link.objects.all()
for link in links:
ctx[link.key] = link.url
return ctx

3
django/social/tests.py Normal file
View File

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

3
django/social/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.