Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Problem with progress upload bar using XMLHttpRequest in Django
I have an issue with a progress upload bar in Django when the site is deployed to Heroku, when I click on the upload button the progress bar shows up at 10% then doesn't change or count up to 100%, when the upload is finished, it redirects as instructed in my views.py , the function runs fine locally, but after deploying to heroku it doesn't work. I think it may be something to do with the deployed url using 'https', but not sure and how to fix it? appreciate any help. custom.js function progressBar() { progressBox.classList.remove('not-visible') cancelBox.classList.remove('not-visible') const upload_data = input.files[0] const url = URL.createObjectURL(upload_data) // console.log(upload_data); const fd = new FormData() fd.append('csrfmiddlewaretoken', csrf[0].value) fd.append('track', upload_data) $.ajax({ type: 'POST', enctype: 'multipart/form-data', data: fd, beforeSend: function(){ }, xhr: function(){ const xhr = new XMLHttpRequest(); xhr.upload.addEventListener('progress', e=>{ // console.log(e); if (e.lengthComputable) { const percent = (e.loaded / e.total) * 100; // console.log(percent); progressBox.innerHTML = `<h5 style="text-align:center;">${percent.toFixed(1)}%</h5> <div class="progress" style="height: 30px;"> <div class="progress-bar bg-success" role="progressbar" style="width: ${percent}%" aria-valuenow="${percent}" aria-valuemin="0" aria-valuemax="100"></div> </div>` } }) cancelBtn.addEventListener('click', ()=>{ xhr.abort() progressBox.innerHTML="" cancelBox.classList.add('not-visible') window.location.reload(); }) return xhr; }, success: function(response){ // console.log(response); uploadForm.reset() cancelBox.classList.add('not-visible') }, error: function(error){ console.log(error); }, cache: false, contentType: false, processData: false, }) } -
How to set the default user as the current user object in django?
I have created a mini project called ToDoList App. I have used class based views for create, update and delete functions. There is MyTasks icon on navbar. What do I want? I want to set the default user as the current logged in user. Tasks of one person should not be seen by any another person. I have tried all the solutions but nothing seems to work. Here is my code in models.py file: class MyTasks(models.Model): user = models.ForeignKey(User, on_delete=CASCADE, related_name="mytasks") task_id = models.AutoField(primary_key=True, verbose_name="ID") task_title = models.CharField(max_length=100, default="", help_text="The title of the task", verbose_name="Task Title", blank=False) task_desc = models.TextField(default="", help_text="The description of task", verbose_name="Task Description", blank=False) task_time = models.DateTimeField(default=timezone.now(), verbose_name="Task Date & Time") task_completed = models.BooleanField(default=False, verbose_name="Task Completed") def save(self, *args, **kwargs): self.user = User super(MyTasks, self).save(*args, **kwargs) def __str__(self): return self.task_title When I used the save method to achieve the task, it is showing this error: ValueError: Cannot assign "<class 'django.contrib.auth.models.User'>" Please help me to achieve this task. Any help is much appreciated. -
New records not coming in the list call of Django DRF API using Redis cache
I have a Django REST API, and I am using Redis as the caching backend. Code @method_decorator(cache_page(60*60)) def dispatch(self, *args, **kwargs): return super().dispatch(*args, **kwargs) It caches the data on a get call, but when I insert a new record, that new record is not showing up in the list (Which is coming from cache). Any help? -
Granting access to other class views upon successful authentication Django REST
Here is my API in Django REST. Here is my code: from rest_framework.permissions import IsAuthenticated, AllowAny class CreateItems(generics.CreateAPIView): permission_classes = [IsAuthenticated] queryset = SomeModel.objects.all() serializer_class = SomeSerializer class AuthStatus(APIView): permission_classes = [AllowAny] def post(self, request, *args, **kwargs): token = self.request.data['itemsReturnedAuthAPI']['accessToken'] if(token): return Response({"Token":token}) else: return Response({"message":"No Token Found!"}) I have an authentication microservice that I get the JWT Token from for the user in order to have access to the views. In the AuthStatus class I am checking the token. My Question: I want to grant the user access to the CreateItems class, after the token is provided -
Django Rest Framework request unauthorized on all but one address
I'm trying to access django hosted at 192.168.x.x:8000 on a React frontend server on port 5002, when attempting to access the frontend with localhost, 127.0.0.1 or ip's outside of the home network, it gives following result in console: Unauthorized: /api/any_endpoint HTTP POST /api/any_endpoint 401 [0.03, 127.0.0.1:12345] However when accessing trough 192.168.x.x:5002, it just works. the /admin/ endpoint seems to work no matter the ip address (ip_address:8000), so it's either django-rest-framework or React that is causing this issue. I have no idea where to start debugging this, so any comment on what I should check would be appreciated -
Django (1045, "Access denied for user 'root'@'localhost' (using password: NO)")
I have come accross a strange issue, I have deployed a django site to an Ubuntu 20.04 LTS server. The problem is my django app can not connect to the database because It is doesn't using the db connection credentials that have identified in app settings.py. It is using root with no password. But when I can run manage.py db operations without any problem. This is my settings.py 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'pplus_db', 'USER': 'pplus_user', 'PASSWORD': 'dfa@4GL-5qQU', 'HOST': 'localhost', 'PORT':'3306', } } This is the screenshot of the error, I'm getting when I'm trying to login -
django.contrib.auth.urls change redirect path
I am coding a basic login and register page app in Django/Python Currently, after someone logs in, it redirects them back to the register page. I am trying to change the redirect path to "home/" Please see the following code: URLS.PY: from django.contrib import admin from django.urls import path , include from accounts import views as v from main import views as views urlpatterns = [ path('admin/', admin.site.urls), path('home/' , views.home , name = 'home'), path('', v.register , name='register'), path('' , include('django.contrib.auth.urls') , name = 'login'), ] Views.py: from django.shortcuts import render , redirect from .forms import RegisterForm # Create your views here. def register(response): if response.method == "POST": form = UserCreationForm(response.POST) if form.is_valid(): form.save() return redirect("/home") else: form = RegisterForm() return render(response, "registration/register.html", {"form":form}) Login.html {% extends "main/base.html"%} {% block title %} Login here {% endblock %} {% load crispy_forms_tags %} {% block content %} <form class="form-group" method="post"> {% csrf_token %} {{ form|crispy }} <p>Don't have an account ? Create one <a href="/register"></a></p> <button type="submit" class="btn btn-success">Login</button> </form> {% endblock %} Register.html {% extends "main/base.html"%} {% block title %}Create an Account{% endblock %} {% load crispy_forms_tags %} {% block content %} <form method="POST" class="form-group"> {% csrf_token %} {{ form|crispy … -
Is it possible to reorder the content_panels in Wagtail admin?
I am creating a Wagtail application where some models inherit fields from a base model. Unfortunately, these base fields are always displayed first in the form generated by Wagtail. For example: class BaseModel(models.Model): some_attribute = models.TextField() class Meta: abstract = True content_panels = [ FieldPanel('some_attribute'), ] @register_snippet class ChildModel(BaseModel): title = models.TextField() content_panels = Page.content_panels + [ FieldPanel('title'), ] In Wagtail admin in the ChildModel editor, some_attribute would be displayed above title now, which is not very intuitive to users. Is there a way to change this behaviour? -
How to generate the staff users activity report in django?
I am building the system in Django rest framework, in which the admin level user will govern the staff users , I need to keep track of staff levels users activity, example: staff user activity such as adding some post or deleting and so on other lots of activities. Is there any package or any good implementation on how it can be achieved ? -
Dynamically filtering fields in formset
I have a view: class SummaryListView(ListView): model = MyModel MyModelFormSet = modelformset_factory( MyModel, fields=('field1', ), formset=BaseMyModelFormSet, ) def get_context_data(self, *args, **kwargs): context = super().get_context_data(*args, **kwargs) fields = get_fields(self) formset = self.MyModelFormSet(request=self.request) context['formset '] = formset return context def post(self, request, *args, **kwargs): formset = self.MyModelFormSet(request.POST, request=request) if formset.is_valid(): formset.save() return redirect('') I want to pass MyModelFormSet a list of fields to render which I generate with a function get_fields() which takes self as an argument. Now, I can place MyModelFormSet inside get_context_data, but then how do I access it from post? Or can I pass MyModelFormSet a variable from inside the get_context_data? -
Django: Add objects.all.count() to aggregate?
I've been searching how to add X.objects.all().count() result to an existing aggregate logic. I seen that Count() will only work with a foreign key relationship, so how can I add an 'additional field' with the .count() results to the aggregate with only writing it in one block. This is my custom action (Does not work): from django.db.models.functions import Coalesce from django.db.models import Min, Avg, Max, Value as Val, IntegerField @action(detail=False, methods=['get']) def get_stats(self, request, pk=None): total_ads = Ad.objects.all().count() stats = Ad.objects.aggregate( price_min = Coalesce(Min('price'), Val(0)), price_avg = Coalesce(Avg('price'), Val(0.0)), price_max = Coalesce(Max('price'), Val(0)), ads_total = Val(total_ads, output_field=IntegerField()), ) return Response(stats) Error: TypeError: ads_total is not an aggregate expression -
Refer to child class foreign key in base abstract model
I am trying to access the child model foreign key in base abstract model so I don't have to repeat the foreign key in each of the child model. Here is my code: class BaseModel(models.Model): child_field = models.ForeignKey(to='child_class_either_ModelA_OR_ModelB') class Meta: abstract = True class ModelA(BaseModel): .... class ModelB(BaseModel): .... I want to refer the child model in base abstract model. Is there a way to use an child model in base model? -
Django static images receive 404 error in windows production
I am trying to deploy a Django app on a Windows server. I am able to make the pages load and am using wgsi. I am also able to load pages with images when using runserver, just not when accessing via the webserver. I have DEBUG = False. My settings.py looks like this: STATIC_URL = '/static/' STATICFILES_DIRS = [ BASE_DIR / "static", ] STATIC_ROOT = "/assets/" When I do collectstatic, my files are copied into the assets folder. But, when served, I receive: GET http://localhost:8000/static/js/main.js net::ERR_ABORTED 404 (Not Found) -
Django Link a submodel to the main model and display the sub-model widgets on my view with ModelForm
I need to link a "sub-model" with a "main model" to then display a form on my view For the moment I manage to display the form but not the fields of the form of the "sub-model" Here is what I have on my web page: You can see that the info field does not offer me to enter information but only selected among the one that exists outside I would like it to be like the others, that the user is free to indicate what he wants Here is the "main model" class Dispositif(models.Model): info = models.ForeignKey(Infos, on_delete=models.CASCADE) name = models.CharField(max_length=32, default="Nom du dispositif") place = models.CharField(max_length=128, default="Adresse du dispositif") Here is the "sub-model" class Infos(models.Model): comment = models.CharField(max_length=128) chef = models.CharField(max_length=32) and here the ModelForm: class DispositifForm(ModelForm): class Meta: model = Dispositif fields = ['name', 'place', 'info'] widgets = { 'info.comment': django.forms.TextInput(attrs={'placeholder': 'Comment'}), 'name': django.forms.TextInput(attrs={'placeholder': 'Nom du dispositif'}), 'place': django.forms.TextInput(attrs={'placeholder': 'Adresse du dispositif'}) } I tried to create a widget like this but it shouldn't be this way: 'info.comment': django.forms.TextInput(attrs={'placeholder': 'Comment'}), I could very well group everything in the same model but then I will add fields and I prefer to leave with a good organization from the … -
Strange ViewSet Behavior - Django Rest Framework
I set up a ModelViewSet and ModelSerializer for my model Dataset but noticed some strange behavior. When I create new dataset instances the rest-endpoint does not reflect the new additions. However, if I print out the count of dataset instances I can clearly see the new datasets reflected. Has anyone seen something like this before? class DatasetViewSet(viewsets.ModelViewSet): queryset = Dataset.objects.all().order_by('-created_at') serializer_class = DatasetSerializer def get_queryset(self): # correctly prints the number of instances print('new call: ', Dataset.objects.count()) # only prints the correct number when *one* new instance is added, # afterwards new instances are not recognized print('queryset: ', self.queryset.count()) return self.queryset The first print statement in the get_queryset method above will print out the correct number of instances (i.e. 5, 6, 7, 8, ... as I keep adding more instances). The second print statement only captures the first new instance and then remains constant (i.e. 5, 6, 6, 6, ... even as I keep adding more instances). Furthermore, in the example above, a GET request will only yield 6 instances even as I keep adding more. What is going on here and how I can begin to debug this situation? -
Unique Class or extend Class in Python Django
In the following situation, I have a feeling I need to ?extend? the Migration class instead of re-stating it in the second module. migrations/0001_initial.py: class Migration(migrations.Migration): initial = True dependencies = [('auth', '0012_alter_user_first_name_max_length'),] operations = [ migrations.CreateModel( name='User', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, ...)), ('password', models.CharField(max_length=128, ...)), ... migrations/0002_venue.py: class Migration(migrations.Migration): dependencies = [('app', '0001_initial'),] operations = [ migrations.CreateModel( name='Venue', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True,...)), ('name', models.CharField(blank=True, max_length=150, ...)), ('address', models.CharField(blank=True, null=True, ...)), ... Help? -
Can't get form to work for comment replies
I can't seem to get the post form to work for post replies (comments for a post). It works via the Django admin but I can't seem to display the form on the template which I think is due to my noobish backend. Layout of the "site": Front: Frontpage contains all posts which shows 3 latest comments for said posts (this part works). Posts: When you want to read a post it redirects you to another page which shows selected post (as normal) and here you can see all comments for the post (currently added directly via Django Admin). Here I want a form so the visitor can reply to the post. (This part does not work). Forms: from django import forms from django.forms import widgets, TextInput, ModelForm from .models import Comments, Post class PostForm(ModelForm): class Meta: model = Post fields = ['entry', 'post_image'] labels = { 'entry': "Post something spoopy:", } widgets = { 'entry': widgets.Textarea(attrs={'rows':10, 'cols':5}) } def __init__(self, *args, **kwargs): super(PostForm, self). __init__(*args, **kwargs) for name, field in self.fields.items(): field.widget.attrs.update({'class': 'input'}) class CommentForm(ModelForm): class Meta: model = Comments fields = ['comment_entry', 'comment_image'] labels = { 'comment_entry': "Answer!", } def __init__(self, *args, **kwargs): super(CommentForm, self).__init__(*args, **kwargs) for name, … -
Pythonanywhere - something went wrong - error running wsgi - modulenotfound error
I am new to django and I am doing a coursera course with little applications deployed on pythonanywhere, which has worked well so far. No I am stuck, because does not load at all. Pythonanywhere says that Something went wrong. This is the error log from pythonanywhere. Error running WSGI application ModuleNotFoundError: No module named 'django_extensions' This is my WSGI file """ WSGI config for mysite project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') application = get_wsgi_application() This is my settings.py file, not the entire one but the installed apps: DEBUG = True ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'ads.apps.AdsConfig', # Extensions - installed with pip3 / requirements.txt 'django_extensions', 'crispy_forms', 'rest_framework', 'social_django', 'taggit', 'home.apps.HomeConfig', ] This is my urls.py, not the entire one, but the crucial part. import os from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls import url from django.contrib.auth import views as auth_views from django.views.static import serve urlpatterns = [ path('', include('home.urls')), # Change to ads.urls path('ads/', include('ads.urls')), path('admin/', admin.site.urls), … -
How to connect locally hosted Django app to Dockerized Postgres database
I'm learning Docker and after few time, I'm able to run a postgres database and a django app in two different container. The problem is that with docker, I can't use Pycharm's debugging tools. So I would like to run my code without docker but keep the database in its container. But I can't connect Dockerized postgres dabatase and locally hosted Django App. I always have this error : psycopg2.OperationalError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\threading.py", line 926, in _bootstrap_inner self.run() File "C:\Program Files (x86)\Python37-32\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run self.check_migrations() File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\core\management\base.py", line 486, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\db\migrations\loader.py", line 53, in __init__ self.build_graph() File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\db\migrations\loader.py", line 220, in build_graph self.applied_migrations = recorder.applied_migrations() File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\db\migrations\recorder.py", line 77, in applied_migrations if self.has_table(): File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\db\migrations\recorder.py", line 55, in has_table with self.connection.cursor() as cursor: File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "C:\Users\Nicolas Borowicz\Desktop\ProjetSolSol\PlateformeClient\env\lib\site-packages\django\db\backends\base\base.py", line 259, in cursor return self._cursor() File … -
run two list same time on django template
how to run two list same time on Django-templates without using zip function. views.py l1=[1,2,3] l2=[4,5,6] return render(request,'home.html',{'l1':l1,'l2':l2}) I am passing list this type on my template page now need to run both list same time on template. how can I do this. Note---only I want do this on my template page -
How to add extra data to TextChoices?
How Can I add extra data to django.db.models.TextChoices? class Fruit(models.TextChoices): APPLE = ('myvalue', True, 'mylabel') such that: >>> Fruit.APPLE.is_tasty True >>> # And it still works otherwise >>> Fruit.APPLE.value 'myvalue' >>> Fruit.APPLE.label 'mylabel' -
Migrations in DJango
I am having DJango migrations problem while making migration following error is coming. enter image description here enter image description here enter image description here When I run my applications using python manage.py runserver it shows this :- enter image description here However running python manage.py makemigrations shows no changes detected And Above three images are result after running python manage.py migrate. what is the problem with this ? -
Nginx 502 bad gateway error when deploying django
I'm trying to set up a VPS Django server with nginx, however, I'm running into a 502 Bad Gateway error when I reload the nginx server with the following settings: sudo nano /etc/nginx/sites-available/project server { listen 80; server_name domainname.com; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/ubuntu/Slide-Hackers-Web/src/static; } location /media/ { root /home/ubuntu/Slide-Hackers-Web/src/static; } location / { include proxy_params; proxy_pass https://unix:/home/ubuntu/Slide-Hackers-Web/src/project.sock; } } I execute the commands in this order sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful sudo ln -sf /etc/nginx/sites-available/project /etc/nginx/sites-enabled sudo systemctl restart nginx sudo ufw allow 'Nginx Full' If I exclude domainname.com from the server_name, then it responds with the classic "Welcome to nginx!" page, however, if I leave it, it responds with "502 Bad Gateway nginx/1.18.0 (Ubuntu)". I'm clueless as to what I'm supposed to do, any help? P.s, gunicorn runs in the background and is active: ● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-08-17 10:38:05 UTC; 1h 58min ago Main PID: 31290 (gunicorn) Tasks: 4 (limit: 2272) Memory: 90.0M CGroup: /system.slice/gunicorn.service ├─31290 /home/ubuntu/Slide-Hackers-Web/env/bin/python /home/ubuntu/Slide-Hackers-Web/env/bin/gunicorn --access-logfile - --workers 3 … -
How do Django authorization decorators (such as: login required) work?
I am trying to better understand "behind the scenes" of the Django authorization decorators. Although I think I understand decorators in general, I find it difficult to understand the authorization decorators code. Is there any "line by line" explanation of the code (https://docs.djangoproject.com/en/2.2/_modules/django/contrib/auth/decorators/)? -
How to group results into array based on multiple similar values, Django Model
I have array as follows [ { "WarehouseId": 1, "ShippingCarrierId": 1, "PostalCodeType": "ShipToCustomer", "TimeStart": "1970-01-01T06:00:00.000Z", "TimeEnd": "1970-01-01T15:59:00.000Z", "PickupTimeSlot": "PM", "DaysToAdd": 0, "PickupTime": "1970-01-01T17:00:00.000Z" }, { "WarehouseId": 1, "ShippingCarrierId": 1, "PostalCodeType": "ShipToCustomer", "TimeStart": "1970-01-01T16:00:00.000Z", "TimeEnd": "1970-01-01T23:59:00.000Z", "PickupTimeSlot": "AM", "DaysToAdd": 1, "PickupTime": "1970-01-01T11:00:00.000Z" }, { "WarehouseId": 1, "ShippingCarrierId": 1, "PostalCodeType": "ShipToCustomer", "TimeStart": "1970-01-01T00:00:00.000Z", "TimeEnd": "1970-01-01T05:59:00.000Z", "PickupTimeSlot": "AM", "DaysToAdd": 0, "PickupTime": "1970-01-01T11:00:00.000Z" }, { "WarehouseId": 2, "ShippingCarrierId": 2, "PostalCodeType": "ShipToCustomer", "TimeStart": "1970-01-01T00:00:00.000Z", "TimeEnd": "1970-01-01T15:59:00.000Z", "PickupTimeSlot": "PM", "DaysToAdd": 0, "PickupTime": "1970-01-01T17:00:00.000Z" }, { "WarehouseId": 2, "ShippingCarrierId": 2, "PostalCodeType": "ShipToCustomer", "TimeStart": "1970-01-01T16:00:00.000Z", "TimeEnd": "1970-01-01T23:59:00.000Z", "PickupTimeSlot": "AM", "DaysToAdd": 1, "PickupTime": "1970-01-01T11:00:00.000Z" }, { "WarehouseId": 1, "ShippingCarrierId": 3, "PostalCodeType": "ShipToDS", "TimeStart": "1970-01-01T00:00:00.000Z", "TimeEnd": "1970-01-01T15:59:00.000Z", "PickupTimeSlot": "PM", "DaysToAdd": 0, "PickupTime": "1970-01-01T17:00:00.000Z" }, { "WarehouseId": 1, "ShippingCarrierId": 3, "PostalCodeType": "ShipToDS", "TimeStart": "1970-01-01T16:00:00.000Z", "TimeEnd": "1970-01-01T23:59:00.000Z", "PickupTimeSlot": "AM", "DaysToAdd": 1, "PickupTime": "1970-01-01T11:00:00.000Z" }, { "WarehouseId": 2, "ShippingCarrierId": 4, "PostalCodeType": "ShipToDS", "TimeStart": "1970-01-01T00:00:00.000Z", "TimeEnd": "1970-01-01T15:59:00.000Z", "PickupTimeSlot": "PM", "DaysToAdd": 0, "PickupTime": "1970-01-01T17:00:00.000Z" }, { "WarehouseId": 2, "ShippingCarrierId": 4, "PostalCodeType": "ShipToDS", "TimeStart": "1970-01-01T16:00:00.000Z", "TimeEnd": "1970-01-01T23:59:00.000Z", "PickupTimeSlot": "AM", "DaysToAdd": 1, "PickupTime": "1970-01-01T11:00:00.000Z" }, { "WarehouseId": 1, "ShippingCarrierId": 5, "PostalCodeType": "ShipToDS", "TimeStart": "1970-01-01T00:00:00.000Z", "TimeEnd": "1970-01-01T16:22:00.000Z", "PickupTimeSlot": "PM", "DaysToAdd": 0, "PickupTime": "1970-01-01T17:00:00.000Z" }, { "WarehouseId": 1, "ShippingCarrierId": 5, "PostalCodeType": "ShipToDS", "TimeStart": "1970-01-01T16:23:00.000Z", "TimeEnd": "1970-01-01T23:59:00.000Z", "PickupTimeSlot": "AM", "DaysToAdd": …