Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Python "TypeError: view must be callable or a list/tuple in the case of include()" with urls
I'm getting a "TypeError: view must be callable or a list/tuple in the case of include()" for the subscribe url below for Weather_App/urls.py import signupform.urls import signupform.views as views app_name = "Weather_App" urlpatterns = [ url(r'^admin/', admin.site.urls, name='admin'), url(r'^subscribe/', signupform.urls, name='signup'), ] In my other urls file signupform/urls.py, I had a similar issue but fixed it using a views import from django.conf.urls import url from . import views as Weather_App_views urlpatterns = [ url(r'^$', Weather_App_views.index, name='index'), url(r'confirm/$', Weather_App_views.confirm, name='confirm'), ] -
How to populate django form , based on two ModelForm
I want my app users to be able to edit two forms using one html page , where these two forms will be populated with initial data from two related models,but i am not able to accomplish this result yet, models.py class User(AbstractUser): is_vendor = models.BooleanField(default=False) class Vendor(models.Model): user = models.OneToOneField(User) phone = models.CharField(max_length=15) forms.py class VendorProfileForm(forms.ModelForm): class Meta: model = Vendor fields = ['phone',] class UserForm(forms.ModelForm): class Meta: model = User fields = ['username','email'] views.py def Edit_Vendor_Profile(request, pk): # querying the custom User model . user = User.objects.get(pk=pk) if request.method == "POST": vendor_form = VendorProfileForm(request.POST,request.FILES, instance=user) user_form = UserForm(request.POST, instance=user) if vendor_form.is_valid() and user_form.is_valid(): vendor_form.save() user_form.save() return HttpResponseRedirect('/profile/') else: vendor_form = VendorProfileForm(request.POST,request.FILES, instance=user) user_form = UserForm(instance=user) return render(request, "accounts/update.html", {'vendor_form':vendor_form, 'user_form':user_form}) so the problem is that fields of user model are being populated fine but fields from Vendor model are not.so what that i am doing wrong, thank you very much in advanced . -
Can you save a new object over an existing object?
Let's say I have the following Listing model. I retrieve a listing and store that in old_listing, and set up a new one and store that in new_listing. Now is there some way to save new_listing into old_listing, basically overriding all fields except the auto-incrementing id field? class Listing(models.Model): street = models.CharField(max_length=500) old_listing = Listing.objects.get(id=1) # Assuming this record already exists new_listing = Listing(street='123 Main Street') old_listing.save(new_listing) # This obviously doesn't work -
"to" argument must be a list or tuple in Django
I have a bug like in subject of this question: "to" argument must be a list or tuple I want to create a email form and I can't find a error. Maybe someone help me? My files are: forms.py from django import forms class WyslijEmail(forms.Form): name = forms.CharField(max_length=25) subject = forms.CharField(max_length=255) email = forms.EmailField() message = forms.CharField(required=True, widget=forms.Textarea) views.py from django.shortcuts import render, redirect from django.core.mail import send_mail, BadHeaderError from .forms import WyslijEmail def kontakt(request): if request.method == 'GET': form = WyslijEmail() else: form = WyslijEmail(request.POST) if form.is_valid(): name = form.cleaned_data['name'] subject = form.cleaned_data['subject'] email = form.cleaned_data['email'] message = form.cleaned_data['message'] try: send_mail(name,subject,email,message, ['admin@gmail.com',]) except BadHeaderError: return render('Niewlasciwe cos tam') return redirect('sukces') return render(request,'bajki/kontakt.html', {'form':form}) def sukces(request): return render('Sukces udało sie') kontakt.html <form method="post"> {% csrf_token %} {{ form.as_p }} <p><input type="submit" value="Wyślij wiadomość"></p> </form> What I must define to fix this problem? -
Generic detail view needs object pk or a slug
But I already refer to primary keys, don't I? It says this error relates to: class CommentUpdate(UpdateView): model = Comment fields = ['body'] def form_valid(self, form): film = Film.objects.get(pk=self.kwargs['film_id']) comment = Film.objects.get(pk=self.kwargs['comment_id']) form.instance.user = self.request.user form.instance.film = film form.instance.comment = comment return super(CommentUpdate, self).form_valid(form) I am not sure once this issue is fixed if that code above will work but the view I have to create a comment does: class CommentCreate(CreateView): model = Comment fields = ['body'] def form_valid(self, form): film = Film.objects.get(pk=self.kwargs['film_id']) form.instance.user = self.request.user form.instance.film = film return super(CommentCreate, self).form_valid(form) My urls.py: path('<int:film_id>/comment/', views.CommentCreate.as_view(), name='add_comment'), path('<int:film_id>/comment/<int:comment_id>/', views.CommentUpdate.as_view(), name='update_comment'), model: class Comment(models.Model): # user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) film = models.ForeignKey(Film, on_delete=models.CASCADE) body = models.CharField(max_length=200) def get_absolute_url(self): return reverse('films:detail', kwargs={'pk': self.film.pk}) And html link I have: <a href="{% url 'films:add_comment' film_id=film.id %}">Leave a comment</a> <a href="{% url 'films:update_comment' film_id=film.id comment_id=comment.id %}">Update</a> -
Many errors on deploying local Django app to Heroku
This is my first time to use Heroku . I have gone through other questions , but I am facing multiple errors , eg. some are related to Procfile not able to get identified (i have done an echo too using other question ) and I am also confused about how my app's structure should be deployed . My Django App structure : Please ignore the /api directory - i am not using it all Current error : I am following these tutorials but I am totally confused about what is my App and what is my Django project . Currently my git repository starts from /wantedly . The project is working fine on local . I need step by step help on how to deploy my local django app to heroku . -
Return particular string from response
I am trying to return a particular string value after getting response from request URL. Ex. response = { 'assets': [ { 'VEG': True, 'CONTACT': '12345', 'CLASS': 'SIX', 'ROLLNO': 'A101', 'CITY': 'CHANDI', } ], "body": "**Trip**: 2017\r\n** Date**: 15th Jan 2015\r\n**Count**: 501\r\n\r\n" } This is the response which i am getting, from this I need only Date: 15th Jan 2015. I am not sure how to do it. Any help would be appreciated. -
What is the right way to create projects in Django ? (Folders)
Sorry for the weird question. I am creating a MMORPG Text browser game, and I feel like my project is wrong. I am creating a new app for everything I need (Account app, Menu app, Fight app). And when I browse Github, people only have like 5/6 folders while I'm at 20 currently. Where should I put my classes/forms/things normally ? Like, where should I have my fight system placed ? Thanks ! (Sorry for bad english) -
UpdateView in Django
I can successfully add a comment with the below code: views.py: class CommentCreate(CreateView): model = Comment fields = ['body'] def form_valid(self, form): film = Film.objects.get(pk=self.kwargs['film_id']) form.instance.user = self.request.user form.instance.film = film return super(CommentCreate, self).form_valid(form) class CommentUpdate(UpdateView): model = Comment fields = ['body'] def form_valid(self, form): film = Film.objects.get(pk=self.kwargs['film_id']) comment = Film.objects.get(pk=self.kwargs['comment_id']) form.instance.user = self.request.user form.instance.film = film form.instance.comment = comment return super(CommentUpdate, self).form_valid(form) urls.py: path('<int:film_id>/comment/', views.CommentCreate.as_view(), name='add_comment'), path('<int:film_id>/comment/', views.CommentUpdate.as_view(), name='update_comment'), models.py: class Comment(models.Model): # user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) film = models.ForeignKey(Film, on_delete=models.CASCADE) body = models.CharField(max_length=200) def get_absolute_url(self): return reverse('films:detail', kwargs={'pk': self.film.pk}) links in html file: <a href="{% url 'films:add_comment' film_id=film.id %}">Leave a comment</a> <a href="{% url 'films:update_comment' film_id=film.id %}">Update</a> As you can see, I have tried to add update functionality but at the moment when I click the update link and save a comment it creates a new instance rather than amending an existing one. -
ForeignKey admin link name
In my Django model, I have class PhotoComment(AbstractComment): photo = models.ForeignKey(Photo, on_delete=models.PROTECT, related_name='comment') I called it like this to distinguish from a PersonComment class defined in the same project. The URL in the admin page now looks like this: https://xxx.yyy/admin/people/personcomment/ I would love to have https://xxx.yyy/admin/people/comment/ instead. Is it possible? -
indexError at /xadmin/users/userprofile/1/update/
it's a error about xadmin. I can log in xadmin, but when I want to edit user profile, the error as below: this is what show me after checking users in xadmin. and enter image description here -
create Confusion matrix from prediction audio in python django
I'm working on a task to predict the sound, but I get the problem, I can not show the confusion matrix i want to show Confusion matrix from my prediction variable, How to do it? is there anyone who can help me? def creatematrix(request): if request.method == 'POST': myfile = request.FILES['sound'] fs = FileSystemStorage() filename = fs.save(myfile.name, myfile) uploaded_file_url = fs.url(filename) # load json and create model json_file = open('TrainedModels/model_CNN.json', 'r') loaded_model_json = json_file.read() json_file.close() loaded_model = model_from_json(loaded_model_json) # load weights into new model loaded_model.load_weights("TrainedModels/model_CNN.h5") print("Model restored from disk") sound_file_paths = filename # "22347-3-3-0.wav" parent_dir = 'learning/static/media/' sound_names = ["air conditioner","car horn","children playing","dog bark","drilling","engine idling","gun shot","jackhammer","siren","street music"] predict_file = parent_dir + sound_file_paths a = read(predict_file) output = np.array(a[1],dtype=float) predict_x = extract_feature_array(predict_file) test_x_cnn = predict_x.reshape(predict_x.shape[0], 20, 41, 1).astype('float32') loaded_model.compile(loss='categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy']) # generate prediction, passing in just a single row of features predictions = loaded_model.predict(test_x_cnn) # get the indices of the top 2 predictions, invert into descending order ind = np.argpartition(predictions[0], -2)[-5:] ind[np.argsort(predictions[0][ind])] ind = ind[::-1] c = sound_names[ind[0]], "(",round(predictions[0,ind[0]]),")" j = sound_names[ind[1]], " (",round(predictions[0,ind[1]]),")" jx = sound_names[ind[2]], " (",round(predictions[0,ind[2]]),")" jv = sound_names[ind[3]], " (",round(predictions[0,ind[3]]),")" jvt = sound_names[ind[4]], " (",round(predictions[0,ind[4]]),")" I really need help -
Django - What is settings.py for?
I was creating my Django application, so my project structure is just like the bottom example: I would like to know what is the settings.py for: -
Applying for advice for an important choice
I want to write a program that in terms of workload, it is similar to a telegram،That means the number of requests must be processed And answer the requests. Now, my question is which programming language is more suitable for the back end? for example Node.js Or django Or etc. thank you -
Trying to update user information from 2 forms in Django
So I have a student model which inherits from AbstractUser. I used 2 forms in one view for registration since I needed email, name and surname to be in my student database (as well as other fields). Now I'm trying to make an update profile view, with 2 forms that I made especially for updating the info. But I think I'm getting it wrong.. might need a little help here. I need the student to be able to update his email (which is from User model) and his photo, phone, name and surname (which are in Student model). <form method="POST" action="{% url 'profile_edit' %}" class="" > {% csrf_token %} {{ form.as_p }} <button type="submit">Save</button> </form> def profile_edit(request): user = request.user form1 = UserEditForm(request.POST or None, initial={'email': user.email, }) form2 = StudentEditForm(request.POST or None, initial={'name': user.student.name, 'surname': user.student.surname, 'phone': user.student.phone, 'photo': user.student.photo}) if request.method == 'POST': if form1.is_valid() and form2.is_valid(): user.email = request.POST['name'] user.student.name = request.POST['name'] user.student.surname = request.POST['surname'] user.student.phone = request.POST['phone'] user.student.photo = request.POST['photo'] user.save() return render(request, 'index.html') context = { "form1": form1, "form2": form2 } return render(request, "registration/profile_edit.html", context) class UserForm(forms.ModelForm): email = forms.EmailField(required=True) password = forms.CharField(label='Password', max_length=32, required=True, widget=forms.PasswordInput) confirm_password = forms.CharField(label='Confirm', max_length=32, required=True, widget=forms.PasswordInput, help_text="Passwords must match!") … -
Error: Reverse for 'detail_page' not found. 'detail_page' is not a valid view function or pattern name
I trying to create own page for each post(detail), but when I am launching page with all post, I have this error: Reverse for 'detail_page' not found. 'detail_page' is not a valid view function or pattern name. When I delete <a...> in <h3 class="name-detail"><a href="{% url 'detail_page' pk=detail.pk %}">{{ detail.detail }} для {{ detail.car }}</a></h3> all is working views.py: ... def porshe_cayenne(request): page = request.GET.get('page', 1) paginator = Paginator(Detail.objects.filter(car="Porsche Cayenne")[::-1], 20) images = DetailImage.objects.all() try: details = paginator.page(page) except PageNotAnInteger: details = paginator.page(1) except EmptyPage: details = paginator.page(paginator.num_pages) return render(request, 'shop/list.html', {'details': details, 'images':images}) def detail_page(request, pk): detail = get_object_or_404(Detail, pk=pk) images = DetailImage.objects.filter(detail=detail) return render(request, 'shop/detail.html', {'detail': detail, 'images':images}) list.html: ... <div class="infinite-container"> {% for detail in details %} <div class="background_detail"> <div class="detail"> <h3 class="name-detail"><a href="{% url 'detail_page' pk=detail.pk %}">{{ detail.detail }} для {{ detail.car }}</a></h3> #HERE IS PROBLEM <br> <h6>{{ detail.description }} <em class="fa fa-arrow-down"></em> Всі контакти внизу <em class="fa fa-arrow-down"></em></h6> <br> {% for img in images %} {% if img.detail == detail %} <img class="detail-foto" src="{{ img.image.url }}" /> {% endif %} {% endfor %} <br> <div class="price"> Ціна: {{ detail.price }} </div> </div> </div> {% endfor %} </div> ... urls.py: url(r'^porshe_cayenne/$', views.porshe_cayenne, name='porshe_cayenne'), url(r'^detail/(?P<pk>\d+)/$', views.detail_page, name='detail_page_plz'), … -
Passing data with CreateView in django
I am getting the error: NOT NULL constraint failed: films_comment.film_id On the comments page there is a form field called body for the comment itself, I also need it to store this comment against the user and the film. Models: from django.db import models from django.urls import reverse class Film(models.Model): title = models.CharField(max_length=200) director = models.CharField(max_length=200) description = models.CharField(max_length=200) pub_date = models.DateField('date published') def get_absolute_url(self): return reverse('films:detail', kwargs={'pk' : self.pk}) class Comment(models.Model): # user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) film = models.ForeignKey(Film, on_delete=models.CASCADE) body = models.CharField(max_length=200) Urls: app_name = 'films' urlpatterns = [ path('', views.IndexView.as_view(), name='index'), # path('<int:film_id>/comment', views.add_comment, name='add_comment'), path('<int:pk>', views.DetailView.as_view(), name='detail'), path('<int:film_id>/comment/', views.CommentCreate.as_view(), name='add_comment'), ] Link on details page for adding a comment: <a href="{% url 'films:add_comment' film_id=film.id %}">Leave a comment</a> comment_form.py: <form action="" method="post"> {% csrf_token %} {% include 'films/form-template.html' %} <button type="submit">Submit</button> </form> Form template: {% for field in form %} {{field.errors}} <label>{{ field.label_tag }}</label> {{ field }} {% endfor %} forms.py from django import forms from .models import Comment class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ('body',) -
LINE 1: SELECT (1) AS "a" FROM "django_session"
I've created an environment in MacOS. Django version 1.10.6. In Linux every thing is okay, but in MacOS I got this error: ProgrammingError at / relation "django_session" does not exist LINE 1: SELECT (1) AS "a" FROM "django_session" WHERE "django_sessio... ^ Request Method: GET Request URL: http://localhost:8000/ Django Version: 1.10.6 Exception Type: ProgrammingError Exception Value: relation "django_session" does not exist LINE 1: SELECT (1) AS "a" FROM "django_session" WHERE "django_sessio... An important thing is that I can't run migrates in "sites", only in each app. -
A DRYer solution to processing responsive thumbnails in Django template file
In order to display the appropriate image for a set of responsive breakpoints, I have put built a Context Processor that simply passes some Dicts with breakpoint and image resolution information. I then loop through these Dicts in order to generate responsive thumbnails as well as build the relevant CSS media queries. This solution works well for me now, but as I repeat this code on all template pages that need responsive imagery it becomes less and less DRY, yet I am not quite sure how I would abstract this functionality further. How can I make this thumbnail/responsive breakpoint-generating functionality more DRY? context_processors.py def thumbsizes(request): thumbsizes = { 'screensizes': [{ 'xs': '', 'sm': '796px', 'md': '1024px', 'lg': '1216px', 'xl': '1408px', }], 'hero': [{ 'xs': '600x827', 'sm': '900x400', 'md': '1200x400', 'lg': '1800x400', 'xl': '2400x400', }], 'main': [{ ... }], ... } return {"thumbsizes": thumbsizes} _hero.html {% with object.image as image %} {% with class_name=".c-hero" %} <style type="text/css"> {% for size in thumbsizes.hero %} {% for key, value in size.items %} {# Build thumbnail with value from size Dict #} {% thumbnail image value crop upscale subject_location=image.subject_location as thumb %} {# Do not apply media query for extra-small devices #} {% if … -
Conditional Django Model Creation
I am writing a app for django which i am planning to publish. This app requires a Bolean Setting variable CONSUMER_REGISTRATION. Aim of getting this variable is to decide whether to define ConsumerRegistrationModel or not. This is what I did. from django.db import models from django.conf import settings if getattr(settings, 'CONSUMER_REGISTRATION', False): class ConsumerRegistration(models.Model): ... Its working fine. The only Issue i am facing that developers will need to run makemigrations and migrate commands each time they change the variable in settings. 1- Can this work be automated ?. So if they change the variable then some code in django auto run the makemigrations and migrate commands. 2- Or is it perfectly fine to leave this work on developers ?? 3- Also I want to ask that is it a good aproach to do this in django ? -
Unclosed for tag in django. Looking for one of: empty, endfor
The error references {% for film in form %} not being closed in: form-template.html: {% for field in form %} {{field.errors}} <label>{{ field.label_tag }}</label> {{ field }} {$ endfor %} My comment_form.html: <form action="" method="post"> {$ csrf_token %} {% include 'films/form-template.html' %} <button type="submit">Submit</button> </form> urls.py: app_name = 'films' urlpatterns = [ path('', views.IndexView.as_view(), name='index'), # path('<int:film_id>/comment', views.add_comment, name='add_comment'), path('<int:pk>', views.DetailView.as_view(), name='detail'), path('<int:film_id>/add/$', views.CommentCreate.as_view(), name='add_comment'), ] -
Django error noneType
I need some help. I don't know why i got this error. What does it mean? I have this site into a virtual machine and is running inside a webserver platform. Is this maybe due to the fact that the site is not hosted directly? [26/Jan/2018 16:28:52] "GET /static/css/custom.css HTTP/1.1" 200 7346 Traceback (most recent call last): File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python3.4/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__ return super().__call__(environ, start_response) File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 146, in __call__ response = self.get_response(request) File "/usr/local/lib/python3.4/dist-packages/django/contrib/staticfiles/handlers.py", line 62, in get_response return super().get_response(request) File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 81, in get_response response = self._middleware_chain(request) TypeError: 'NoneType' object is not callable [26/Jan/2018 16:28:52] "GET /static/css/bootstrap.min.css.map HTTP/1.1" 500 59 Traceback (most recent call last): File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python3.4/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__ return super().__call__(environ, start_response) File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 146, in __call__ response = self.get_response(request) File "/usr/local/lib/python3.4/dist-packages/django/contrib/staticfiles/handlers.py", line 62, in get_response return super().get_response(request) File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 81, in get_response response = self._middleware_chain(request) TypeError: 'NoneType' object is not callable Thank you! -
Django - retrieve information if only it's needed
I'm looking at building a site where you have a detail view of an object, and more data about that object can be shown to the user by clicking to open a modal pop up box. I was wondering how, in Django, this data can only be loaded if the user chooses to open the modal box - otherwise there's no point in it being there. def detail_view(request): ... extra_data = Object.objects.all().values_list('rating', flat=True) # Only required if a user open the modal box return render(request, 'detail.html', {'extra_data':extra_data}) Any ideas on how this might be achieved whilst using as little JavaScript as possible? -
How to get the JSON on url the DJANGO REST API framework?
How to display the result json at URL https://api.vk.com/method/friends.get?user_id=2183659&count=10&fields=nickname,photo_100 As in the picture: P.S. Google Translate. -
Django 2.0 haystack whoosh update index, rebuild index throw error
I am using django 2.0 with haystack+whoosh as a search. I configured as it is said in the documentation. Occurred problem is when i run ./manage.py rebuild_index it shows this error: Traceback (most recent call last): File "./manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **cmd_options) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/django/core/management/base.py", line 335, in execute output = self.handle(*args, **options) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/management/commands/rebuild_index.py", line 36, in handle call_command('clear_index', **options) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/django/core/management/__init__.py", line 133, in call_command ', '.join(sorted(valid_options)), TypeError: Unknown option(s) for clear_index command: batchsize, workers. Valid options are: commit, help, interactive, no_color, nocommit, noinput, pythonpath, settings, skip_checks, stderr, stdout, traceback, using, verbosity, version. after that i tried update_index it shows me this error: File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 214, in handle self.update_backend(label, using) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 257, in update_backend commit=self.commit, max_retries=self.max_retries) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 84, in do_update backend.update(index, current_qs, commit=commit) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/backends/whoosh_backend.py", line 185, in update doc = index.full_prepare(obj) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/indexes.py", line 208, in full_prepare self.prepared_data = self.prepare(obj) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/indexes.py", line 199, in prepare self.prepared_data[field.index_fieldname] = field.prepare(obj) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/fields.py", line 205, in prepare return self.convert(super(CharField, self).prepare(obj)) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/fields.py", line 88, in prepare values = self.resolve_attributes_lookup(current_objects, attrs) File "/home/zorig/.virtualenvs/ftm/lib/python3.5/site-packages/haystack/fields.py", …