Hello everyone,

I have a model in our database

class UsersSubmission(models.Model):
    dnasequence = model.TextField(blank=True, null=True)
    uploaded_time = models.DateTimeField(default=timezone.now)

I have a Django import-export module that helps to import and export the
data for my PIs through admin login. Export works smoothly through
different file formats (e.g. xlsx format). The exported data for the
uploaded_time field column appears (e.g. 2021-06-03 21:54:21). Now I
realize for our purpose, the model date field is necessary not the time.
Also, it makes our admin life simpler to have the only date in the excel
file. We have thousands of sequences in the database and I would like to
change this field smoothly. My questions are

1) How can I customize export only to have the date format from the
timezone.now. For imports, if an admin user provides the only date. I can
randomize time through the custom import function. As I said before, time
is optional.

2) Also, it appears the excel automatically changes the date format from
2021-06-03 to 6/3/21. I have to make sure both date format imports should
work.

3) If I want to change the field from DateTimeField to DateField directly
in the UserSubmission model now. How can I proceed with the changes without
afffecting existing data?

I am reading the StackOverflow answers. Some suitable examples or pointers
will help me to sort this out. I use Django version 3.2.

Thank you

Kannan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADiZb_fnZf%3DoD5pa%2B7-knZPrzBKHY3_EgJjz0ZQKmezw5Yb1fw%40mail.gmail.com.

Reply via email to