Add docker support
This commit is contained in:
0
django/social/__init__.py
Normal file
0
django/social/__init__.py
Normal file
17
django/social/admin.py
Normal file
17
django/social/admin.py
Normal 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
6
django/social/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class SocialConfig(AppConfig):
|
||||
name = 'social'
|
||||
verbose_name = "Redes Sociales"
|
||||
0
django/social/migrations/__init__.py
Normal file
0
django/social/migrations/__init__.py
Normal file
34
django/social/models.py
Normal file
34
django/social/models.py
Normal 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
|
||||
9
django/social/processors.py
Normal file
9
django/social/processors.py
Normal 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
3
django/social/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
django/social/views.py
Normal file
3
django/social/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user