Skip to content

Commit

Permalink
add created_at and updated_at datetime fields to AppliedSeeder Model
Browse files Browse the repository at this point in the history
  • Loading branch information
suliman-99 committed Sep 18, 2024
1 parent 0d9c475 commit 0fb0d8d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
17 changes: 15 additions & 2 deletions django_seeding/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,18 @@

@admin.register(AppliedSeeder)
class AppliedSeederAdmin(admin.ModelAdmin):
list_display = ('id', )
search_fields = ('id', )
list_display = (
'id',
'created_at',
'updated_at',
)
list_filter = (
'created_at',
'updated_at',
)
search_fields = (
'id',
)
ordering = (
'-updated_at',
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.0 on 2024-09-18 07:37

from django.db import migrations, models


class Migration(migrations.Migration):

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

operations = [
migrations.AddField(
model_name='appliedseeder',
name='created_at',
field=models.DateTimeField(auto_now_add=True, null=True),
),
migrations.AddField(
model_name='appliedseeder',
name='updated_at',
field=models.DateTimeField(auto_now=True, null=True),
),
]
3 changes: 3 additions & 0 deletions django_seeding/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

class AppliedSeeder(models.Model):
id = models.CharField(max_length=100, primary_key=True)

created_at = models.DateTimeField(null=True, blank=True, auto_now_add=True)
updated_at = models.DateTimeField(null=True, blank=True, auto_now=True)

def __str__(self) -> str:
return self.id
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = 'django-seeding'
version = '1.3.3'
version = '1.3.4'
description = 'Simple Django Package that helps developer to seed data from files and codes into the database automatically'
readme = "README.md"
authors = [
Expand Down

0 comments on commit 0fb0d8d

Please sign in to comment.