Skip to content

Commit

Permalink
Merge pull request #45 from Onemind-Services-LLC/fix/forms-3.6
Browse files Browse the repository at this point in the history
Add the _init_time in the form data
  • Loading branch information
abhi1693 authored Mar 11, 2024
2 parents b3350e8 + 6e66649 commit 24283e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions netbox_metatype_importer/api/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from collections import OrderedDict
import time
from urllib.parse import urlencode

from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.db.models import Q
from django.shortcuts import reverse
Expand Down Expand Up @@ -152,6 +151,9 @@ def create(self, request, *args, **kwargs):
if field_name not in data and hasattr(field, 'initial'):
model_form.data[field_name] = field.initial

# Initialize the "_init_time" field with the current timestamp to ensure it's present in the form data
model_form.data["_init_time"] = time.time()

if model_form.is_valid():
try:
with transaction.atomic():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='netbox-metatype-importer',
version='0.2.1',
version='0.2.2',
description='Easily import Device and Module types from GitHub repo',
long_description='Import MetaTypes into NetBox',
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 24283e0

Please sign in to comment.