Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django & Postgres: Unique Constraint not enforced?
I have a django model: class MyModel(models.Model): my_field = models.CharField(max_length=500, unique=True) ... As you can see, "my_field" must be unique. Before creating a new object I run field_value: str = 'test 12/9' try: o = MyModel.objects.get(my_field=field_value) except MyModel.DoesNotExist: o = MyModel() ... to check if an object with the unique field_value exists. So far so good. Now I realised that I do have hundrets of "duplicate" values in my_field. Here are the copied exact values from django admin: 2 StR 46/15 2 StR 46/15 As you can see, they seem to be the same. But if I copy one value to the other field in django admin and try to save it, it fails due to an object already existing with this 'my_field'. But when saving each object itself, it does not fail. I used several tools to compare the strings, I am incapable to find a diffrence. Is there a way, that django or postgres is converting these strings somewhere so they are not the same anymore? Am I missing anything? Thanks for any help! -
How to connect Admin to img src in Django
How can I connect the admin part of my django website to so that the superuser can change the images through admin instead of changing it in the code below: <div class="col-md-6"> <div class="card" style="width: 25rem;"> <img src="{% static 'images/littlewomen.jpg'%}" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Little Women</h5> <p class="card-text">1949</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> -
Why my ajax request does not work in django?
I have a problem with an ajax request.I'm neophyte with jquery (and in general with javascript), so I hope that my problem is easly overcoming. Let us get straight to the crux of the matter. I have a form (created utilizing crispy_forms_tags) and after I have put a table that figure out the db created. In this table I have added also a buttom, "EDIT" that give me the possibility to modify the dataset using the a html modal tag. The script code is the following: $("form#updateUser").submit(function() { var idInput = $('input[name="formId"]').val().trim(); var codiceInput = $('input[name="formCodice"]').val().trim(); var tipologiaInput = $('input[name="formTipologia"]').val().trim(); var sottocateoriaInput = $('input[name="formSottocategoria"]').val().trim(); if (codiceInput && tipologiaInput && sottocateoriaInput) { // Create Ajax Call $.ajax({ url: '{% url "crud_ajax_update" %}', data: { 'id': idInput, 'codice': codiceInput, 'tipologia': tipologiaInput, 'sottocategoria': sottocateoriaInput }, dataType: 'json', success: function (data) { if (data.element) { updateToUserTabel(data.element); } } }); } else { alert("All fields must have a valid value."); } $('form#updateUser').trigger("reset"); $('#myModal').modal('hide'); return false; }); // Update Django Ajax Call function editUser(id) { if (id) { tr_id = "#element-" + id; codice = $(tr_id).find(".codice").text(); tipologia = $(tr_id).find(".tipologia").text(); sottocategoria = $(tr_id).find(".sottocateogira").text(); $('#form-id').val(id); $('#form-codice').val(codice); $('#form-tipologia').val(tipologia); $('#form-sottocateogira').val(sottocategoria); } } function updateToUserTabel(element){ $("#userTable #element-" + element.id).children(".userData").each(function() { var … -
Django form template without Submit button
So I am trying to save a form without using dedicated submit button in form div; <div class="col-lg-8 mt-5 cart-wrap ftco-animate"> <form method="post" id="my_form"> {% csrf_token %} <div class="cart-total mb-3"> <fieldset class="form-group"> {{ note|crispy }} </fieldset> </div> </form> </div> The button that I am using to trigger to save the form is at the bottom of page and like below: <p> <a href="{% url 'precheckout-view' %}" class="btn btn-primary py-3 px-4" type="submit" id="my_button" onclick="document.getElementById('my_form').submit()">Proceed to Checkout</a> </p> However the onclick doesn't trigger the form and the form doesn't save. Where am I doing wrong? -
how can i perform a dynamic update of a choice field of a queryset?
I've created a model with a choice field returns the level of the model:(something like..) models.py L_CHOICES = [ ('1', '1styear'), ('2', '2ndyear'), ('3', '3rdyear'), ('4', '4thyear'), ] class Student(models.Model): name = models.Charfield(primary_key = True, max_length = 255,) level = models.Charfield(max_length = 2, choices = L_CHOICES) and i want to add an action in the django administration site, so i can upgrade the level of a student, dynamically. Could anyone help me with that please. -
How to allow users to directly download a file stored in my media folder in django?
So I'm building a RESTful API for a "Development Platform" project using Django and want to setup a upload/download feature where the users of the platform can upload various files (Excel files, css files, pdf files, C# scripts, unity packages, blender files etc) and other users can then download these files through an endpoint. I have the upload file endpoint configured and properly working. At the download file endpoint, I want to receive the filename that the user wants to download and also verify the user's credentials and permissions for downloading that file and do some other model queries and checks too and finally find that file in my /media/ folder and serve it to the user's browser for auto downloading or a download pop-up on the browser. (This download file endpoint would get hit when user presses "Download File" button on the frontend). How can I achieve this in django? How do I "send" that file as a response to the user's browser for downloading? -
Iam trying to use a calendar in django to post events, in this case DJANGO-SCHEDULER(others appears to be outdated), but iam not getting sucess on it
I followed the steps in github to installed it but its not working, iam with doubts what to do in the models and views models.py class Programacao(models.Model): título = models.CharField(max_length=200) descrição = models.TextField() data_inicio = models.DateField(default=datetime.now, blank=False, null=True) data_fim = models.DateField(default=datetime.now, blank=False, null=True) imagem = models.ImageField(upload_to='imagens/%Y/%m/%d/') publicado = models.BooleanField(default=True) class Meta: verbose_name = 'Programação' verbose_name_plural = 'Programações' def __str__(self): return self.título -
Django Custom Error Page Css and JS not working
I am developing an application with Django. I prepared the error pages but; DEBUG = False ALLOWED_HOSTS = ["*"] when I do this in settings.py it does not read my css and javascript files. This is causing it and how to fix it. My urls.py and views.py content are below. urls.py urlpatterns = [ path('', index, name='home'), path('', include('admin.url')), path('data', data, name='data'), ] handler404 = 'admin.views.page_not_found' handler500 = 'admin.views.server_error' views.py def page_not_found(request, exception): return render(request, ERROR_404_TEMPLATE_NAME, status=404) def server_error(request): return render(request, ERROR_500_TEMPLATE_NAME, status=500) -
How to OR Django model field validators?
Does anyone know how to OR together Django model field validators? Something like this: example_field = models.URLField(max_length=2048, null=True, blank=True, unique=False, validators=[validator1|validator2]) I am guessing that there is a way and it involves the Q operator, but I can't find what it is exactly. -
Django 'not in' querying for related fields
I want to filter on objects that only have related objects with values in a finite set - here's how I tried to write it: trips = Trip.objects\ .filter(study=study, field_values__field__name='mode', field_values__int_value__in=modes)\ .exclude(study=study, field_values__field__name='mode', field_values__int_value__not_in=modes)\ .all() I think this would work, except 'not in' is not a valid operator. Unfortunately, 'not modes' here is an infinite set - it could be any int not in modes, so I can't 'exclude in [not modes].' How can I write this with a Django query? -
Django Admin tabularInline very slow request
I have Location app in my project. There are list of countries, their states and cities. model.py class Country(models.Model): class Meta: verbose_name = 'Country' verbose_name_plural = 'Countries' unique_together = ['name', 'iso2'], name = models.CharField( max_length=255, verbose_name=_('Country name'), ) iso2 = models.CharField( max_length=2, null=True, blank=True, verbose_name=_('iso2'), ) phone_code = models.CharField( max_length=15, null=True, blank=True, verbose_name=_('Phone code'), ) def __str__(self): return self.name class State(models.Model): name = models.CharField( max_length=100, verbose_name=_('State'), ) country = models.ForeignKey( Country, on_delete=models.SET_NULL, verbose_name=_('Country'), related_name='states', related_query_name='states', null=True, ) state_code = models.CharField( max_length=20, null=True, blank=True, verbose_name=_('State code'), ) def __str__(self): return self.name class City(models.Model): name = models.CharField( max_length=70, verbose_name=_('City name'), ) state = models.ForeignKey( State, on_delete=models.SET_NULL, null=True, verbose_name=_('State'), related_name='cities', related_query_name='cities', ) country = models.ForeignKey( Country, on_delete=models.SET_NULL, verbose_name=_('Country'), related_name='cities', related_query_name='cities', null=True, ) def __str__(self): return self.name I'm trying to get list of country cities in Django admin via Tabular inline, but when I click on any country it loads very slow (about 1 minute). How to optimize it? When I did it in Shell - Country.objects.get(name='USA').cities.all() it returns results less than 10ms admin.py from .models import Country, City class CountryCitiesAdmin(admin.TabularInline): model = City class CountryAdmin(admin.ModelAdmin): inlines = (CountryCitiesAdmin,) list_display = ('name', 'iso2', 'phone_code') search_fields = ('name', 'code', 'phone_code',) admin.site.register(Country, CountryAdmin) -
How can I have only positive decimal numbers in Django using Python?
validators is not working.NameError: name 'MinValueValidator' is not defined -
Django Rest Framework Serializers: Validating object.user is request.user
I'm working on a REST API with Django Rest Framework and in my ModelViewSet I need to validate that the current request.user has the right to edit a particular object. I have found the part of the documentation that specifies how permissions work– but this is on the ViewSet side, and not the serializer side: class FooViewSet(viewsets.ModelViewSet): model = Foo serializer_class = FooSerializer def get_queryset(self): return self.request.user.foos.all() def perform_create(self, serializer): serializer.save(user=self.request.user) def get_permissions(self): if self.action == "list": permission_classes = [permissions.IsAuthenticated] else: permission_classes = [IsObjectUser] return [permission() for permission in permission_classes] This will work fine for 403ing when it's not the appropriate user, but I believe I should also be doing serializer-level validation? How can I get the object in question in my validate method to check against? class FooSerializer(serializers.ModelSerializer): class Meta: model = Foo fields = [ "type", "title", "description", "image", ] def validate(self, attrs): # <-- how can I get the object so I can check against the self.request.user? -
Django drop down is not giving me the full selected name
I have a drop down and it is populated through my models. I am able to select one and then push submit. But the data that I am getting is being broke by spaces in the name. So if I have an option in my drop down menu such as: Please Pick Me I will only get Please template.html <form action="{% url 'parsed' %}" method="POST"> {% csrf_token %} <div class="form-group"> <label for="sel1">Select Test:</label> <select class="form-control" name="selectedtest" id="sel1"> {% for test in test %} <option value={{ test.name }}>{{ test.name }}</option> {% endfor %} </select> </div> <div class="form-group"> <label>Paste Event JSON</label> <textarea class="form-control" name="jsontextarea" rows="20"></textarea> <div style="text-align:center"> </br> <input class="btn btn-primary" type="submit" value="Parse"> </div> </div> </form> views.py def parsed(request): data = request.POST.get('jsontextarea') testname = request.POST.get('selectedtest') print(testname) context = { "json" : data, "test" : Test.objects.all(), "event" : Event.objects.all(), "platform" : Platform.objects.all(), "device" : Device.objects.all(), "property" : Property.objects.all(), "testname" : testname } return render(request, 'jsonparser/parsed.html', context) -
What common approaches do I have to scaling data imports into a DB where the table structure is defined by Django ORM?
In the current project I'm working on we have a monolith Django webapp consisting of multiple Django "apps", each with many models and DjangoORM defining the table layout for a single instance Postgres database (RDS). On a semi-regular basis we need to do some large imports, hundreds of thousands of rows of inserts and updates, into the DB which we use the DjangoORM models in Jupyter because of ease of use. Django models make code simple and we have a lot of complex table relationships and celery tasks that are driven by write events. These imports have grown, and cause performance degradation or can be rate limited and take weeks, by which time data is worth a lot less - I've optimized pre-fetching and queries as much as possible, and testing is fairly tight around this. At other places I've worked, there's been a separate store that all ETL stuff gets transformed into and then some reconciliation process which is either streaming or at a quiet hour. I don't understand how to achieve this cleanly when Django is in control of table structures. How do I achieve a scenario where: Importing data triggers all the actions that a normal DjangoORM … -
Django Stripe Attribute Error - module 'requests' has no attribute 'Session'
I'm trying to get a basic Stripe set up in Django project but cannot get past this error. I am able to submit the initial Stripe form (get the green check) but I can't complete the payment and get successful payment template to show. I used an online tutorial that got me this far. Have been trying to use the Stripe docs and looking everywhere I can think of online but can't get anything to work. If someone help me with how to define a 'Session' that would be really appreciated. Django error ('stripe_payment' is the successful payment html template): Exception Type: AttributeError at /stripe_payment/ Exception Value: module 'requests' has no attribute 'Session' Settings: # Stripe Settings STRIPE_SECRET_KEY = '<secret key>' STRIPE_PUBLISHABLE_KEY = '<publishable key>' urls: from django.urls import path from . import views from .views import StripeCharge app_name = 'requests' urlpatterns = [ path('stripe_charge/', StripeCharge.as_view(), name='stripe_charge'), path('stripe_payment/', views.stripe_payment, name='stripe_payment'), ] views: from django.shortcuts import render, redirect from django.conf import settings from django.views.generic.base import TemplateView import stripe stripe.api_key = settings.STRIPE_SECRET_KEY class StripeCharge(TemplateView): template_name = 'requests/stripe_payment.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['key'] = settings.STRIPE_PUBLISHABLE_KEY return context def stripe_payment(request): if request.method == 'POST': charge = stripe.Charge.create( amount=500, currency='usd', description='Test Charge', source=request.POST['stripeToken'] … -
Django 3, Python 3.8 Can't Find My Templates
I'm running Python 3.8 and Django 3.0.5 on Windows 10. I'm using JetBrains PyCharm 2(Professional Edition) to create and deploy my Django apps. Here's the code in my views.py: from django.shortcuts import render # Create your views here. def index(request): return render(request, "firstapp\homes.html") Views.py Here's the line in my settings.py: import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'y******** # SECURITY WARNING: don't run with debug turned on in production! 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', 'firstapp', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'Hello.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')] , 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'Hello.wsgi.application' # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': … -
URL error in {% url ... %} when breaking line in source code
I'm working on an app in Django (2.2) and I've run into an issue with one of my html templates, where the URL doesn't work when the source code line breaks inside a {% url ... %} tag. This is the code that doesn't work: <small><a href="{% url 'learning_logs:edit_entry' entry.id %}">edit entry</a></small> This is the error I get: Page not found (404) Request Method: GET Request URL: http://localhost:8000/topics/2/%7B%25%20url%20'learning_logs:edit_entry'%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20entry.id%20%25%7D Using the URLconf defined in learning_log.urls, Django tried these URL patterns, in this order: admin/ users/ [name='index'] topics/ [name='topics'] topics/<int:topic_id>/ [name='topic'] new_topic/ [name='new_topic'] new_entry/<int:topic_id>/ [name='new_entry'] edit_entry/<int:entry_id>/ [name='edit_entry'] The current path, topics/2/{% url 'learning_logs:edit_entry' entry.id %}, didn't match any of these. This is the code that works: <small><a href="{% url 'learning_logs:edit_entry' entry.id %}"> edit entry</a></small> Does it mean you can't break the line in source code inside {% url ... %} tags? Are there any workarounds for this? -
Django custom user with AbstractUser
from django.contrib.auth import get_user_model from django.contrib.auth.models import AbstractUser class MyUser(AbstractUser): pass class Landlord(models.Model): user = models.OneToOneField(get_user_model(), on_delete=models.CASCADE) #other fields def __str__(self): # **Error is here** return self.user.email When I use email field of my user it has give this error: "Instance of 'OneToOneField' has no 'email' member" what is the reason for error?(And what fields are there in AbstractUser class?) How can I fix the error. -
Django template iterate over context list
I can't find a clear answer on this. I have a view that shows multiple models. In my template, I have written out everything to manually display what I want but it doesn't really stick to DRY so I'd like to iterate over the context. What I can't find is what the context object is referenced as in my template? I have written pseudo code in the template snippet below of what I want to achieve. views.py class ConfigurationDetailView(LoginRequiredMixin, TemplateView): ''' Returns a view of all the models in a configuration ''' template_name = 'configurator/configuration_detail.html' def get_context_data(self, **kwargs): ''' Uses a list of dictionaries containing plural strings and models to filter by the configuration ID to only show items in the config. ''' context = super(ConfigurationDetailView, self).get_context_data(**kwargs) context_dict = [ {'string':'integrations', 'model': IntegrationInstance}, {'string':'control_groups', 'model': ControlGroup}, {'string':'endpoints', 'model': Endpoint}, {'string':'scenes', 'model': Scene}, {'string':'actions', 'model': Action}, {'string':'smart_scenes', 'model': SmartScene}, {'string':'buttons', 'model': Button}, {'string':'button_actions', 'model': ButtonAction}, ] for item in context_dict: for key, value in item.items(): if key == 'string': string = value else: model = value context[string] = model.objects.filter(config_id__exact=self.kwargs['config_id']) return context template.html - pseudo code {% extends "base_generic.html" %} {% block content %} <div class="container"> <h1>Configuration Details</h1> {% for object in … -
How to return multiple values in Django Select2 autocomplete form
I am using Select2 for django to create autocomplete form. I would like for autocomplete form to return more fields from database. For example: in models i have this: class Places(models.Model): r_name = models.CharField(max_length=200, default=None) r_country = models.CharField(max_length=20, default='Englands', blank=True, null=True) r_place = models.CharField(max_length=200, default=None, blank=True, null=True) I want form to return r_name + r_country + r_place. When i was using jquery autocomplete, i wrote it like that and it worked: def PlacesNameAutocomplete(request): if request.is_ajax(): q = request.GET.get('term', '').capitalize() search_qs = Places.objects.filter(r_name__startswith=q) results = [] print(q) for r in search_qs: results.append(r.r_name + ' (' + r.r_country + ' - ' + r.r_place + ')') data = json.dumps(results) else: data = 'fail' mimetype = 'application/json' return HttpResponse(data, mimetype) Right now i am using this Select2 code for autocomplete, form returns r_name, but I don't know how to add country and place to return results. Views.py from dal import autocomplete from places.models import Places class PlaceAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): queryset = Places.objects.all() if self.q: queryset = queryset.filter(r_name__istartswith=self.q) return queryset Forms.py class newActivityForm(ModelForm): route_id = forms.ModelChoiceField( queryset=Places.objects.all(), widget=autocomplete.ModelSelect2(url='place-autocomplete', attrs={'data-placeholder': 'Start typing name ...', 'data-minimum-input-length': 3, 'style': 'width: 100%' },)) -
Django Crispy Forms / Adding my own classes
I want to change the design of crispy form field with my own classes. I read some information about it but could no find the solution. Let me add my files and explain: forms.py from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django import forms from django.core.exceptions import ValidationError class UserRegisterForm(UserCreationForm): ...some code... email = forms.EmailField(label='İTÜ Maili') class Meta: model = User fields = [...'email'] widgets = { 'email': forms.EmailInput(attrs={'class': 'myClassName'}), } This is how I wanted to add my class to email field. register.html <div class="container-fluid mt-5"> <div class="row justify-content-center text-center"> <div class="col-4"> </div> <div class="col-4"> <form class="mt-5" id="registerForm" method="post"> {%csrf_token%} {{ form.email|as_crispy_field }} <button type="submit" value="SIGN UP" class="button is-secondary">Submit</button> </form> </div> <div class="col-4"> </div> </div> </div> This is my template. I added background-color:black; to my css class to check whether it works, but unfortunately it did not work. I tried to write the template with labels and inputs but messed up with validation errors and etc. Is there any way doing this only using crispy form code like I have written: ({{ form.email|as_crispy_field }}) -
Using Jinja2 MemcachedBytecodeCache With Django
I apologize if this answer is obvious, but I can't seem to figure out how to enable Jinja2's MemcachedBytecodeCache in Django (I'm using version 3.0, but generally either). Jinja's documentation makes it sound like it a relatively straightforward setting: class jinja2.MemcachedBytecodeCache(client, prefix='jinja2/bytecode/', timeout=None, ignore_memcache_errors=True) This class implements a bytecode cache that uses a memcache cache for storing the information. It does not enforce a specific memcache library (tummy’s memcache or cmemcache) but will accept any class that provides the minimal interface required. The goal, obviously, is to enable Jinja's bytecode caching with Memcached, which is already enabled on my site. Any assistance in implementing this in settings would be much appreciated. Thank you! -
How can I create multiple objects with one view/form in Django
So here's what I'm attempting to do, and if there's a better way, please let me know. I am creating a dating app and am attempting to create a message form that displays once a user has matched with another user. I already have the matching down and the users displaying correctly, but I need this messaging component. This will be in the form of a link beneath the user's profile that my user has matched with. Now, my InstantMessage model has a foreign key to Conversation which should contain 2 members, whom are having a conversation and contains at least one message exchanged between each other . Now, I what I want to do, when a user hits a link to start messaging, to have my code check if there is already a conversation object between the two users, and if so, then use that conversation object pk for my conversation field in Instant Message and then create a form for that. And if there isn't, then I want a conversation object to be created first, and then a message object to be created. I want this all in one view and with one link, so I assume I … -
Django Python: can't open file 'manage.py': [Errno 2] No such file or directory
I'm having the same issue as this question regarding deploying a Django project to Heroku. I've followed the comments to investigate further, but there's no additional feedback from the original poster to finish the conversation. Following on the Mozilla instructions I make it to the heroku run python manage.py step, which returns the error below: Running python manage.py migrate on ⬢ fast-oasis-14644... up, run.2316 (Free) python: can't open file 'manage.py': [Errno 2] No such file or directory Following the comment from Chris in the referenced question, I ran heroku run bash to get a shell on a one-off dyno. Looking at the structure there, the manage.py file is two levels down in the clmp folder, which is the name of my Django app. ~ $ ls Procfile README.md requirements.txt runtime.txt src ~ $ cd src ~/src $ cd clmp ~/src/clmp $ ls assets clmp contracts manage.py templates I'm assuming that this means something is misaligned with what Heroku is looking for vs my Procfile setup, but I've used web: gunicorn clmp.wsgi --log-file - following on the Mozilla instructions referenced above. My git push to Heroku master is successful. Thanks in advance for the help.