Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to get a list of Items that have ManyToMany relationship to an object and Include some fields of the same object in the query set result
I would like to implement an efficient queryset from the model classes below. How to get a list of Items that have ManyToMany relationship to an object and include some fields of the same object in the query set result in each item? Model Classes class Property(models.Model): lr_no = models.CharField(max_length=30) class PropertyObjection(models.Model): objection_no = models.CharField(max_length=20) properties = models.ManyManyField(Property) A single objection has multiple properties as shown from the example below: objection = PropertyObjection.get(id=1) objection.properties.all() # Multiple properties My scenario is I want to use PropertyObjection model class to get all properties and include the `objection_no. (or is there any other effective way to do it) That is the result should be something like this: [ { "objection_no": "KF00988", "id": 1, "lr_no": "345/j" }, { "objection_no": "KN00988", "id": 2, "lr_no": "345/jK" } ] -
Python chashing sys for save statics files
I wanna use file cashing to save my statics file in the client device to speed up my site loading if anyone knows about it please help me to do this thanks -
Django Celery, not executing scheduled tasks
I'm developing a Django application to track crypto assets, what Im looking to do is, to take a snapshot of the user total value every 5 Days (X time). What i did for now: core/celery.py from __future__ import absolute_import, unicode_literals import os from celery import Celery from celery.schedules import crontab # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') app = Celery('core') # Using a string here means the worker doesn't have to serialize # the configuration object to child processes. # - namespace='CELERY' means all celery-related configuration keys # should have a `CELERY_` prefix. app.config_from_object('django.conf:settings', namespace='CELERY') app.conf.beat_schedule = { 'print': { 'task': 'app.tasks.test', 'schedule': 15 }, } app.conf.timezone = 'UTC' # Load task modules from all registered Django app configs. app.autodiscover_tasks() @app.task(bind=True) def debug_task(self): print('Request: {0!r}'.format(self.request)) core/settings.py: # -*- encoding: utf-8 -*- """ Copyright (c) 2019 - present AppSeed.us """ import os from decouple import config from unipath import Path import dj_database_url import django # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = Path(__file__).parent CORE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_1122') # SECURITY WARNING: don't run with debug turned on in … -
Font Face is not working except on Chrome
I use Lufga font for my web app but the font isn't working on Safari or Firefox. I've tried to use @font-face but it doesn’t seem to work, the text is still rendering in a default font. for context, I use Django on VS Code if it's relevant. this project is in development, not production. Here's my styles.css (P.S. when I cmd+click on the URL link I do end up in the right file, so I guess the location is good) @font-face{ font-family: 'Lufga'; src: url("../styles/Lufga-Regular.otf") format("Regular"); font-style: normal; font-weight: normal; } .Logo { position: absolute; width: 519.61px; height: 135px; left: calc(50% - 519.61px/2 + 0.3px); top: calc(50% - 135px/2 - 60px); } .ComingSoon { position: absolute; left: 38.59%; right: 38.59%; top: 51.88%; bottom: 44.78%; font-family: 'Lufga'; font-style: normal; font-weight: normal; font-size: 24px; line-height: 28px; /* or 117% */ text-align: center; color: #FFFFFF; } .Inquiries { position: absolute; width: 487px; height: 36px; left: calc(50% - 487px/2 + 0.5px); top: calc(50% - 36px/2 + 320px); font-family: 'Lufga'; font-style: normal; font-weight: normal; font-size: 18px; line-height: 28px; /* or 156% */ text-align: center; color: #FFFFFF; } .EmailLink { font-family: 'Lufga'; font-style: normal; font-weight: normal; font-size: 18px; line-height: 28px; color: #FFFFFF; } and here's … -
User self-hosted Database in Django
I have a Django project where the users can connect their own database as well as static file storage for security purposes. For example: when a user will signup into our system, they will ask for a database and a file storage address and credentials. After that, all the data for this user will store in his self-hosted Database as well as files also. I already checked the multi-database feature in Django but I guess it's not helpful for me -
Delete ManyToManyField if "items" was empty
I have Order Section and my models are like this : class OrderItem(models.Model): product = models.ForeignKey(Stock, on_delete=models.SET_NULL, null=True) is_ordered = models.BooleanField(default=False) date_added = jmodels.jDateField(auto_now=True) date_ordered = jmodels.jDateField(null=True) quantity = models.IntegerField(default=0, verbose_name='quantity') class Order(models.Model): ref_code = models.CharField(max_length=15) owner = models.ForeignKey(Profile, on_delete=models.SET_NULL, null=True) is_ordered = models.BooleanField(default=False) items = models.ManyToManyField(OrderItem, related_name='item') date_ordered = jmodels.jDateField(auto_now=True,null=True) created_on_time = models.TimeField(auto_now_add=True,null=True) def get_cart_items(self): return self.items.all() def get_cart_total(self): return sum([item.quantity*item.product.price for item in self.items.all()]) My problem is that when in cart I delete all Items, and Items become empty, but still Order exist in my database. I want the whole of order would delete if Items was empty. -
django-export data foreign_id instead the real value
class Students(models.Model): MY_CHOICES = ( ('m', 'male'), ('f', 'female'), ) first_name = models.CharField(max_length=50,unique=False) last_name = models.CharField(max_length=50,unique=False) date_of_birth = models.DateField(null=True,blank=True,) gender = models.CharField(max_length=10,choices=MY_CHOICES) school= models.ForeignKey(school, on_delete=models.CASCADE) date_added = models.DateTimeField(auto_now_add=True,null=True,blank=True,) def __str__(self): return self.first_name + ' ' + self.last_name class Meta: verbose_name = 'Student' class StudentsResource(resources.ModelResource): class Meta: model = Students school= fields.Field(id='school', attribute='school', widget=widgets.ForeignKeyWidget(School, 'school')) Thank you for your help -
Django display dynamically HTML option depending on whether a checkbox is checked or not
As I said, I want to display dynamically HTML option depending on whether a checkbox is checked or not I tried this portion of code : <select id = "productPickerID" name = "product" multiple="multiple" required> {% for p in Products%} {% if "checked" in mycheckbox.checked %} <option value = {{c.productid}}>{{c.productname}}</option> {% endif %} {% endfor %} </select> <input type = "checkbox" id = "mycheckbox" checked="checked"> This code is working well without the if statement so I wonder how I could do that... Maybe use some javascript? or it's possible to do it directly with the templates... Thanks for answers -
Django field.choices + HTML. How do I get the word display, not id?
I have a this list in .models SIDES = ( [1, 'Attack'], [2, 'Defense'], ) side = models.PositiveSmallIntegerField( ("side"), choices=SIDES) and here i trying display on page 'Attack' or 'Defense', but he display only '1' or '2' {% for el in operators %} <div> <h3>{{ el.side }}</h3> </div> {% endfor %} How do I get the word display, not id? -
No information in a variable is being displayed on Django Website
I am a beginner in python and I am learning python. I am creating a Website using Django and faced a problem once trying to add information into the django website using for loops in Django HTML. The information from the below bolded code is not being displayed, can someone please help me out! <table class="table"> <thead> <tr> <th>Name</th> <th>Language</th> <th>Price</th> <th>Year Published</th> </tr> </thead> <tbody> {% for course in courses %} <tr> <td>{{course.name}}</td> <td>{{course.language}}</td> <td>{{course.cost_in_rupees}}</td> <td>{{course.year_published}}</td> </tr> {% endfor %} </tbody> -
Retrieve file name based on extension from path
I need to make a dynamic path for a file that I want to open. I need to retrieve the .tif file from within a path. this path is formed by a combination of a "STATICFILES_DIRS" from my settings.py and a field ccalled docId from my models.py that get filled from the views.py now, I'm very new to django so I really don't understand what I dont know (if this makes sense) my views.py has the following: from django.shortcuts import render import pyodbc # Create your views here. def home(request): conn=pyodbc.connect('Driver={sql server};' 'Server=server.domain.com;' 'Database=database;' 'Trusted_Connection=yes;') cursor = conn.cursor() cursor.execute("select top 100 docId, supplierName, invoiceNumber, reference from table") result = cursor.fetchall() return render(request, 'azolve/home.html', {'Azolve': result}) and my models.py has this: from django.db import models import os import fnmatch class Azolve(models.Model): docId = models.IntegerField supplierName = models.CharField(max_length=100) invoiceNumber = models.IntegerField reference = models.CharField(max_length=100) # for file_name in os.listdir(str(filePath)): # if fnmatch.fnmatch(file_name, '*.tif'): # docIdFileName = file_name and in my settings.py I have this part: STATIC_URL = '/static/' STATICFILES_DIRS = [ "//server1/Shared1/folder/ Migration Images/", ] so, to give an idea, each docId that gets retrieved is the name of a folder contained in the path "STATICFILES_DIRS " what I was trying to … -
How to organize test files on django 3.x and run single file tests?
I've been learning about django testing and would like to have several tests files that I would like to rename and place then in to a folder. How is the proper way to do it? In a single file test.py I used to call my test with the "python.manage.py tests appname" command. I tried to organize my tests files this way. app/tests/__init__py app/tests/test_something.py app/tests/test_something_else.py The problem is that when I organize them in several files I can't run a single test file. At this point all I can do is run then all with the command "python manage.py tests app test_something_else.py" but this it will also run test_something.py. I've already try the django documentation, but it hasn't help much because I think this example is for a single test.py file. (for an example app named animals) Run just one test case $ ./manage.py test animals.tests.AnimalTestCase Run just one test method $ ./manage.py test animals.tests.AnimalTestCase.test_animals_can_speak What am I doing wrong? -
How to fix psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block error
I have django app and separate script folder. Script folder has file that execute select * from table from DB which is connected to Django app. This scripts working in While=True I am using docker and scripts folder , django , postgresql are separate docker containers. I am restoring data to Postgresql container then making migrate. However, I am getting psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block this error from script container, ERROR: current transaction is aborted, commands ignored until end of transaction block this error from Postgresql container. How can I fix it? I have spent whole day could not find anything useful. Thanks in advance. -
I have a troubles whilefiltering by year and month in Django
I'm trying to filter queryset by month and date Here is a code: class FinalListView(generics.ListAPIView): serializer_class = FinalSerializer filter_backends = [django_filters.rest_framework.DjangoFilterBackend] def get_queryset(self): condition = Q() queryset = Final.objects.all() month = self.request.query_params.getlist('month') year = self.request.query_params.getlist('year') if month: if month != 'all': for a in month: condition |= Q(created_at__month=a) queryset = queryset.filter(condition) print (queryset) if year: if year != 'all': for a in year: condition |= Q(created_at__year=str(a)) queryset = queryset.filter(condition) print (queryset) return queryset When I'm filtering by year, it returns 200 response, but 0 objects When I'm filtering by month, I can't even get a 200 response, it returns 500 response -
Django - What is wrong with my view function?
In this function, the script can't get past the second if statement. def save_data(request): if request.method == 'POST': if request.POST.get('id')\ and request.POST.get('id1')\ and request.POST.get('id2'): try: print('if2') data=Flow() data.id = request.POST.get('id') data.id1 = request.POST.get('id1') data.id2 = request.POST.get('id2') data.save() except Exception as e: print(e) My question is pretty simple, why might this be happening? If you'd like to see more code please let me know in the comments. -
Login with limited IP addresses
I have written a custom authentication that allows only certain IP addresses to login. Below is my code: def get_client_ip(request): x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.META.get('REMOTE_ADDR') return ip def authenticate(self, request, username=None, password=None): # do something I am trying to write a test for it. Although, seems like my solution has an empty request. Here's my code: def test_login(self): # create user .... .... # pass a custom HTTP_X_FORWARDED_FOR client = Client(HTTP_X_FORWARDED_FOR='127.0.0.1') response = client.login(username='username', password='password') assert response.status_code == 200 This throws an error AttributeError: 'NoneType' object has no attribute 'META' So, perhaps my request in the fuction somehows is None. How can I fix this ? Thanks in advance! -
Data from one table not writing to another table
I have User table which contains registered user. I have created Enter table which has to record info about when user went through turnstile by using rfid tag. Model has been created, code been written but it doesn't work and not writing data to table. Last row in Written code file should write data to database, but now it doesn't. Thanks in advance! models.py from django.db import models class Department(models.Model): class Meta: verbose_name_plural = 'Отделы' department_name = models.CharField(verbose_name='Отдел', max_length=40, editable=True, unique=True) def __str__(self) -> str: return self.department_name class User(models.Model): class Meta: verbose_name_plural = 'Участники' first_name = models.CharField(verbose_name='Имя', max_length=40) last_name = models.CharField(verbose_name='Фамилия', max_length=40) rfid_mark = models.CharField(verbose_name='RFID', max_length=8, editable=True, unique=True) department = models.ForeignKey(Department, on_delete=models.CASCADE) datetime = models.DateTimeField(auto_now=True, editable=False) def __str__(self) -> str: return self.first_name + ' ' + self.last_name class Enter(models.Model): class Meta: verbose_name_plural = 'Проход' user = models.ForeignKey(User, verbose_name='Пользователь', on_delete=models.CASCADE) datetime = models.DateTimeField(auto_now=True, verbose_name='Время', editable=False, null=True, blank=True) enter_status = models.BooleanField(editable=False, verbose_name='Статус входа') turnstile_id = models.CharField(verbose_name='id Терминала', max_length=50) def __str__(self) -> str: return self.user + ' ' + self.enter_status Written code class Actions: def gives_access_if_registered(self): connection = database.connects_to_database() cur = connection.cursor() while True: ser.write(request_for_read) scanned_rfid = ser.readline().hex()[12:20] cur.execute("SELECT * FROM passage_user WHERE rfid_mark=?", (scanned_rfid,)) all_database_rows = cur.fetchall() for data in all_database_rows: name … -
threaded websocket in django and kubernetes
I have a model for which I take some data from another website using a websocket and send a request to another website and save the result to database. what I'm doing right now is in my appconfig's ready I create the websockets for all my model's instances in database and store them in a global dictionary where i can access the thread for each model instance using it's PK. I have two questions: As my website gets bigger, with each model having its own thread would that cause me a problem having more than 10,000 threads for example? If I want to scale the application using kubernetes for example would I get into a problem? Because with each instance of my application, threads will spawn and they all try to do the same thing while I only want it to be done once. Also the code doesn't look so pretty this way so I assume there must be other ways of doing this in django which would also be scalable, so I appreciate any suggestion. -
Dual behavior for Class Based View
Let's say that we model university programs, which are divided in tracks. A track belongs to a program. So: class Program(models.Model): name = models.CharField(max_length=30) class Track(models.Model): name = models.CharField(max_length=30) program = models.ForeignKey(Program, on_delete=models.CASCADE, related_name='tracks') I'd like to allow the creation of a track, with the possibility of specifying the program it belongs to, so I can use: class TrackCreateView(CreateView): model = Track fields = ['name', 'program'] But from the program details, I want to allow the creation of a track for that specific program, so I came up with: class ProgramTrackCreateView(CreateView): model = Track fields = ['name'] def form_valid(self, form): form.instance.program_id = self.kwargs['pk'] return super().form_valid(form) In the urls.py, a pk parameter is provided, so this will populate the program_id correctly. Is there any way to merge these two views into a single one, e.g. passing a parameter to the .to_view() method, or something similar? Because I need to change the list of fields to be displayed before the form is created and I need to know if I need to override program_id or not. -
Django : pass session information to next template & view
I'm trying to build a little website where users can set up tournaments and then invite players for their tournaments. These are my Tournament and Invite models: class Tournament(models.Model): tourney_name = models.CharField(max_length=200, null=False, blank=False) event = models.ForeignKey(NewsArticle, on_delete=models.DO_NOTHING, related_name='tourneys') host_user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) # player_count_limit = models.PositiveIntegerField(validators=[MaxValueValidator(100)]) player_join_deadline = models.DateField() fantasy_team_size = models.PositiveIntegerField(validators=[MinValueValidator(5),MaxValueValidator(15)]) created_dt = models.DateTimeField(auto_now_add=True) last_modified_dt = models.DateTimeField(auto_now=True) def __str__(self): return self.tourney_name def get_absolute_url(self): return reverse('home') class Invite(models.Model): name = models.CharField(max_length=200, blank=True, null=True) email = models.CharField(max_length=320, null=False, blank=False, validators=[EmailValidator],) invited_by = models.ForeignKey(get_user_model(), on_delete=models.DO_NOTHING) invited_for = models.ForeignKey(Tournament, on_delete=models.DO_NOTHING) created_dt = models.DateTimeField(auto_now_add=True) def __str__(self): return self.email def get_absolute_url(self): return reverse('home') And then these are my Views: class MakeTourneyView(CreateView): template_name = 'make_tourney.html' model = Tournament form_class = MakeTourneyForm def form_valid(self, form): form.instance.host_user = self.request.user form.save() return super(MakeTourneyView, self).form_valid(form) def get_success_url(self): return reverse('invite_players') #return reverse('invite_players', kwargs={'tourney_id': self.object.id}) def update_session(self): tourneyobj = self.get_object() self.request.session['tourney_id'] = tourneyobj.id return self.request.session['tourney_id'] class InvitePlayersView(CreateView): template_name = 'invite_players.html' model = Invite form_class = InvitePlayerForm def form_valid(self, form): tourney_id = self.request.session['tourney_id'] form.instance.invited_for = Tournament.objects.filter(id=tourney_id).get() form.instance.invited_by = self.request.user form.save() return super(InvitePlayersView, self).form_valid(form) I'm doing something wrong because the tourney_id is not being set on form.instance.invited_for ; instead when I click submit I get Django error saying "KeyError at /tourney/inviteplayers/ 'tourney_id'" Any … -
Django ContentType for relation to many models
I am working on model which is suppose to have relation to many different models, but one instance should have relation to only one of those models. Like Model Response which should store response body parsed on fields but this response can be from different sites which have different set of fields. Searching through SO i find that using django GenericRelation is good approach, so I tried it as below: class Response(models.Model): content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() service_data = GenericForeignKey("content_type", "object_id") class ServiceOne(models.Model): field1 = models.CharField(...) class ServiceTwo(models.Model): field2 = models.CharField(...) With those models I want to do something like this: s1 = ServiceOne.objects.create(field1="Foo") s2 = ServiceTwo.objects.create(field1="Bar") r1 = Response.objects.create(service_data=s1) r2 = Response.objects.create(service_data=s2) but it is throwing django.db.utils.IntegrityError: null value in column "content_type_id" violates not-null constraint. Solutions like "Add null=True" (as here Django Make ContentType Not Required) are not what I expect since I want this relation to be, not to get rid of error itself. According to https://docs.djangoproject.com/en/3.2/ref/contrib/contenttypes/ it should work just fine but I assume I miss something. I tried adding this to ServiceOne and ServiceTwo response = GenericRelation( Response, content_type_field='content_type_fk', object_id_field='object_primary_key', ) and model_type = ContentType.objects.get( app_label='actual_app_label', model="serviceone" ) s1 = ServiceOne.objects.create(field1="Foo") r1 = Response.objects.create( … -
django-cors-headers not working: No 'Access-Control-Allow-Origin' header is present on the requested resource
Full error: Access to XMLHttpRequest at 'https://[redacted]/api/get_match_urls/' from origin 'https://trello.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. I am making an API call from an extension while at trello.com I have corsheaders in my INSTALLED_APPS. I have 'corsheaders.middleware.CorsMiddleware' in my middleware as high up as possible. And I have CORS_ORIGIN_ALLOW_ALL set to True. Yes I've tried the alternate alias CORS_ALLOW_ALL_ORIGINS and it still didn't work. Anyone have any ideas? -
Category cant be empty issue in Django rest framework
I have a product add post API. I am sending all the data that is required but I got the above error every time. I am not sure what is the issue. "Category cant be empty" But I am sending the data. class Variants(models.Model): product_id = models.CharField(max_length=70, default='OAXWRTZ_12C',blank=True) price = models.DecimalField(decimal_places=2, max_digits=20,default=500) size = models.CharField(max_length=50, choices=SIZE, default='not applicable',blank=True,null=True) color = models.CharField(max_length=70, default="not applicable",blank=True,null=True) variant_image = models.ImageField(upload_to="products/images", blank=True,null=True) thumbnail = ImageSpecField(source='variant_image', processors=[ResizeToFill(100, 50)], format='JPEG', options={'quality': 60}) quantity = models.IntegerField(default=10,blank=True,null=True) # available quantity of given product variant_availability = models.CharField(max_length=70, choices=AVAILABILITY, default='available') class Meta: verbose_name_plural = "Variants" def __str__(self): return self.product_id #Product Model class Product(models.Model): merchant = models.ForeignKey(Seller,on_delete=models.CASCADE,blank=True,null=True) category = models.ManyToManyField(Category, blank=False) sub_category = models.ForeignKey(Subcategory, on_delete=models.CASCADE,blank=True,null=True) brand = models.ForeignKey(Brand, on_delete=models.CASCADE) collection = models.ForeignKey(Collection, on_delete=models.CASCADE) featured = models.BooleanField(default=False) # is product featured? best_seller = models.BooleanField(default=False) top_rated = models.BooleanField(default=False) tags = TaggableManager(blank=True) # tags mechanism name = models.CharField(max_length=150,unique=True) main_product_image = models.ImageField(upload_to="products/images", null=True, blank=True) thumbnail = ImageSpecField(source='main_product_image', processors=[ResizeToFill(100, 50)], format='JPEG', options={'quality': 60}) slug = models.SlugField(max_length=200,blank=True) description = RichTextField(blank=True) #picture = models.ImageField(upload_to="products/images", null=True, blank=True) picture = models.ManyToManyField(ImageBucket,null=True,blank=True,verbose_name="Add extra 3 images") rating = models.IntegerField(choices=((1, 1), (2, 2), (3, 3), (4, 4), (5, 5)) ) availability = models.CharField(max_length=70, choices=AVAILABILITY, default='in_stock') warranty = models.CharField(max_length=100, choices=WARRANTY, default='no_warranty') services = models.CharField(max_length=100, choices=SERVICES, … -
How to send scheduled mail in django?
I'm a complete beginner to Django, I want to send a reminder mail to the user to update the record 1st of every January and July. I have tried cron jobs, but I cannot implement it since it will work only on Linux. I tried scheduler in python since we are using while True...loop always runs and my website server itself not starting. Please help me to send scheduled mail using Django if you have any other approach. Thanks!!! -
cropper.js not displaying anything on Django website
I am following this tutorial on how to get cropper.js working with Django but it does not seem to work for me. https://medium.com/geekculture/implement-cropping-feature-on-your-website-in-under-10-min-cropper-js-46b90d860748 Here is the source code of said tutorial: https://github.com/RG2021/mysite I configured the settings, have the URLs right. Here is my code: views.py @login_required def edit(request): if request.method == 'POST': user_form = CustomUserChangeForm(instance=request.user, data=request.POST) profile_form = ProfileEditForm( instance=request.user.profile, data=request.POST, files=request.FILES) if user_form.is_valid() and profile_form.is_valid(): user_form.save() profile_form.save() messages.success(request, 'Profile updated successfully') else: messages.error(request, 'Error updating your profile') else: user_form = CustomUserChangeForm(instance=request.user) profile_form = ProfileEditForm(instance=request.user.profile) posts = Profile.objects.all() return render(request, 'account/edit.html', {'user_form': user_form, 'profile_form': profile_form}) edit.html < script > // image-box is the id of the div element that will store our cropping image preview const imagebox = document.getElementById('image-box') // crop-btn is the id of button that will trigger the event of change original file with cropped file. const crop_btn = document.getElementById('crop-btn') // id_image is the id of the input tag where we will upload the image const input = document.getElementById('id_image') // When user uploads the image this event will get triggered input.addEventListener('change', () => { // Getting image file object from the input variable const img_data = input.files[0] // createObjectURL() static method creates a DOMString containing a URL representing …