Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can not make git pull after import
I have a problem with the file which is imported (application in django 1.11). After importing the file, the data is saved to it, its status is modified: modified: media/import_file.json Then I want to do a git pull on my code and I can not because the file is modified. I have entries in the .gitignore file, but they do not work: /www/media/import_file.json /www/media/* -
Authenticate a user with Django
I have the login html page and an index html page but when i write down username and password the page only refresh without doing anything. I use Django 2.x and Python 3.4 The code in login html: <form class="form-signin" action='{% url 'myapp:index' %}' method="post"> {% csrf_token %} <img class="mb-4" src='{% static 'app/img/logo.png' %}' alt="" width="300" height="100"> <h1 class="h3 mb-3 font-weight-normal">mysite</h1> <br> <div class="group"> <input type="username" id="inputUser" name="username" class="form-control" placeholder="Username" required autofocus alt="" width="300" height="100"> </div> <div class="group"> <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required alt="" width="300" height="100"> </div> <div> <button class="btn btn-lg btn-primary btn-block" type="submit">Accedi</button> </div> </form> and here my view: def index(request): username = request.post["username"] password = request.post["password"] user = authenticate(request, username=username, password=password) if user is not None: login(request, user) return render(request, "myapp/index.html") What I'm doing wrong? Thanks -
Build A Website with React - Django (DRS ?) - PostgreSQL
I want a little help - guideline to this one. Can I combine the above technologies in order to build a Website with a front-end (React) and a complicated backend (Django) on Postgres? Will I consume REST services of Django Rest Framework or will I use only Django? If I have read correctly these are two different things. -
Django issue with gettext unable to read .mo files
To give a bit of context, I'm working in internship on the upgrade of a Django app from 1.4.22 to 1.11 and python 2 to 3. The project wasn't well factored, and when I tried to refactor it, I got a strange stack : Traceback (most recent call last): File "/home/antonin/Developpement/Projet/djangoproject2/djangoproject/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute django.setup() File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/__init__.py", line 21, in setup apps.populate(settings.INSTALLED_APPS) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models(all_models) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/antonin/Developpement/Projet/djangoproject2/djangoproject/instance/models.py", line 54, in <module> YEARS += [(str(yr), _(u"n+%(year)d") % {'year': yr}) for yr in range(1, 20)] File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/functional.py", line 179, in __mod__ return six.text_type(self) % rhs File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/functional.py", line 144, in __text_cast return func(*self.__args, **self.__kw) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 83, in ugettext return _trans.ugettext(message) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 325, in ugettext return do_translate(message, 'ugettext') File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 306, in do_translate _default = translation(settings.LANGUAGE_CODE) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 209, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 195, in _fetch res = _merge(apppath) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in _merge t = _translation(path) File "/home/antonin/Developpement/Projet/djangoproject2/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _translation t = gettext_module.translation('django', path, … -
Get Postgres dump from a database hosted in a different server through Django
I'd like to get the equivalent of pg_dump inside django to fetch table details from the database hosted in a different server. I know of call_command where i can use call_command('dumpdata',stdout=f) to dump my data to a file but it requires the database to be in the same machine. Also, i know i can use the sub_process to run the below code. pg_dump --host="" -U username -W -d database -t tablename> outputfile.sql But i am looking for a method using Django. -
How to break up a git branch along files?
The question: Is there a way to break up a git branch along file lines (not along commits) so that some files/changes can be merged to master before others? Our specific use case: We use Django and we often develop features with migrations together in feature branches. Because it's often a discovery process, it's not really feasible to do models/migration changes first and rest-of-the-code changes second, so the commits inside the branch can go back and forth between those. However, when deploying to our live systems, we often want to deploy certain migrations before others or before the code. -
Safari 11.1.2 won't able to play the video django app
I have an application in django. I have uploaded a video which is playing perfectly fine in all the browser except for safari. Configuration for media files in settings.py is as MEDIA_ROOT = os.path.join(BASE_DIR,'media_root') MEDIA_URL = '/media_root/' Url which i am testing is http://admin.newsyoucantuse.in/media_root/blog/videos/sample_video_sample_video_SampleVideo_1080x720_2mb.mp4 I have gone through a lot of solutions but didn't understand what exactly is the issue, -
build_attrs() got an unexpected keyword argument 'id'
I am trying to get date input with month and year drop-down menus. I am using a widget from django snippet. About the widget: A Widget that splits date input into two boxes for month and year, with 'day' defaulting to the first of the month. Here's the code of the widget import datetime import re from six import string_types from django.forms.widgets import Widget, Select from django.utils.dates import MONTHS from django.utils.safestring import mark_safe __all__ = ('MonthYearWidget',) RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$') class MonthYearWidget(Widget): """ A Widget that splits date input into two <select> boxes for month and year, with 'day' defaulting to the first of the month. Based on SelectDateWidget, in django/trunk/django/forms/extras/widgets.py """ none_value = (0, '---') month_field = '%s_month' year_field = '%s_year' def __init__(self, attrs=None, years=None, required=True): # years is an optional list/tuple of years to use in the "year" select box. self.attrs = attrs or {} self.required = required if years: self.years = years else: this_year = datetime.date.today().year self.years = range(this_year, this_year+10) def render(self, name, value, attrs=None): try: year_val, month_val = value.year, value.month except AttributeError: year_val = month_val = None if isinstance(value, string_types): match = RE_DATE.match(value) if match: year_val, month_val, day_val = [int(v) for v in match.groups()] output = [] … -
How to create dynamic database for each user in django
Actually Im trying to create database dynamically for each user and models too. -
Python & Django : Creating Checkboxes and letterboxes with reportlab
I'm new to reportlab library , and I've been creating pdfs using reportlab, the pdf I need to create now contains checkboxes and letterboxes , but I cant find how to do so. here is an exemple of how I create pdf on my view.py: buff = BytesIO() menu_pdf = SimpleDocTemplate(buff, rightMargin=60, leftMargin=60, topMargin=40, bottomMargin=65) response = HttpResponse(content_type='application/pdf') cachet="<para alignment='right'>Cachet et signature :</para>" t=[] t.append(Paragraph(cachet,stylex1)) tit=[[t]] Table_t=Table(tit,colWidths=(180*mm)) Table_t.setStyle(TableStyle([('BOX', (0,0), (-1,-1), 0.25, colors.black), ('BACKGROUND', (-2, 0), (-2, -1), colors.white), ('INNERGRID', (0,0), (-1,-1), 0.5, colors.black)])) story.append(Table_t) menu_pdf.build(story) response.write(buff.getvalue()) buff.close() when I search how to create checkboxes I only find the canvas way . however letterboxes are only available on RML My question is : is there a way to create checkboxes and letterboxes with the build(story) way . because I dont want to save pdf to disk I need to generate them automatically and let the user choose to save or not save it. Any help please ? THANK YOU In Advance -
Django filter_class with empty filter value
I have a Django Viewset like : class OrderViewSet(...): permission_classes = [ IsAuthenticated, HasApiPermission, CanAdministerHosts, ] queryset = Order.objects.all() serializer_class = OrderSerializer filter_class = OrderFilter and the OrderFilter class: class OrderFilter(APIv3FilterSet): """ Filter for order. """ // some fields class Meta: model = UserId fields = // some fields This work with some value for filter like GET .../order/?id=1 but if I have no filter value like GET .../order/ the code return error : AttributeError at .../order/\n'NoneType' object has no attribute 'split' This may be because emty filter string result in None type object. Provided that I have to use filter_class (not filter_backend or whatever), how can I solve this problem ? -
could not find a version that satisfies the requirement pipenv
I'm complwtely new to programming world. i've just finished a Python course so i have no perior experience with dealing with back-end side python version is 3.6.2 windows 10 i've use those commands to install virtual environment pip install virtualenv pip3 install pipenv but both hit me with an error says could not find a version that satisfies the requrement virtualenv/pipenv no matching distribution found for virtualenv/pipenv -
django.core.exceptions.ImproperlyConfigured: WSGI application 'netfacer.wsgi.application' could not be loaded; Error importing module
I am just a beginner in django . I tried to create sub-domain by following this link. When I run my project it shows the following error django.core.exceptions.ImproperlyConfigured: WSGI application 'netfacer.wsgi.application' could not be loaded; Error importing module. my settings.py INSTALLED_APPS = [ 'django_hosts', 'subdomains', '...........',] MIDDLEWARE = [ 'django_hosts.middleware.HostsRequestMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'subdomains.middleware.SubdomainURLRoutingMiddleware', ...................... 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django_hosts.middleware.HostsResponseMiddleware', hosts.py host_patterns = patterns('', host(r'www', settings.ROOT_URLCONF, name='www'), host(r'(?!www).*', 'netfacer.hostsconf.urls', name='wildcard'), host(r'vendor', 'netfacer.hostsconf.urls', name="vendor") ) also the documentation in the above link is confusing me -
How to process data from DataTables Editor in Django?
I'm trying to process data sent via DataTables Editor plugin in a Django view. The received request.POST looks like: {'action': 'edit', 'data[3115][row1]': 'value1', 'data[3115][row2]': 'value2', 'data[3115][row3]': 'value3', 'data[3115][row4]': 'value4', 'data[3115][row5]': 'value5'} where 3115 is the primary key of my model. Whats the intended approach in Django view to get PK and model.row1, model.row2, model.row3,... values from the POST data? -
OneToOneField related_query_name
I have 2 models and one another is OneToOneField to another Let me call CaseIssue and ClosedCaseIssue model class CaseIssue(...): pass class ClosedCaseIssue(...): case_issue = models.OneToOneField(CaseIssue, related_name='closed_case_issue', related_query_name='closed_case_issue', on_delete=models.CASCADE) By using related_query_name I can search the CaseIssue which is still open. Open or Close determine by ClosedCaseIssue has been created and related to CaseIssue This is correct number CaseIssue.objects.filter(closed_case_issue=None).count() This is my approach to get Open CaseIssue. But result is 1 which is wrong CaseIssue.objects.filter(closed_case_issue=not None).count() Question: What is the practical way to get Open CaseIssue? -
Serialize m2mfield('self')
I have this model in models.py: class Foo(models.Model): bar = models.ManyToManyField('self') How can I serialize it? I was using one of solutions from this topic: Django rest framework nested self-referential objects But none of them working with M2M, either causes in infinity cycle of serialization. Solution where I'm using a row of serializers works good except it's limited by copy&paste (sounds really sad :) ) Generic model mostly looks like a comment's tree. I hope such a problem was already solved before but haven't found how yet. -
Django Rest : How to send data to a django rest api from a django project?
I need some clear concept about sending data to a django rest api from a django project. For example: From my django project I will send person's full name to the api and api return the data like firstname, lastname in JSON format. -
Django: DeprecationWarning about imp module
Currently, I am using Django 2.1 and ran the test checker with deprecation warnings turned on today. I got this warning below and do not really know why I get this because my Django project does not use/need any import imp statements. I found out that pip and setuptools use import imp sometimes, but that's out of my control and has nothing to do with my Django project in general. python -Wa manage.py test /home/user/.local/share/virtualenvs/django-app-1XPpM6qc/lib/python3.6/distutils/__init__.py:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp In my virtualenv both pip and setuptools are installed. However, AFAIK, pipenv needs those packages. Can someone clarify that? -
Django 2.0 testing login required for password change failing with syntax error
I am working through the tutorial https://simpleisbetterthancomplex.com/series/beginners-guide/1.11/ from Vitor Freitas. I am using Django 2.0.7 for this task. I know that the tutorial was written for 1.11 and I have been fixing any challenges that have come up during the process. Currently I am having issues with one test that is failing to run due to this error ====================================================================== ERROR: accounts.tests.test_view_password_change (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: accounts.tests.test_view_password_change Traceback (most recent call last): File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name import(name) File "/home/lance/dev/proj/accounts/tests/test_view_password_change.py", line 44 self.assertRedirects(response, f'{login_url}?next={url}') The test code is question looks like this class PasswordChangeTests(TestCase): def setUp(self): username = 'john' password = 'secret123' user = User.objects.create_user(username=username, email='john@doe.com', password=password) url = reverse('password_change') self.client.login(username=username, password=password) self.response = self.client.get(url) class LoginRequiredPasswordChangeTests(TestCase): def test_redirection(self): url = reverse('password_change') login_url = reverse('login') response = self.client.get(url) self.assertRedirects(response, f'{login_url}?next={url}') The invalid syntax seems to come from the last line self.assertRedirects(response, f'{login_url}?next={url}') Can someone help me out as to why this is invalid? As I understand it the test is looking for the pattern that is listed in the single quotes and I have tested that it is there. I can't understand why the single quotes is … -
How to circumvent Django's req/resp cycle when updating it's internal state
I have a Django application that uses large data structures in-memory (due to performance constraints). This wouldn't be a problem, but I'm using Heroku, where if the python web process takes more than 30s to start, it will be stopped as it's considered a timeout error. Because of the problem aforementioned, I've used a daemon process(worker in Heroku) to handle the construction of the data structures and Redis to handle the message passing between processes. When the worker finishes(approx 1 minute), it stores the data structures(50Mb or so) in Redis. And now comes the crux of the matter...Django follows the request/response paradigm and it's synchronised. This implies a Django view should exist to handle the callback from the worker announcing it's done. Even if I use something fancier like a pub/sub from Redis, I'm still forced to evaluate the queue populated by a publisher in a view. How can I circumvent the necessity of using a Django view? Isn't there an async way of doing this? Below is the solution where I use a pub/sub inside a view. This seems bad, but I can't think of another way. views.py ... # data_handler can enqueue tasks on the default queue data_handler … -
How to set cookies by using Django?
views.py def signin(request): if request.method == "POST": form = LoginForm(request.POST) email_input = str(request.POST['email']) password_input = str(request.POST['password']) user_Qset = Profile.objects.filter(email = email_input) if user_Qset is not None: password_saved = str(user_Qset.values('password')[0]['password']) if password_input == password_saved: request.session['name'] = str(user_Qset.values('name')[0] ['name']) request.session['email'] = str(user_Qset.values('email')[0]['email']) request.session['password'] = str(user_Qset.values('password')[0]['password']) return HttpResponse('login success.') else: return HttpResponse('locin failed, wrong password') else: return HttpResponse('login failed, wrong email address') else: form = LoginForm() return render(request, 'registration/login.html', {'form': form}) I want to add cookies by using request.session method but it doesn't work How I use it?? -
Django: Delete View without prompt using Javascript Confirmation
I have a a template where I can delete using Django DeleteView. I want it the data to be deleted after using the Javascript popup. Views.py class ObjectNameDeleteView(DeleteView): model = ObjectName form_class = PostObjectName success_url = 'http://localhost:8000/impact/displayobjects/' DisplayObjects.html <form method="POST"> {% csrf_token %} <a href="{% url 'person_delete' obj.pk %}"> <button type="submit" class="btn btn-danger" onClick="deleteFunction()">Delete</button></a> </form> <script> function deleteFunction(e) { if(!confirm("Are you sure you want to delete?")){ e.preventDefault(); } } </script> After I click the Delete button, there is an error: CSRF verification failed. Request aborted. How can I make this work? -
No changes detected - Django. After 'pip install django-registration-redux'
I installed a simple registration module to my already working application according to this tutorial and this documentation. Below I will describe my steps: 1.)In my virtualenv(the same directory which have my manage.py) I install django-registration-redux using the command 'pip install django-registration-redux'. 2.) Next i adds all the necessary information to my settings.py, layout as in the file below. 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/2.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'xxx' # 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', 'bootstrap3', 'reviews', 'registration' ] ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window REGISTRATION_AUTO_LOGIN = True # Automatically log the user in. 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 = 'winerama.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 = 'winerama.wsgi.application' LOGIN_REDIRECT_URL = '/reviews/review/user' # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases DATABASES = { 'default': { … -
Django summary query
Is it possible in Django to write a query for related models that presents a summary grouped by location, with the object count and the number of related objects? For example: with Models class Job(models.Model): id_number = models.CharField() location = models.CharField() class Item(models.Model): id_number = models.CharField() description = models.CharField() job = models.ForeignKey(Job) If I wanted to get an admin.model that groups the jobs by location and shows the total count of items for each location | Location | Number of Jobs | Number of Items | ----------------------------------------------- | Chicago | 52 | 305 | | Seattle | 12 | 185 | etc,. I've tried with aggregation and annotation queries, but these always seem to only work with one of the counted columns being accurate or the locations aren't grouped /are split. I feel like this should be simple in Django, but the ORM is breaking by brain... I've tried an admin.model like below, but this splits up the location... @admin.register(JobSummary) class JobSummaryAdmin(admin.ModelAdmin): list_display = ("location", "job_count", "item_count") def get_queryset(self, request): queryset = super().get_queryset(request) queryset = queryset.annotate( _job_count=Count("id", distinct=True), _item_count=Count("item", distinct=True), ) return queryset def job_count(self, obj): return obj._job_count def item_count(self, obj): return obj._item_count Thanks for any advice Han -
DateTime Field shows invalid format error while passing empty value through form
I trying to submit form while keeping field for datetime as empty which results in an error showing invalid format for datetime. my modal class lead(models.Model): assigned_to=models.CharField(max_length=15) ref=models.CharField(max_length=10,blank=True) lead_type=models.CharField(max_length=20) priority=models.CharField(max_length=20) hot=models.CharField(max_length=20,blank=True) source=models.CharField(max_length=20,blank=True) mls_lead=models.CharField(max_length=20,blank=True) auto_imported=models.CharField(max_length=20,blank=True) inquiry_date=models.DateTimeField(blank=True,null=True) lead_closed_date=models.DateTimeField(blank=True,null=True) created_by=models.CharField(max_length=20,blank=True) property_id=models.IntegerField(blank=True,null=True) contact_id=models.IntegerField(blank=True,null=True) its clear that i have given null true for the datetime field and the form i have is my form class leads_form(forms.Form): assigned_to = forms.ChoiceField(choices=[(o.id, str(o.username)) for o in CustomUser.objects.all()],required=True,widget=forms.Select(attrs={'class':'form-control'})) ref = forms.CharField(max_length=50,required=False,widget=forms.TextInput(attrs={'class':'form-control'})) lead_type = forms.ChoiceField(choices=dicto.lead_type_dict.items(),required=True,widget=forms.Select(attrs={'class':'form-control slct'})) priority = forms.ChoiceField(choices=dicto.priority_dict.items(),required=True,widget=forms.Select(attrs={'class':'form-control slct'})) hot = forms.ChoiceField(choices=dicto.hot_dict.items(),required=True,widget=forms.Select(attrs={'class':'form-control slct'})) source = forms.ChoiceField(choices=dicto.source_dict.items(),required=True,widget=forms.Select(attrs={'class':'form-control slct'})) mls_lead = forms.ChoiceField(choices=dicto.true_false_dict.items(),required=True,widget=forms.Select(attrs={'class':'form-control slct'})) auto_imported = forms.ChoiceField(choices=dicto.true_false_dict.items(),required=False,widget=forms.Select(attrs={'class':'form-control slct'})) inquiry_date = forms.CharField(max_length=50,required=False,widget=forms.TextInput(attrs={'class':'form-control'})) lead_closed_date = forms.CharField(max_length=50,required=False,widget=forms.TextInput(attrs={'class':'form-control'})) created_by = forms.CharField(max_length=50,required=False,widget=forms.TextInput(attrs={'class':'form-control'})) property_id = forms.IntegerField(required=False,widget=forms.HiddenInput()) set_status = forms.ChoiceField(choices=dicto.set_status_dict.items(),required=True,widget=forms.Select(attrs={'class':'form-control slct','placeholder':'set status','required':'true'})) contact=forms.IntegerField(required=True,widget=forms.HiddenInput(attrs={'required':'true'})) and when i try to create object of model with validate form data it shows django.core.exceptions.ValidationError: ["'' value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format."] the way i create object is as follows if form.is_valid(): lead.objects.create( assigned_to=form.cleaned_data['assigned_to'], ref=form.cleaned_data['ref'], lead_type=form.cleaned_data['lead_type'], priority=form.cleaned_data['priority'], hot=form.cleaned_data['hot'], source=form.cleaned_data['source'], mls_lead=form.cleaned_data['mls_lead'], auto_imported=form.cleaned_data['auto_imported'], inquiry_date=form.cleaned_data['inquiry_date'], lead_closed_date=form.cleaned_data['lead_closed_date'], created_by=form.cleaned_data['created_by'], property_id=form.cleaned_data['property_id'], contact_id=form.cleaned_data['contact'])