Initial commit
This commit is contained in:
0
social/__init__.py
Normal file
0
social/__init__.py
Normal file
10
social/admin.py
Normal file
10
social/admin.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.contrib import admin
|
||||
from .models import Link
|
||||
|
||||
|
||||
# Register your models here.
|
||||
|
||||
class LinkAdmin(admin.ModelAdmin):
|
||||
readonly_fields = ('created', 'updated',)
|
||||
|
||||
admin.site.register(Link, LinkAdmin)
|
||||
6
social/apps.py
Normal file
6
social/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class SocialConfig(AppConfig):
|
||||
name = 'social'
|
||||
verbose_name="Redes Sociales"
|
||||
30
social/migrations/0001_initial.py
Normal file
30
social/migrations/0001_initial.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 2.1.2 on 2018-10-04 21:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Link',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('key', models.SlugField(max_length=100, unique=True, verbose_name='Nombre clave')),
|
||||
('name', models.CharField(max_length=200, verbose_name='Red social')),
|
||||
('url', models.URLField(blank=True, null=True, verbose_name='Enlace')),
|
||||
('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')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'enlace',
|
||||
'verbose_name_plural': 'enlaces',
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
]
|
||||
0
social/migrations/__init__.py
Normal file
0
social/migrations/__init__.py
Normal file
25
social/models.py
Normal file
25
social/models.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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
social/processors.py
Normal file
9
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
social/tests.py
Normal file
3
social/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
social/views.py
Normal file
3
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