Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django - Room model needs to have a selection of many room types. One room must have at least one room type from the predefined selection
One property can have one or many rooms. One room must belong to one property. The question is at the end. I start by creating the Room Model class Room(models.Model): property = models.ForeignKey(Property) name = models.CharField(max_length=250) description = models.TextField(max_length=800) image = models.ImageField(upload_to='room_images/', blank=False) bar_rate = models.IntegerField(default=0, blank=False) max_occupancy = models.IntegerField(default=1, blank=False) extra_beds = models.IntegerField(default=0, blank=True) price_per_exra_bed = models.IntegerField(default=0, blank=True) is_breakfast_included = models.BooleanField(default=False) room_type_quantity = models.IntegerField(default=0, blank=False) ROOM_TYPES = ( ('SGL', 'Single'), ('TWN', 'Twin'), ('DBL', 'Double'), ('TRPL', 'Triple'), ('STND', 'Standard'), ('DLX', 'Deluxe'), ('EXET', 'Executive'), ('SPR', 'Superior'), ('JS', 'Junior Suite'), ('ONEBDR', 'One Bedroom'), ('TWOBDR', 'Two Bedroom'), ('THREEBDR', 'Three Bedroom'), ('FOURBDR', 'Four Bedroom'), ('FIVEBDR', 'Five Bedroom'), ('SIXBDR', 'Six Bedroom'), ('SEVENBDR', 'Seven Bedroom'), ) room_type = models.CharField(max_length=1, choices=ROOM_TYPES, default="STND") def __str__(self): return self.name I create a new form to allow the user to fill out the form. Inside forms.py class RoomForm(forms.ModelForm): class Meta: model = Room exclude = ("property",) As you can see above I exclude the property model, I don’t need to add the property info into the RoomForm. In views.py I have modified the property_add_room function to save the room into the database: @login_required(login_url='/property/sign-in/') def property_add_room(request): form = RoomForm() if request.method == "POST": form = RoomForm(request.POST, request.FILES) if form.is_valid(): room = form.save(commit=False) … -
Creating a server-side casino game using Python
I have created a casino style game using Python that is turn based, however I am not really sure how I would export this to a website format so it can be played online. I get the premise of multiplayer networks using socket however having multiple lobbies for players who sign up to the website, a cash/betting system where players can buy and withdraw tokens is all very new to me despite working with Python for about 4-5 years now as a hobbyist. I am looking for multiple games to be running at once as any casino site would and I would like the method to be able to be applied to other casino games I add to the website in the future. Also I was wondering how I could make animations with Python on the website or if it's even possible. I have looked everywhere and found no solution so this is why I ask. One other note is that for obvious reasons I would do all the calculations server side otherwise they could be rigged (that is why I used Python over JavaScript). Thank you for the help, please feel free to contact me about anything! -
Can we do arithmetic using Django Subqueries?
I am wondering if Django's ORM allows us to do aggregate operations on subqueires, and then do arithmetic with the resulting values. What would be the proper way to go about something like this: record = PackingRecord.objects.filter(product=OuterRef('pk')) packed = FifoLink.objects.filter(packing_record__product=OuterRef('pk')) output = obj_set.annotate( in_stock=(Subquery(record.aggregate(Sum('qty'))) - Subquery(packed.aggregate(Sum('sale__qty')))) ).values('id', 'name', 'in_stock') -
Django admin fails with OperationalError at /admin/auth/group/add/ no such table: main.auth_permission__old
Using Django 2.1 with sqlite3 on MacOS after creating a super user and starting up the admin interface, all attempts to change/add any admin objects fails with "no such table". Using sqlite3 command line tools, no such tables are found. This problem occurs consistently with newly created Django projects. Other Django functionality seems fine, creating models, views, etc. -
Django Dynamic Form Creation Error Saving Data
I just want to create a dynamic form following this tutorial Here and got an error that ModelForm need a Model, but idk where to add the model, i've added the model with class Meta: and got new errors and errors. and then I followed This, it's worked! but it only save the one last data. like i added 5 forms,filling them up, but only the last form saved. Here is the thing i have a Text Model storing an Explanation Text, each Text Has it own Text Structure.Each Structure stored in TextStructure Model using One to Many realtion,cause each text must have more than one text structure. Here is my code using the last tutorial forms.py StructureFormset= modelformset_factory( TextStructure, fields=('structure',), extra=1, widgets = {'structure' : forms.TextInput(attrs={ 'class' : 'form-control', 'placeholder' : 'Kerangka Karangan' })}) views.py @login_required def structure_new(request): if request.method == 'GET': formset = StructureFormset(queryset=TextStructure.objects.none()) elif request.method == 'POST': formset = StructureFormset(request.POST) logging.warning(formset) if formset.is_valid(): for form in formset: structure = form.cleaned_data.get('structure') logging.debug(structure) if structure: TextStructure(text=Text.objects.get(pk=1), structure=structure).save() return redirect('index') return render(request, 'Eksplanasi/structure_add.html', {'formset':formset,}) templates {% block content %} <form method="POST" class="form" name="structure-add-form"> {{ formset.management_form }} {% for form in formset.forms %} {% csrf_token %} <div class='table'> <table class='no_error'> {{ … -
Django app not loading static files, certain configuration and paths are correct
I have an site, mysite, with an app frontpage. So my dir structure is: /mysite | ------\mysite | ------\frontpage | ------\frontpage\static I have made a few simple django sites by now and have set them up to load static files without issue, so not sure why this is failing. The lines from my settings.py: STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' I have 'django.contrib.staticfiles', added to INSTALLED_APPS At the top of my template I have: {% load static %} <IMG SRC="{% static '/static/images/1.jpg' %}"> An example is that within my static folder, I have an image, so the path is /static/images/1.jpg The actual path of the images is /mysite/frontpage/static/images/1.jpg Requesting this via a browser results in a 404 error, however the file is definitely there. What am I missing? -
Is there any way to get a model ID trough a form?
I'm trying that when you upload some image trough a django form, in the view you can get the object and redirect to the image's url. I have tried to include an id field into the ModelForm, but its not working. Here is the view that handles the POST. def model_form_upload(request): if request.method == 'POST': form = DocumentForm(request.POST, request.FILES) if form.is_valid(): form.save() return redirect('index') # here i want to redirect something like /media/image1.jgp else: form = DocumentForm() return render(request, 'src/model_form_upload.html', { 'form': form }) -
Django can't create super user
After spending hours finding the correct connectors to hook up MySQL with Django, I can't create a super user. error: django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.\r\n") I tried setting environment variables, settings.configure() which said the settings were already configured. db info is all correctly entered in settings.py. Pycharm is able to connect to the db though, this is inside my django project and the db title in pycharm says Django default. I don't know if this means my Django project is connected to it but I just can't create a super user or that the pycharm connection is not related. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'dbname', 'USER': 'root', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': 3306 } } When i try django-admin dbshell I get this error: django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. Both solutions provided in the error have had no positive result. -
Error with Feature-Policy header: Unrecognized feature/origin
It's really confused me. Why do in my production server with ssl-cert I get these error? How could I get rid of them? -
QuerySet object has no attribute 'objects'
i cant add object to manytomany field Customer PY Error Page SocialAccount PY User Model PY -
Adding a new ManyToMany relationship in a form?
Django newbie here. I keep encountering the exact same design paradigm, which seems like it should be common for everyone, yet can't find out how it's supposed to be resolved. Picture the following ManyToMany relationships: * An organization could have many members; each person could be a member of many organizations * An organization could manage many objects. An object could be in use by multiple organizations. The same applies to the relationship between people and objects. * An organization, person, or object could have multiple media elements (photos, videos, etc) of it, and a single media element could be tagged with numerous organizations, people, or objects Nothing unusual. But how does a site user add a new person, organization, or object? It seems that if someone is filling out an "add an organization" form, in addition to choosing from existing people, objects, media, etc there should be a button for "new member", "new object", "new photo", etc, and this should take you to the forms for creating new members, objects, media, etc. And when they're done, it should go back to the previous page - whose form filled-out form entries should persist, and the newly created entry should be … -
Django Rest Framework requieres as not null look up field
I have two models: class Album(models.Model): code = models.CharField(max_length=10, primary_key=True, default=_create_access_code, verbose_name=_("Id")) name = models.CharField(max_length=200, verbose_name=_("Name")) description = models.TextField(null=True, blank=True, verbose_name=_("Description")) company = models.ForeignKey(Company, on_delete=models.PROTECT, related_name='albums', verbose_name=_("Company")) access_code = models.CharField(max_length=10, default=_create_access_code, verbose_name=_("Internal Use")) class Meta: verbose_name = _("Album") verbose_name_plural = _("Albums") def __str__(self): return "[{}] {} ({})".format(self.pk, self.name, self.company.id) class Photo(models.Model): name = models.CharField(max_length=100, null=True, blank=True, verbose_name=_("Name")) album = models.ForeignKey(Album, on_delete=models.CASCADE, related_name='photos', verbose_name=_("Album")) photo = models.ImageField(verbose_name=_("Photo")) class Meta: verbose_name = _("Photo") verbose_name_plural =_("Photos") def __str__(self): return "[{}] {}".format(self.pk, self.name) I am trying to make a post to the ModelViewSet for model Albums, but I get an error indicating that field photos is required. Even the OPTIONS method indicates it es required. How can I instruct DRF for not considering look up fields as required? Is it some serializer setting? -
Bootstrap drop up menu has list items cutoff
I currently have a dropup menu that when expanded has the list items cutoff at the width of the button: Is there a simple way to resolve this issue? <div class="buttonsize"> <div class="dropup dropuppos"> <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">Add to Giftlist<span class="caret"></span></button> <ul class="dropdown-menu" class="buttonpos"> {% for EventGiftList in user_giftlists %} <li> <form method="post" action="{% url 'accountsapp:add_giftlist_item' %}"> {% csrf_token %} <input id="title" type="hidden" name="title" value="{{ ListedItem.item_title }}"> <input id="largeImage" type="hidden" name="largeImage" value="{{ ListedItem.item_image_URL }}"> <input id="salePrice" type="hidden" name="salePrice" value="{{ ListedItem.item_price }}"> <input id="giftlist_id" type="hidden" name="giftlist_id" value="{{ EventGiftList.id }}"> <input id="upc" type="hidden" name="upc" value="{{ ListedItem.item_UPC }}"> <input id="vendor" type="hidden" name="vendor" value="{{ ListedItem.item_Vendor }}"> <input type="submit" value="{{ EventGiftList.event_giftlist_title }}"> </form> </li> {% endfor %} </ul> </div> </div> -
How to separate input form for each entry in a single template
I have a list of entries which are displayed in a webpage. Each entry has the same input form. But my problem arises when data is put into the input form, it appears on every single one of them. How do I change this. Each input form is treated as a single cloned entity distributed over many entries. views.py def topic(request, topic_id, type): topic = Topic.objects.get(id = topic_id, type = 't_topic') entries = topic.entry_set.order_by('-date_added') images = Image.objects.filter(imgtopic__in = entries) if request.method == 'POST': form = CheckAnswer(request.POST) if form.is_valid(): return HttpResponseRedirect(reverse('learning_logs:index')) else: form = CheckAnswer() context = {'topic': topic, 'entries': entries, 'images': images, 'form': form} return render(request, 'learning_logs/topic.html', context) topic.html template {% for entry in entries %} <div class = 'secondary-container'> <li> <div class = 'date'> <p >{{ entry.date_added|date:'M d, Y H:i'}}</p> </div> {%include 'learning_logs/view_files.html'%} <div class = 'video-container'> {%include 'learning_logs/video.html' %} </div> <div class = 'entry-text'> <p>{{ entry.text|linebreaks }}</p> <p>$ {{entry.price_set.get.ptext}}</p> </div> </li> <li> <p> Enter Answer: </p> <form action = "{%url 'learning_logs:topic' topic.id topic.type%}" method = 'post'> {% csrf_token %} {{form.as_p}} <button name = "submit">Submit answer</button> </form> </li> </div> forms.py class CheckAnswer(forms.Form): your_answer = forms.CharField(label = "Enter Your Key", max_length = 100) def clean(self): cleaned_data=super(CheckAnswer, self).clean() your_answer = cleaned_data.get("your_answer") … -
Problem running migrations in Production (i.e. Heroku platform)
I made some changes to the db (i.e. added on column). I can make and run migrations just fine in my local env, the problem is in Production. I have made the migrations and pushed them to my remote repo, but when I run the migrations in production, nothing happens. I can makemigrations in production but when I run "heroku run python manage.py migrate", the system says, that are no migrations to implement. This is worth mentioning though, initially I ran "heroku run python manage.py migrate --fake" because I had a lot intermediary tables that threw the error "table xxxxxx already exist" everytime I tried to run a migrations, so that fixed that problem but I believe that the actual change that I wanted(i.e. adding a column to the db) to make, actually got migrated as fake migration. How can I fix this? -
.htaccess redirection to prerender on API
I'm developing a Single Page Application using AngularJS in parallel with a Django REST API. What do I want to do? I want that when the user shares some post on facebook all meta tags are read property by facebook crawlers (bots). The issue AngularJS dynamically generates its content through two-way data binding, and Facebook crawler couldn't read it properly. I've tried to use prerender.io, without any success. That's why I decided to create an django API endpoint that has the only goal of rendering a blank page only with the shareable metatags. If the user arrives there, he'll be redirected to the correct post. DJANGO CODE: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Prerender</title> <meta property="fb:app_id" content="MY_APP_ID_HERE"> <meta property="og:type" content="website"> <meta property="og:description" content="{{property.description}}"> <meta property="og:title" content="{{property.title}}"> <meta property="og:url" content="https://www.therentalmoose.com/property/{{property.id}}"> <meta property="og:image" content="https://www.therentalmoose.com:8000/static/images/properties/{{property.id}}/0.jpeg"> <meta property="og:image:height" content="488"> <meta property="og:image:width" content="931"> </head> <body> <script>window.location.replace('https://www.therentalmoose.com/property/{{property.id}}');</script> </body> </html> ** Solution that I'm trying (without success so far) ** I'm trying to configure my .htaccess file to redirect a facebook crawler bot when doing a request to https://www.therentalmoose.com/property/2 to https://www.therentalmoose.com:8000/prerender/property/2 That's where my metatag information is properly configured. Note that "2" is a dynamic variable … -
can't subtract offset-naive and offset-aware datetimes when I try to export to excel
Before marking as duplicated read the full question. This error showed up when I tried to export to excel file using Django using the library pip install xlwt Here is the view I used def export_warehouse_movement_report_csv(request): today_date = date.today() response = HttpResponse(content_type='application/ms-excel') response['Content-Disposition'] = 'attachment; filename="warehouse_movement_' + str(today_date) + '.xls"' wb = xlwt.Workbook(encoding='utf-8') ws = wb.add_sheet('BuyAndSells') # Sheet header, first row row_num = 0 font_style = xlwt.XFStyle() font_style.font.bold = True columns = ['المستخدم', 'الكمية', 'الكتاب', 'الصنف', 'الفئة', 'نوع الحركة', 'التاريخ'] for col_num in range(len(columns)): ws.write(row_num, col_num, columns[col_num], font_style) # Sheet body, remaining rows font_style = xlwt.XFStyle() rows = models.WarehouseMovement.objects.all().values_list('user', 'item_quantity', 'book_name', 'item_name', 'move_class', 'move_type', 'date') for row in rows: row_num += 1 for col_num in range(len(row)): ws.write(row_num, col_num, row[col_num], font_style) wb.save(response) return response the error disappears when I remove the date field from the file here is the modelthat is being added to the file: class WarehouseMovement(models.Model): move_in = 'دخول' move_out = 'خروج' move_type_choices = ( (move_in, 'دخول'), (move_out, 'خروج') ) move_class_buy = 'شراء' move_class_sell = 'مبيعات' move_class_print = 'طباعة' move_class_ordering = 'تسوية' move_class_choices = ( (move_class_buy, 'شراء'), (move_class_sell, 'مبيعات'), (move_class_print, 'طباعة'), (move_class_ordering, 'تسوية'), ) date = models.DateTimeField(auto_now=True) move_type = models.CharField(max_length=150, choices=move_type_choices) user = models.ForeignKey(User, on_delete=PROTECT) move_class = models.CharField(max_length=150, choices=move_class_choices) … -
Do I need to use celery.result.forget when using a database backend?
I've come across the following warning: Backends use resources to store and transmit results. To ensure that resources are released, you must eventually call get() or forget() on EVERY AsyncResult instance returned after calling a task. I am currently using the django-db backend and I am wondering about the consequences of not heeding this warning. What resources will not be "released" if I don't forget an AsyncResult? I'm not worried about cleaning up task results from my database. My primary concern is with the availability of workers being affected. -
How to set the apache2.conf file for a django project?
I am now deploying a django test project on aws-ec2 and the AMI is Ubuntu18.04 with Python 3.6, Django 2.1, Apache2. The project is under /var/www/Project and I am trying to add the setting to apache.conf. The project is simply generated by django-admin startproject Project and I want make sure that when hit the public IP provided by the instance, it should show up the django default page. WSGIDaemonProcess ubuntu processes=2 threads=12 python-path=/var/www/Project WSGIProcessGroup ubuntu WSGIRestrictEmbedded On WSGILazyInitialization On WSGIScriptAlias / /var/www/Project/Project/wsgi.py <Directory /var/www/Project/Project> Require all granted </Directory> Now i got the internal server error. The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. what's wrong with my conf file? -
django.db.utils.ProgrammingError: (1146, "Table 'med_portal.Custparent' doesn't exist")
I am using a ManyToMany Through model accross two databases. 'default': {}, 'portaldb': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'med_portal', 'OPTIONS': { 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" }, 'USER': '****', 'PASSWORD': '', 'HOST': '***.***.**.*', 'PORT': '****', }, 'smgpr': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'supplies', 'OPTIONS': { 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" }, 'USER': '****', 'PASSWORD': '', 'HOST': '***.***. **.*', 'PORT': '****', }, Router file1(LocalRouter.py): #LocalRouter.py class DBLocalRouter(object): def db_for_read(self, model, **hints): app_list = ('auth', 'admin', 'contenttypes', 'sessions', 'messages', 'staticfiles', 'Test', 'Admin', 'Charges', 'Products', 'Patients', 'Relationships', 'apis', 'corsheaders', 'djoser', 'django_filters', 'users', 'rest_framework', 'debug_toolbar') if model._meta.app_label in app_list: return 'smgpr' return None def db_for_write(self, model, **hints): app_list = ('auth', 'admin', 'contenttypes', 'sessions', 'messages', 'staticfiles', 'Test', 'Admin', 'Charges', 'Products', 'Patients', 'Relationships', 'apis', 'corsheaders', 'djoser', 'django_filters', 'users', 'rest_framework', 'debug_toolbar') if model._meta.app_label in app_list: return 'smgpr' return None def allow_relation(self, obj1, obj2, **hints): app_list = ('auth', 'admin', 'contenttypes', 'sessions', 'messages', 'staticfiles', 'Test', 'Admin', 'Charges', 'Products', 'Patients', 'Relationships', 'apis', 'corsheaders', 'djoser', 'django_filters', 'users', 'rest_framework', 'debug_toolbar') if obj1._meta.app_label in app_list and obj2._meta.app_label in app_list: return True return None def allow_migrate(self, db, app_label, model=None, **hints): app_list = ('auth', 'admin', 'contenttypes', 'sessions', 'messages', 'staticfiles', 'Test', 'Admin', 'Charges', 'Products', 'Patients', 'Relationships', 'apis', 'corsheaders', 'djoser', 'django_filters', 'users', 'rest_framework', 'debug_toolbar') if app_label in app_list: return db == 'smgpr' return … -
Django collectstatic when using ManifestFilesMixin always reprocesses css files
Every time I run collectstatic I find that it runs processing on the .css files even when the source file hasn't been modified at all. This wasn't a huge issue when I was collecting them locally, but now that I'm transitioning over to S3 and there are 234 css files that are being processed, collectstatic is taking 17 minutes to run even when there are no changes to be made. Is there any way to get collectstatic to skip processing css files that haven't changed at all? It seems like I can manually tell it to ignore certain files by using --ignore PATTERN, but I was hoping for something that didn't require manual intervention. -
Making my code more better in reading and in performance
i have a python django code and i want to make it better in reading and in performance because i want to add it to my side projects and i'am new to python and django so it will be good if someone helped me from django.views import View from django.http import HttpResponse from django.contrib.gis.geoip2 import GeoIP2 from .models import Victims, Url g = GeoIP2() def Get_Ip(request): x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[-1].strip() else: ip = request.META.get('REMOTE_ADDR') return ip def Get_Country(request): ip = Get_Ip(request) country = g.country('31.13.75.36') return country def Get_Browser(request): browser = request.META['HTTP_USER_AGENT'] return browser def save_vistor_data(request, slug): ip = Get_Ip(request) country = Get_Country(request) browser = Get_Browser(request) _url = Url() url = Url.objects.get(slug=slug) victim = Victims(_url=url, ip_address=ip, country=country, browser=browser) victim.save() return HttpResponse('Done') -
How to solve celerybeat is down: no pid file found?
I have followed instructions from https://pythad.github.io/articles/2016-12/how-to-run-celery-as-a-daemon-in-production It works pretty well for celeryd, however when starting celerybeat it says pid file not found. I've used this tutorial on my previous projects and it did fine for both celeryd and celerybeat. The difference of this project only is all project files including the django project are owned by root. I fail at finding more details about the issue. -
How to implement a DateField into a custom user model's registration form using UserCreationForm in Django?
I have a registration form set up which worked, then I tried adding a date of birth field to the user model and add that to the registration form. The DateField appears on the registration form however whenever I submit the data to register a new user, I get the error message "Enter a valid date" (see here). Here is what I have in my forms.py: BIRTH_YEAR_CHOICES = (2000, 1999, 1998, 1997, 1996, 1995, 1994, 1993, 1992, 1991, 1990, 1989, 1988, 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980, 1979, 1978, 1977, 1976, 1975, 1974, 1973, 1972, 1971, 1970, 1969, 1968, 1967, 1966, 1965, 1964, 1963, 1962, 1961, 1960, 1959, 1958, 1957, 1956, 1955, 1954, 1953, 1952, 1951, 1950, 1949, 1948, 1947, 1946, 1945, 1944, 1943, 1942, 1941, 1940, 1939, 1938, 1937, 1936, 1935, 1934, 1933, 1932, 1931, 1930, 1929, 1928, 1927, 1926, 1925, 1924, 1923, 1922, 1921, 1920, 1919, 1918, 1917, 1916, 1915, 1914, 1913, 1912, 1911, 1910, 1909, 1908, 1907, 1906, 1905, 1904, 1903, 1902, 1901, 1900) class DateInput(forms.DateField): input_type = settings.DATE_INPUT_FORMATS #This is ['%d %B %Y'] #Create a class which inherits from Django's UserCreationForm class and add fields necessary for my users class UserRegisterForm(UserCreationForm): email = forms.EmailField(required=True) … -
Django datetime format different from DRF serializer datetime format
I am trying to understand why this is happening. I have a Django DateTime field and Django Rest Framework serializer that uses the field. I am trying to compare the dates for both of them and get the following results from JSON endpoint and model result: DRF: 2018-12-21T19:17:59.353368Z Model field: 2018-12-21T19:17:59.353368+00:00 Is there a way to make them similar? So, either to make both of them be "Z" or "+00:00."