Skip to content

Commit

Permalink
Added the new model 'Technology' to app core
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben69695 committed Jun 20, 2022
1 parent 10738ab commit ef0c850
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
7 changes: 5 additions & 2 deletions core/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from django.contrib import admin
from .models import ContactMessage
from .models import ContactMessage, Technology

# Register your models here.
class ContactMessageAdmin(admin.ModelAdmin):
readonly_fields = ()

class TechnologyAdmin(admin.ModelAdmin):
readonly_fields = ('name', 'created')

admin.site.register(ContactMessage, ContactMessageAdmin)
admin.site.register(ContactMessage, ContactMessageAdmin)
admin.site.register(Technology, TechnologyAdmin)
2 changes: 1 addition & 1 deletion core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.AutoField'
name = 'core'
verbose_name = 'Contacto'
verbose_name = 'Core'
26 changes: 26 additions & 0 deletions core/migrations/0002_technology.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.0.4 on 2022-06-20 17:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Technology',
fields=[
('name', models.CharField(max_length=25, primary_key=True, serialize=False, verbose_name='Name')),
('created', models.DateTimeField(auto_now=True, verbose_name='Created date')),
('updated', models.DateTimeField(auto_now=True, verbose_name='Updated date')),
],
options={
'verbose_name': 'technology',
'verbose_name_plural': 'technologies',
'ordering': ['name'],
},
),
]
17 changes: 17 additions & 0 deletions core/migrations/0003_remove_technology_updated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.0.4 on 2022-06-20 19:17

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0002_technology'),
]

operations = [
migrations.RemoveField(
model_name='technology',
name='updated',
),
]
14 changes: 13 additions & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,16 @@ class Meta:
ordering = ["-email"]

def __str__(self):
return self.email
return self.email

class Technology(models.Model):
name = models.CharField(max_length=25, verbose_name="Name", primary_key=True)
created = models.DateTimeField(auto_now=True, verbose_name="Created date")

class Meta:
verbose_name = "technology"
verbose_name_plural = "technologies"
ordering = ["name"]

def __str__(self):
return self.name

0 comments on commit ef0c850

Please sign in to comment.