Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django AD integration getting AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application:
In settings.py i have given these parameters AUTHENTICATION_BACKENDS = ( 'social.backends.azuread.AzureADOAuth2', ) SOCIAL_AUTH_AZUREAD_OAUTH2_KEY = 'xxxxxx-2d74-4d6a-9192-xxxxxxxxx' SOCIAL_AUTH_AZUREAD_OAUTH2_SECRET = 'xxxxxxxxBpMsu817qnattPRQI9hKLfdQ=' SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_TENANT_ID ='xxx50be-xx-4611-bc99-72dafxx' While login into the application it will redirect to Azure login page after enter the credentails am getting AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application: 'xxxxxx-2d74-4d6a-9192-xxxxxxxxx'. In Azure i have given the replay url as http://ipaddress:8080/login Please help me Is there any settings need to configure the application ? -
Django: Changing project folder / settings structure
I am currently trying to change from the default Django structure to that one. I now copied all the files in the new folders, but when running python manage.py runserver --settings=settings.local it shows the following in my terminal: Traceback (most recent call last): File "manage.py", line 16, in <module> execute_from_command_line(sys.argv) File "/Users/Marc/.local/share/virtualenvs/lumis-vJ5Odiz7/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/Users/Marc/.local/share/virtualenvs/lumis-vJ5Odiz7/lib/python3.6/site-packages/django/core/management/__init__.py", line 317, in execute settings.INSTALLED_APPS File "/Users/Marc/.local/share/virtualenvs/lumis-vJ5Odiz7/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__ self._setup(name) File "/Users/Marc/.local/share/virtualenvs/lumis-vJ5Odiz7/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup self._wrapped = Settings(settings_module) File "/Users/Marc/.local/share/virtualenvs/lumis-vJ5Odiz7/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/Users/Marc/.local/share/virtualenvs/lumis-vJ5Odiz7/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'settings' Can anyone see what I am doing wrong? -
Django get most recent value AND aggregate values
I have a model which I want to get both the most recent values out of, meaning the values in the most recently added item, and an aggregated value over a period of time. I can get the answers in separate QuerySets and then unite them in Python but I feel like there should be a better ORM approach to this. Anybody know how it can be done? Simplified example: Class Rating(models.Model): movie = models.ForeignKey(Movie) rating = models.IntegerField(blank=True, null=True) timestamp = models.DateTimeField(auto_now_add=True) I wish to get the avg rating in the past month and the most recent rating per movie. Current approach: recent_rating = Rating.objects.order_by('movie_id','-timestamp').distinct('movie') monthly_ratings = Rating.objects.filter(timestamp__gte=datetime.datetime.now() - datetime.timedelta(days=30)).values('movie').annotate(month_rating=Avg('rating')) And then I need to somehow join them on the movie id. Thank you! -
Django generating spreadsheet with right extension
I have these lines below to generate a spreadsheet response = HttpResponse(content_type='text/xlsx') file_name = ('filename=%s.xls' % datetime.datetime.now()) response['Content-Disposition'] = ('attachment;%s' % file_name) writer = csv.writer(response, delimiter=';') The file extension does not open as xlsx, but rather as csv. ideas? -
Django - URL with www is not safe
I have website as bukimlan.com. We set default site as shown https://bukimlan.com. There is no problem with this url. We have SSL and secure. But if user comes with https://www.bukimlan.com URL, there is a not safe error in address line. And in mobile, google says your connection is not private with www url. Google indexed some pages with www, so we need to solve this problem. Thanks for your replies. -
Filtering reverse Django relationships using same kwargs for different instances of same model
I'm relatively new to Django and I was trying to build a chat server from ground up using Django 2.0.5. I just made the following models today. class DateTimeModel(models.Model): date_created = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) class Meta: abstract = True class Room(DateTimeModel): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) def __str__(self): return str(self.id) class RoomMember(DateTimeModel): room = models.ForeignKey(Room, on_delete=models.PROTECT, related_name='members') user = models.ForeignKey(User, on_delete=models.PROTECT) def __str__(self): return 'member "{}" in room "{}"'.format(self.user, self.room) class Message(DateTimeModel): sender = models.ForeignKey(RoomMember, on_delete=models.PROTECT) text = models.TextField() def __str__(self): return '"{}" sent by "{}"'.format(self.text, self.sender) Now I want to be able to run a query for a room given that I have a list of users. I tried the Q() objects from Django docs in the following way Room.objects.filter(Q(members__user=foo) & Q(members__user=bar)) but this yielded and empty QuerySet for me. Interestingly, if I search for Room.objects.filter(Q(members__user=foo)) only, then I get a QuerySet of all Rooms that contain the certain user foo. But this filtering is not specific enough for my needs. So I assume that this is not the right way to do it. Could anyone please point me to the right resource or suggest another approach if there is one? I'm using SQLite if that helps in … -
Best approach to update django project, track updates
I have a Django project, already hosted. the project contains lots of functionalities. Sometimes, when I update a part of the project, I don't remember where these updates might affect. Page 1 line 1: if obj.love_basket: line 2: up.fan = True # as well line 3: up.save() After months, I want to remove fan attribute and replace it with is_fan Page 2 line 4: class UserProfile: line 5: # fan = models.BooleanField() line 6: is_fan = models.BooleanField() This change will give an error in the future when a user hits line 2 This is just an example. How will I know where these changes may affect? -
How to set Model property, toggle a boolean in Django query?
Is it possible in my Detail view below, to set the boolean within a model to be false ? I looked through the django documentation (queryset) for something like a .set() method for this, it seems to exist but not applicable to this particular case. How can I toggle the unread boolean in my Models.py, through my view ? Also, what am I misunderstanding here and what is the better/appropriate way to do this ? Models.py: class Message(models.Model): recipient = models.ForeignKey(CustomUser, on_delete = models.CASCADE,related_name = 'recipient',null = True) sender = models.ManyToManyField(CustomUser,related_name = 'messages') date = models.DateTimeField(auto_now_add=True, blank=True) subject = models.CharField(max_length = 1000, blank = True) message = models.TextField(blank=True, null=True) unread = models.BooleanField(default = True) Views.py : ### Message detail class class MessageInboxDetail(DetailView): ''' This view lets the user view the details of a message created ''' context_object_name = 'message_detail' model = Message template_name = "myInbox/message_detail.html" def get_context_data(self, **kwargs): context = super(MessageInboxDetail, self).get_context_data(**kwargs) context.update({ 'message_detail': Message.unread.set(False) }) # Message(unread=True/False) return context -
return Render() to if statement
I want to render according to the state of the GET variable coming from the page. For example; def example(request): id = request.GET.get('id') if(id == None): return render(request, 'example.html', { 'bla': bla }) else: return render(request, 'example.html', { 'bla_bla': bla_bla }) -
Use passed parameter as a value in query string in django
Is it possible to use a passed parameter as a value in a django query string? So, let's pretend I want to search for specific terms (in term_list) in different fields, like username, display_name or name. Instead of doing this multiple times: q1_username = Q(username__icontains=term_list[0]) q1_email = Q(email__icontains=term_list[0]) q2_username = Q(display_name__icontains=term_list[0]) q2_email = Q(e_mail__icontains=term_list[0]) q3_username = Q(name__icontains=term_list[0]) q3_email = Q(emailaddress__icontains=term_list[0]) I want to be able to do this in a more generic way for different cases: q1_username = "display_name" q1_email = "emailaddress" q1 = build_query(term_list, q1_username, q1_email) def build_query(term_list, passed_username, passed_email): q_username = Q(insert_passed_username_here__icontains=term_list[0]) q_email = Q(insert_passed_email_here__icontains=term_list[0]) # ... return query If I try it like that, I get, not surprisingly, the following error message: Cannot resolve keyword 'insert_passed_username_here' into field. How can I use the passed_username and passed_email to replace the insert_passed_username_here and insert_passed_email_here in the function? -
'tuple' object has no attribute 'get' while trying to send an email using Django
I'm trying to send an email from a Django view, the email is being sent But it redirects me to this error 'tuple' object has no attribute 'get' after submitting the form. here are my codes : forms.py where the used form is created: class AdPostForm(forms.ModelForm): title = forms.CharField( widget=forms.TextInput( attrs={ 'class': "form-control input-md", 'placeholder': "Write a suitable title for your ad", 'required': "true", } ) ) description = forms.CharField( widget=forms.Textarea( attrs={ 'class': "form-control", 'placeholder': "Describe what makes your ad unique", 'rows': "4", } ) ) price_salary = forms.IntegerField( widget=forms.NumberInput( attrs={ 'class': "form-control", 'placeholder': "Item Price", } ) ) contact_email = forms.EmailField(required=False) contact_number = forms.IntegerField(required=False) category = forms.ModelChoiceField(queryset=Categories.objects.all(), widget=forms.Select( attrs={ 'onchange': 'shownego()', } ) ) negotiable_price = forms.BooleanField(required=False, widget=forms.CheckboxInput( attrs={ 'onclick': 'nego();', } ) ) class Meta: model = AdPost fields = ['title', 'category', 'location', 'description', 'price_salary', 'negotiable_price', 'featured_image', 'contact_email', 'contact_number'] the model.py where the model that the form is connected to : class AdPost(models.Model): title = models.CharField(max_length=255, blank=True, null=True) category = models.ForeignKey(Categories, on_delete=models.CASCADE, related_name='post_ad_category', blank=True, null=True) location = models.ForeignKey(Location, on_delete=models.CASCADE, related_name='post_ad_location') description = models.TextField(blank=True, null=True) price_salary = models.IntegerField(default=1, null=True, blank=True) negotiable_price = models.BooleanField(default=False) featured_image = models.ImageField(upload_to=content_file_name, null=True, blank=True) is_active = models.BooleanField(default=False) created_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='post_add_created', blank=True, null=True) created … -
Django REST Framework - Social Authentication (Facebook, Twitter, etc.)
I'm building REST APIs for a platform where we have iOS, Android and Web apps as clients. Users can register normally via the Django APIs, so authenticate using their credentials or they can sign in to their Facebook or Twitter account using OAuth. I started using django-rest-framework-social-oauth2 to speed up the development of the social login part. The part that I don't understand is related to the URL callback (or URL redirect) pointing back to the server-side Django app. What URL callback should I provide? Is there already an implemented view out-of-the-box from django-rest-framework-social-oauth2? Also, is there a better package available for DRF to be used for the authentication of big projects? -
how to upoload file from django project to azure server
I want to upload a file from my Django project to azure server on particular folder. is it possible? I have server 10.11.12.13 . i want to copy a file from local to test folder in E drive(10.11.12.13) please help. thanks -
Django - fetching data from the different table to be shown in admin, getting the error 'NoneType' object has no attribute 'user'
I am beginner for the Django. I am trying to make the admin page in which I want to show the columns(user) from the table(BillingProfile) which is the foreign key to the Order Table. I have created the order model as shown below. Order Model class Order(models.Model): billing_profile = models.ForeignKey(BillingProfile, null=True, blank=True) order_id = models.CharField(max_length=120, blank=True) # AB31DE3 shipping_address = models.ForeignKey(Address, related_name="shipping_address",null=True, blank=True) billing_address = models.ForeignKey(Address, related_name="billing_address", null=True, blank=True) cart = models.ForeignKey(Cart) def __str__(self): return self.order_id The BillingProfile model is as shown below. BillingProfile Model class BillingProfile(models.Model): user = models.OneToOneField(User, null=True, blank=True) email = models.EmailField() active = models.BooleanField(default=True) def __str__(self): return self.email And the Code for the Admin Page is as below. admin.py class OrderAdmin(admin.ModelAdmin): list_display = ['__str__', 'billing_profile','get_user'] class Meta: model = Order def get_user(self, obj): return obj.billing_profile.user admin.site.register(Order,OrderAdmin) When I am trying to get the user of a specific Billing profile then I am getting the error of 'NoneType' object has no attribute user. this might be due to the fact that few rows of Order table is empty. Can't I show the users of the remaining Rows? -
Django template is not changed after update (possible cache)
I have a problem with Django. Possibly with it's cache. Version 1.11 I use template in urlpatterns like : urlpatterns = [ url(r'^service_preview/', include(serviceprev_urls, namespace = 'service_preview')), url(r'^service_preview/',TemplateView.as_view(template_name='service_preview.html')), ] After a lot of updates, applied to my template, the cnahges stop appearing in user's browser. I have actual template in my templates folder and some previous version when preview source code in browser. If i rename template (this should raise error because template is absent), i still have that previous template in browser source. Browser page refreshing, clear browser cache etc does not help. There are no duplicates of this page in my template folder. When i use another template, all ok. Possibly, problem is in django cache. I don't know how to force clear cache, maybe it would be a solution. I put this at app setting file, but it doesn't helps. CACHES = {'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache',}} Please, help me with solving problem -
python3 django-admin syntax error
trying to learn python/django. after installing all the bits and pieces getting this error (see list). please point into right direction. thank you! $ django-admin startproject test1 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/bin/django-admin", line 11, in load_entry_point('Django==2.1', 'console_scripts', 'django-admin')() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/init.py", line 561, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/init.py", line 2627, in load_entry_point return ep.load() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/init.py", line 2287, in load return self.resolve() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/init.py", line 2293, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/init.py", line 11, in from django.conf import settings File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/conf/init.py", line 18, in from django.utils.functional import LazyObject, empty File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/utils/functional.py", line 12 return _curried_func(*args, *moreargs, **{**kwargs, **morekwargs}) ^ SyntaxError: invalid syntax Python 3.5.0a4 (v3.5.0a4:413e0e0004f4, Apr 19 2015, 14:18:20) [GCC 4.2.1 (Apple Inc. build 5577)] on darwin Type "help", "copyright", "credits" or "license" for more information. import django print(django.get_version()) 2.1 -
OSError-Error reading C:\Users\...\reactifydjango\webpack-stats.dev.json. Are you sure webpack has generated the file and the path is correct?
I have referred this blog: [http://v1k45.com/blog/modern-django-part-1-setting-up-django-and-react/][1] Getting the above error while integrating django-react. There is no such file as webpack-stats-dev.json in any directory. Thanks in advance. -
wsgi:warn between apache and python
I ran a django project by apache but got "Internal Server Error" so i checked error.log and got a error code: [wsgi:warn] Target WSGI script '/var/www/shop/shop/wsgi.py' cannot be loaded as Python module. I tried to fix this by 3 steps: 1. sudo apt-get remove libapache2-mod-wsgi 2. pip install mod_wsgi 3. mod_wsgi-express module-config but i don't know how to add the information of config to Apache configuration. I was using Ubantu, so there is no file name "httpd.conf" in Apache, i tried to insert the information of mod_wsgi config into the file"000-default" but it didn't work and return a error when i restart apache: "caught sigterm shutting down" I tried to remove the code that i added and restart again, but i got an other error: "Job for apache2.service failed because the control process exited with error code." I'm so confused, may somebody save me from the mess? -
Django DB router : Selection on class name
I have in my Django project an app with two database. So far I've done a router like this : Router Django. My problem is that in the exemple they differ cases with the model app name : model._meta.app_label But because all of my concerned models are in the same app I can't make the difference like this. My question : Can I make the difference on the model class name ? With something like : model._meta.class_name This way I could tell the database to use for every concerned models. Thanks in advance for your help ! -
Django Formsets adds extra instances
I am building an app in which a user can add a good shipment. Each Shipment(DDT_IN) has several items (DDT_IN_Item), each related to the shipment. When I try to create a formset to add and modify those shipments, the formset renders empty fields that aren't supposed to be there. These are the models: class ddt_in(models.Model): class Meta: verbose_name = 'Bolla In' verbose_name_plural = 'Bolle In' data = models.DateField() numero = models.CharField(max_length=50) fornitore= models.ForeignKey(laboratori,on_delete=models.CASCADE) quantita = models.IntegerField(null=True, blank=True, default=0) importo = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) doc_filename = models.FileField(upload_to="uploads/ddt_in/", blank=True, null=True) def __str__(self): return self.id class ddt_in_item(models.Model): class Meta: verbose_name = 'Bolla In Items' verbose_name_plural = 'Bolle In Items' ddt = models.ForeignKey(ddt_in,on_delete=models.CASCADE, null=True, blank=True) prodotti_var = models.ForeignKey(prodotti, on_delete=models.CASCADE, null=True, blank=True) quantita = models.IntegerField() costo_acquisto = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) iva = models.DecimalField(max_digits=5, decimal_places=2, null=True, blank=True) scade = models.DateField(null=True, blank=True) def __str__(self): return self.id These are the forms: class Ddt_inForm(forms.ModelForm): class Meta: model = ddt_in fields = ("data", "numero", "fornitore", "doc_filename") def clean_importo(self): data = self.cleaned_data.get("importo") return string_to_float(data) def __init__(self, *args, **kwargs): super(Ddt_inForm, self).__init__(*args, **kwargs) self.fields["fornitore"].queryset = laboratori.objects.filter(is_active=True) self.fields["fornitore"].widget.attrs.update({"class" : "m-select2 m-select2-lucy"}) self.fields["fornitore"].widget.attrs.update({ "style" : "width: 100%"}) self.fields["doc_filename"].widget.attrs.update({"class" : "custom-file-input"}) class Ddt_in_itemForm(forms.ModelForm): class Meta: model = ddt_in_item fields = ("prodotti_var", "quantita", "scade") def … -
django url regex to match optional parameters
I need a regex that should match the following strings: users/24 users/24/ users/24/sam users/24/sam/ users/24/sam/tab_name users/24/sam/tab_name/ where, pk=24, username=sam, tab=tab_name So far I have a url as: url(r'^users/(?P<pk>\d+)/(?P<username>[-\w\d]+)?/?(?P<tab>[-\w\d]+)?/?', vw.ProfileView.as_view(), name='profile') The above url matches everything above. But while using {% url 'profile' pk=24 username="sam" tab="tab_name" %} the output is : users/samtab_name I know the problem here i.e, /? optional slash. But I don't want it to be optional when using {% url 'profile' pk=24 username="sam" tab="tab_name" %} Help me with this. -
Django form validation : TypeError at /student/home conversion from dict to Decimal is not supported
I have a decimalfield in my model current_CGPA = models.DecimalField(blank=True,null=True,decimal_places=2,max_digits=4) I am using Modelform to validate my form class StudentAcademicsForm(ModelForm): class Meta: model = Student fields = ['current_CGPA'] I have used custom template for form rendering <label class="form-label" for="current_CGPA">CGPA upto previous semester</label> <input class="form-control" type="number" step="0.01" placeholder="CGPA" id="current_CGPA" name="current_CGPA" {% if student.current_CGPA is not None %}value="{{student.current_CGPA}}"{% endif %} required min=0 max=10/> {{form.current_CGPA.errors}} When i submit the request and validates form (like this) user = request.user student = Student.objects.get(user=user) if request.method == 'POST': form = StudentAcademicsForm(request.POST, instance=student) if form.is_valid(): form.save() else: form = StudentAcademicsForm() this error occurs: TypeError at /student/home conversion from dict to Decimal is not supported On going through stacktrace i found that get_attr() method on my field 'current_CGPA' returns all attributes of POST in the format { 'current_CGPA':3,... } I think its expected to return only the value '3' But this is something done by django built-in code So is it a bug? Has anyone used DecimalField before? If so then please correct me if I have done something wo Stacktrace is shown below: Environment: Request Method: POST Request URL: http://localhost:8000/student/home Django Version: 2.0 Python Version: 3.7.0 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'whitenoise.runserver_nostatic', 'django.contrib.staticfiles', 'gep_app.apps.GepAppConfig'] Installed … -
Django authentication with basic auth with LDAP support and no User model
This is my first Django project so please bear with me. I am creating a pure DRF project. My requirement is that the user will call the REST APIs while sending the user creds in basic auth format which I need to validate against a LDAP server. Also, each API with have the credentials sent and so I do not need to store the credentials at my end (in the default USER model) I was aiming to use : REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', ) } and INSTALLED_APPS = [ 'django.contrib.auth', } to be able to read the basic auth creds and then hoping to hook in: AUTHENTICATION_BACKENDS = [ 'django_auth_ldap.backend.LDAPBackend', ] to authenticate the user at LDAP server. questions: -- is there any better approach ? -- since I am only passing on the credentials to LDAP server to know if the creds are valid, I do not need the USER table in the database. I need it only for object modeling. How can I acheive this? would a Proxy model help? Can we have an abstract model as the AUTH_USER_MODEL? or using a remote user authentication backend a better option? -
Django: Context Processors and Class Based Views
I'm trying to include a form on certain pages to handle generating / emailing reports. # context_processors.py def sales_report_form(request): if request.method == 'POST': form = SalesPdfForm(request.POST or None) if request.user.email: if form.is_valid(): form.generate_pdf() messages.success(request, 'Report will be emailed to {} shortly.'.format(request.user.email)) else: messages.error(request, 'No email address set for {}'.format(request.user.username)) return redirect(request.path) else: return {'sales_report_form': SalesPdfForm()} The form is displayed on the pages but I'm having trouble posting Method Not Allowed (POST): /path/ "POST /path/ HTTP/1.1" 405 0 To allow posting I moved the logic to a mixin and add it to each view. Is this the correct way to handle posting of a context processor form in Class Based Views? class SalesReportMixin(object): """ CBV mixin to handle the generation of sales reports. """ def post(self, request, *args, **kwargs): if 'sales_report' in request.POST: form = SalesPdfForm(request.POST or None) if request.user.email: if form.is_valid(): form.generate_pdf() messages.success(request, 'Report will be emailed to {} shortly.'.format(request.user.email)) else: messages.error(request, 'No email address set for {}'.format(request.user.username)) return redirect(request.path) return super(SalesReportMixin, self).post(request, *args, **kwargs) -
Create dynamic model from string variable
I am new to Django so I am trying to create a dynamic model from a string variable. I have read that get_model can do the job but i get error 'module' object has no attribute 'get_model' . Any help please?. import test.models as mod str = "Campaign" entityObj = mod.get_model( str ,str )