Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Delete links are not displayed for Django Formsets used together with django-dynamic-formset
I am following this tutorial which shows how to work with Formsets in Django. The tutorial uses django-dynamic-formset JQuery plugin which enables edition of formsets as in Django admin. Let's say I have following form: <form enctype="multipart/form-data" method="post"> {% csrf_token %} {% for place_form in places_formset %} <div class="place_formset"> <div class="required field"> <label>{{ place_form.name.label }}</label> <div class="ui icon input"> {{ place_form.name }} </div> </div> </div> {% endfor %} {{ places_formset.management_form }} <br> <button type="submit">Save changes</button> When I render the form I get "Add item" link which allows me to add another form to the formset.(means also that js and JQuery is loaded and working) but I don't see links which should remove each form. Here there is explanation about deletion of items from inline formsets but nothing is said about regular formsets. I have tried to include: {{ place_form.DELETE }} into the form thinking that django-dynamic-formset will replace all the rendered checkboex with "remove" links but it didn't happen. What else can I do? -
Django conditional where inside count statement
I've attempted to come up with the following model manager to annotate books to check whether they are available or not. Each book has many copies, and each book copy can many many Loans A book is said to be available if there are currently more unreturned loans than there are copies of the book. It won't become available again until a customer returns an outstanding loan. I've tried to express this in the following way class AvailableBookManager(models.Manager): def get_queryset(self): return super(AvailableBookManager, self).get_queryset()\ .annotate(num_copies=Count('copies'))\ .annotate(num_unreturned_loans=Count( Case( When( copies__loans__returned=False, then=Value(1) ), default=Value(0), output_field=models.IntegerField() ) ))\ .annotate( is_available=Case( When( num_unreturned_loans__gte=F('num_copies'), then=Value(False) ), default=Value(True), output_field=models.IntegerField() )) Ideally I'd be able to do the following to check whether books in my queryset are available or not Book.available.all().values('is_available') However I'm running into with my annotations, 'num_copies' and 'num_unreturned_loans' are the same for every Book in the queryset. >>> Book.available.all().order_by('-num_unreturned_loans').values('num_copies', 'num_unreturned_loans', 'is_available') <QuerySet [{'is_available': 0, 'num_copies': 4, 'num_unreturned_loans': 4}, {'is_available': 0, 'num_copies': 2, 'num_unreturned_loans': 2}, {'is_available': 0, 'num_copies': 2, 'num_unreturned_loans': 2}, '...(remaining elements truncated)...']> Despite there only being 2 unreturned loans: >>> Loan.objects.filter(returned=False).count() 2 I'm sure the issue lies inside the conditional count statement, and something is causing loans to be counted regardless of whether they … -
Sort a queryset in a particular situation - Django
I've this model: class Question(models.Model): user = models.ForeignKey(User) title = models.CharField(max_length=50, verbose_name='Titolo') text = models.TextField(verbose_name='Testo') category = TreeForeignKey(CoursesCategory, verbose_name='Categoria') created_at = models.DateTimeField(auto_now_add=True) and i've another model in another app: class Like(models.Model): user = models.ForeignKey(User) value = models.IntegerField(verbose_name='Voto') content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_pk = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_pk') Now, I should order, in the Question view, the questions queryset whit the relative value of Model Like. I'm trying to use this method def get_queryset(self): questions = Question.objects.all() questions = questions.annotate(ranking_vote=Coalesce(Sum(...), 0)).order_by('-ranking_vote') but I can not figure out what the solution. Can you help me.. -
admin/base_site not found django 1.4.13
I would like to install https://sourceforge.net/projects/bots/?source=directory on a windows machine. I installed the dependencies such as django==1.4.13 (newer versions give errors) but when I run bots_webserver.py, I get this: TemplateDoesNotExist(u'admin/base_site.html',) Traceback (most recent call last): File "C:\TLCC\Python27\lib\site-packages\cherrypy\wsgiserver\wsgiserver2.py", line 1302, in communicate req.respond() File "C:\TLCC\Python27\lib\site-packages\cherrypy\wsgiserver\wsgiserver2.py", line 831, in respond self.server.gateway(self).respond() File "C:\TLCC\Python27\lib\site-packages\cherrypy\wsgiserver\wsgiserver2.py", line 2135, in respond response = self.req.server.wsgi_app(self.env, self.start_response) File "C:\TLCC\Python27\lib\site-packages\cherrypy\wsgiserver\wsgiserver2.py", line 2337, in __call__ return app(environ, start_response) File "C:\TLCC\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__ response = self.get_response(request) File "C:\TLCC\Python27\lib\site-packages\django\core\handlers\base.py", line 190, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "C:\TLCC\Python27\lib\site-packages\django\core\handlers\base.py", line 226, in handle_uncaught_exception return callback(request, **param_dict) File "C:\TLCC\Python27\lib\site-packages\bots\views.py", line 30, in server_error return django.http.HttpResponseServerError(temp.render(django.template.Context({'exc_info':exc_info}))) File "C:\TLCC\Python27\lib\site-packages\django\template\base.py", line 140, in render return self._render(context) File "C:\TLCC\Python27\lib\site-packages\django\template\base.py", line 134, in _render return self.nodelist.render(context) File "C:\TLCC\Python27\lib\site-packages\django\template\base.py", line 823, in render bit = self.render_node(node, context) File "C:\TLCC\Python27\lib\site-packages\django\template\base.py", line 837, in render_node return node.render(context) File "C:\TLCC\Python27\lib\site-packages\django\template\loader_tags.py", line 101, in render compiled_parent = self.get_parent(context) File "C:\TLCC\Python27\lib\site-packages\django\template\loader_tags.py", line 98, in get_parent return get_template(parent) File "C:\TLCC\Python27\lib\site-packages\django\template\loader.py", line 145, in get_template template, origin = find_template(template_name) File "C:\TLCC\Python27\lib\site-packages\django\template\loader.py", line 138, in find_template raise TemplateDoesNotExist(name) TemplateDoesNotExist: admin/base_site.html -
Django ManagementForm data is missing or has been tampered with - validation error
I have a form on one of my Django webpages, which has a few 'text input' fields, and also has a button to allow a user to select an image file to upload. When the user has selected a file, that file is displayed on the form, ready to be uploaded when they click the 'Upload' button. However, I'm currently having an issue with the form submission when the 'Upload' button is clicked- when clicked, the console displays the output: ManagementForm data is missing or has been tampered with (< class 'django.core.exceptions.ValidationError' >) My thoughts are that I probably need to 'validate' the file that is being uploaded before the form can actually be submitted- is that right? If so, how would I do this? If not, what is causing this error? The template code for the part of the page displaying the form is: <form method="POST" enctype="multipart/form-data" data-vat-status="{{project.vat_status}}" data-view-url="{% url 'projects:concept_save_ajax_2' project.id %}" class="autosave_form formset full-width" action="{% url 'projects:upload_budget_pdfs' project.id %}"> {% csrf_token %} <div id="presentations" class="app-wrap center-apps middle"> {% with get|apps:'Budgets' as costing_app %} {% for presentation in presentations %} <div id="presentation-{{presentation.id}}" class="app sm {% if presentation.current_marker %}{{costing_app.color}}{% else %}{{app.color}}{% endif %}"> <a href="" class="filler"></a> <a class="show-presentation bottom-right" … -
How directory renaming happens in OS backend?
My machine contains a directory "Myfolder" and it has two children "file1.txt" and "file2.txt". Now I am renaming "Myfolder" to "yourFolder". What happens in the OS(any OS) backend? Will it copy paste children into a new directory and delete previous? or it just updates the name? -
saving ffmpeg output in a file field in django using tempfiles
I am trying to extract audio from video when uploaded, and store it in a different model. this is the task code: def set_metadata(input_file, video_id): """ Takes the file path and video id, sets the metadata and audio :param input_file: file url or file path :param video_id: video id of the file :return: True """ # extract metadata command = [FFPROBE_BIN, '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-select_streams', 'v:0', input_file] output = sp.check_output(command) output = output.decode('utf-8') metadata_output = json.loads(output) video_instance = Video.objects.get(pk=video_id) stream = metadata_output['streams'][0] tot_frames_junk = int(stream['avg_frame_rate'].split("/")[0]) tot_time_junk = int(stream['avg_frame_rate'].split("/")[1]) # update the video model with newly acquired metadata video_instance.width = stream['width'] video_instance.height = stream['height'] video_instance.frame_rate = tot_frames_junk/tot_time_junk video_instance.duration = stream['duration'] video_instance.total_frames = stream['nb_frames'] video_instance.video_codec = stream['codec_name'] video_instance.save() # extract audio tmpfile = tempfile.NamedTemporaryFile(suffix='.mp2') command = ['ffmpeg', '-y', '-i', input_file, '-loglevel', 'quiet', '-acodec', 'copy', tmpfile.name] sp.check_output(command) audio_obj = Audio.objects.create(title='awesome', audio=tmpfile) audio_obj.save() I am passing video object id and the file path to the method. The file path is a url from azure storage. The part where I am processing for metadata, it works and the video object gets updated. But the audio model is not created. It throws this error: AttributeError("'_io.BufferedRandom' object has no attribute '_committed'",) at command: audio_obj … -
Do I need to handle uploaded files manually if I use a ModelForm?
I have a model: class Dialogue(models.Model): ... avatar = models.ImageField(upload_to=conference_directory_path, blank=True) ... And a ModelForm for it: class CreateConferenceForm(forms.ModelForm): class Meta: model = Dialogue fields = ['name', 'participants', 'avatar'] ... My question is do I need to make a special function for handle uploaded avatar like: def handle_uploaded_file(file): with open(some_file_path, 'wb+') as destination: for chink in file.chunks(): destination.write(chunk) Or I can without fear simply use save method of ModelForm? And if I can't - where is better place for this function: in view or in forms? And how does it look - saving an avatar using handle function? At the beggining I handle an uploaded file using handle function and then how can this uploaded file be added to imagefield? -
How to send POST data to nested Serializer Django Rest Framework?
I am writing a sample program where tags can be added to todolist. So i created samples of tags. But when i am having trouble in adding that to The todo serializer. Here are the serializers i wrote. class TagSerializer(serializers.Serializer): id = serializers.IntegerField(read_only=True) name = serializers.CharField(required=False, max_length=100) def create(self, validated_data): return Tag.objects.create(**validated_data) class LocationSerializer(serializers.Serializer): id = serializers.IntegerField(read_only=True) latitude = serializers.CharField(max_length=100) longitude = serializers.CharField(max_length=100) def create(self, validated_data): return Location.objects.create(**validated_data) class ToDoSerializer(serializers.Serializer): id = serializers.IntegerField(read_only=True) work_id = serializers.CharField(max_length=100) tags = TagSerializer(many=True) location = LocationSerializer() I tried sending data to ToDo serializer as POST. But how can i send location and tag details to the API view. APIView class ToDoList(APIView): def post(self, request, format=None): serializer = ToDoSerializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) How can i pass data as POST to ToDoList. Do i have to write custom post view on ToDoSerializer? Models class Tag(models.Model): name = models.CharField(max_length=100) class Location(models.Model): latitude = models.CharField(max_length=100) longitude = models.CharField(max_length=100) class ToDo(models.Model): work_id = models.CharField(max_length=100) tags = models.ManyToManyField(Tag) location = models.ForeignKey(Location) -
is it possible to store form values in a drop down list in django
I am using django to make a questions application, I am allowing users to add questions to the site with a couple of optional answers for each question that are defined by the user who made the question. I am wanting to display the optional answers in a drop down box. but I keep getting an error from my model saying option one is not defined. choice modal class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) CHOICES = ( (option_one,option_one), (option_two,option_two), ) user_choice = models.CharField( max_length=200, choices=CHOICES, default=Yes, ) votes = models.IntegerField(default=0) def __str__(self): return self.user_choice view def create_poll(request): if request.method == 'POST': form = CreatePollForm(request.POST) if form.is_valid(): question = form.cleaned_data['question'] option_one = form.cleaned_data['option_one'] option_two = form.cleaned_data['option_two'] print option_one q = Question.objects.create(question_text=question) o = Choice.objects.create(question=q, option_one=option_one,option_two=option_two) q.save() o.save form = CreatePollForm() return render(request, 'polls/createPolls_form.html', {'form':form}) form = CreatePollForm() return render(request,'polls/createPolls_form.html',{'form':form}) forms.py class CreatePollForm(forms.Form): question = forms.CharField(max_length=100) option_one = forms.CharField(max_length=100) option_two = forms.CharField(max_length=100) -
Uncaught syntax error: unexpected string with json response
I'm getting an uncaught syntax error: unexpected string the chrome console when running ajax where I am trying to add a row to the bottom of a html table with the saved data returned with json. I really can't spot it.... function create_person() { console.log("create person is working!") $.ajax({ url : "{% url 'tande:create_person' %}", type: "POST", data: { first_name : $('#person-first-name').val(), surname : $('#person-surname').val(), email : $('#person-email').val(), coach_id : $('#person-coach-id').val(), is_coach : $('#person-is-coach').val(), position : $('#person-position').val(), contract_type : $('#person-contract').val()}, success : function(json) { $('#person-first-name').val(''); $('#person-surname').val(''); $('#person-email').val(''); $('#person-coach-id').val(''); $('#person-is-coach').val(''); $('#person-position').val(''); $('#person-contract').val(''); console.log(json); // ERROR OCCURS ON FOLLOWING LINE var html = '<tr><td>'+json.personid+'</td><td>'+json.personfirstname+'&nbsp;'+json.personsurname'</td><td>'+json.personposition+'</td><td>'+json.personcontract+'</td><td>'+json.personemail+'</td><td>'+json.personcoachid+'</td></tr>'; console.log("success"); $('div#talk').html(html); console.log(html) }, error : function(xhr,errmsg,err) { // $('#results').html("<div class='alert-box alert radius' data-alert>Oops! We have encountered an error: "+errmsg+ // " <a href='#' class='close'>&times;</a></div>"); // add the error to the dom console.log("uh oh"); } }); }; The data is saved successfully and the json object is returned to the console, I just can't display it. def create_person(request): if request.method == "POST": print "request post data in view" firstname = request.POST.get('first_name') print firstname lastname = request.POST.get('surname') emailadd = request.POST.get('email') coachid = request.POST.get('coach_id') isacoach = request.POST.get('is_coach') positionheld = request.POST.get('position') contracttype = request.POST.get('contract_type') response_data = {} starfruit = Person(first_name=firstname, surname=lastname, … -
Django ImportError: No module named tango_with_django_project.settings
From near the end of chapter 5 in the Tango With Django tutorial book, I have created a script used to populate a SQLite database with test data which is called: ~/Workspace/wad2/tango_with_django_project/populate_rango.py After receiving an error, I tried directly copy-pasting the script from the book and still received the following errors: H:\Workspace\wad2\tango_with_django_project>python populate_rango.py Traceback (most recent call last): File "populate_rango.py", line 7, in <module> django.setup() File "C:\Python27\lib\site-packages\django\__init__.py", line 22, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 53, in __ge tattr__ self._setup(name) File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 41, in _set up self._wrapped = Settings(settings_module) File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 97, in __in it__ mod = importlib.import_module(self.SETTINGS_MODULE) File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) ImportError: No module named tango_with_django_project.settings Here is the population script: import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tango_with_django_project.settings') import django django.setup() from rango.models import Category, Page def populate(): # First, we will create lists of dictionaries containing the pages # we want to add into each category. # Then we will create a dictionary of dictionaries for our categories. # This might seem a little bit confusing, but it allows us to iterate # through each data structure, and add the data to our models. python_pages = [ {"title": "Official Python Tutorial", "url":"http://docs.python.org/2/tutorial/"}, {"title":"How to Think … -
Troubles with sorl.thumbnail: when I changing the picture get error [Errno 2] No such file or directory
I use sorl.thumbnail in my project. For avatars of users too: {% thumbnail client.photo "190x223" crop="center" as im %} If I get the profile editing page, and select a new picture for the avatar and save the changes, then after the redirect to the profile page I get the error: [Errno 2] No such file or directory I checked in the traceback which files are requested. The picture file exist, file with resized image in cache exist. Where does this error? If immediately after receiving the error, I just reload the page, the error was not arise and avatar picture is already new. And this error does not occur again. Only the first time, after changing the image file. -
I want to iterate the objects in python using for loop
for example i am getting the records from the table i.e; loan = Loan.objects.filter(borrowerid=1) in loan i have multiple records and i want to iterate it,if i am using for loop only one reccord is iterating for example: loan = Loan.objects.filter(mail="p@gmail.com")(ex:in Loan table i have 2 records) for i in loan: name=i.bname city=i.city print "name" print "city" i did like this,but it is printing only 1 record values,how to get both of the record values -
Embedded C PWM dimmer to Django web app
I developed PWM Dimmer with MOSFET for 220V light in embedded C which work via GPIO pin and run on OpenWRT. This is low-level code( with register access). I have two push buttons over which I control brightness( connected on input GPIO pins, over which I can increase and decrease PWM frequency in program). I want to implement two buttons or scroll in Django web application over which I control brightness, instead over GPIOs. How i can embed this C program to Django web application and connect to web scroll or button? I am a beginner. But if that is such easy for you, please help for beginners and have understanding, because you were beginners once. Thank you very much. -
PythonAnywhere: TypeError __init__() got an unexpected keyword argument 'clientId'
I am trying to deploy my Django project through pythonAnywhere. So far, I run the command ./manage.py migrate ./manage.py runserver It returns no error. And when go my site, I can see my homepage as I normally see when I connect from localhost:8000 There are two input boxes for user to enter the type of food he wants (pizza or ice cream for ex.) and the location (city to look up) and result will be listed (pizza places in New York for example) I used Foursquare api to get the results. When I try from my localhost, everything works fine. But when I try to search from .pythonanywhere.com it gives an error and the weird thing is the error is changing its parameter although I did not change anything. The error : TypeError at / __init__() got an unexpected keyword argument 'clientId' Request Method: POST Request URL: http://jinxed.pythonanywhere.com/ Django Version: 1.10.5 Exception Type: TypeError Exception Value: __init__() got an unexpected keyword argument 'clientId' Exception Location: /home/jinxed/Foursquare-API-with-Django/indexapp/views.py in index, line 37 Python Executable: /usr/local/bin/uwsgi Python Version: 3.4.3 Python Path: ['/var/www', '.', '', '/var/www', '/home/jinxed/.virtualenvs/mysite-virtualenv/lib/python3.4', '/home/jinxed/.virtualenvs/mysite-virtualenv/lib/python3.4/plat-x86_64-linux-gnu', '/home/jinxed/.virtualenvs/mysite-virtualenv/lib/python3.4/lib-dynload', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/home/jinxed/.virtualenvs/mysite-virtualenv/lib/python3.4/site-packages', '/home/jinxed/Foursquare-API-with-Django'] Server time: Fri, 27 Jan 2017 14:20:45 +0300 and my views.py … -
Is it possible to use python to develop a CBT for time series analysis?
I was asked to use python (& django web-framework) to develop a Computer-based Exam for time series analysis. I don't know if it is possible because i am quite new to python programming. So threfore if it is possible to do this, how do i go about it? Any help / references / material is appreciated. Thanks -
Django FilteredSelectMultiple widget : navigate to selected object
using the FilteredSelectMultiple widget in the Django Admin, i wonder how i can go to view/edit a model selected in the list of selected objets. -
How to save model in django admin and stay on same model form
Im trying to add a new Object to a m2m field, im using django admin and it will open a form to add the new object model. The problem is, this is just a form and the model is not created yet so its impossible to get fields of this model ( I want the primary key but it doesnt have because the object is not added to the database yet). What i want to accomplish is to save the model as soon as the form initiates and still work on the same object and when the user clicks SAVE button it will update the object saved and not create a new one. class PrecoPorEpocaForm(forms.ModelForm): class Meta: model = Preco_por_epoca fields = ('epoca',) def __init__(self, *args, **kwargs): super(PrecoPorEpocaForm, self).__init__( *args, **kwargs) self.isntance.save() print self.instance.pk Calling self.instance.save() will add the object to the data base when the form is initialized but when adding the form it will create a new object because im not working on that instance anymore. I've tried to override with the save(commit=False) but it doesnt solve the problem because it doesnt add the object to the database thus im not able to get the primary key of … -
CSS Media query works on Mobile, but not Desktop
Been looking for an answer to my issue, but it seems that most people have my problem the other way around (works on desktop, but not mobile). Currently making a personal website using an html5up.net template, first deployed on github pages here: cyrusbatino.github.io Now I'm trying to learn django and deploy this website/blog onto heroku here: https://cyrusjan.herokuapp.com/. It works for desktop and mobile on github, but not on django/heroku. I've been playing around with the media queries, but I'm stumped. I can't seem to find a solution. Desktop: @media screen and (min-width: 737px) { Mobile: @media screen and (max-width: 736px) Meta Tag: <meta name="viewport" content="width=device-width, initial-scale=1" /> -
Change Djnago template table row from text to Forms Fields like in OpenErp
Bonjour tout le monde Désolé je vais poser la question en français car j'ai ne maîtrise bien l'anglais. Alors dans mon cas je veux créer avec Django un Template pour l'ajout d'une nouvelle Facture ok au niveau de la modification du ligne de facture pour modifier l'article j'ai besoin du code qui change les textes de TD de la ligne cliqué vers des champs de la Forme créer par django comme le cas sur odoo. Merci D'avance -
Is there any way to make an annotation in django, where I can make difference between timezone.now and other filed?
Is there any way I can do this in django? Notification.objects.filter( removable=Case( When(date_added__lte=timezone.now() - datetime.timedelta(hours=F('delete_after')), then=Value(1)), default=Value(0), output_field=IntegerField() ), ).delete() -
Django cookie setting
I am using Django - ldap authentication in my project . Once if the user is authenticated , i need to set a cookie and return as a response to the server . def post(self,request): userData = json.loads(request.body) username = userData.get('username') password = userData.get('password') oLdap = LDAPBackend() if username == "admin" and password == "admin": User_Grps = "AdminLogin" else: try: User = oLdap.authenticate(username=username,password=password) if User is not None: User_Grps = User.ldap_user.group_dns else: User_Grps = "Check your username and password" except ldap.LDAPError: User_Grps = "Error" return HttpResponse(User_Grps) How to add a cookie to the response and send it with a the User_Grps to the client -
trace method resulotion order at runtime
I am working on some code (not mine) and I try to instand it. It is a class-based-view of Django. There 16 classes in the inheritance tree. Here area the class according to inspect.getmro(self.__class__) foo_barcheck.views.barcheck.AdminListActionView foo_barcheck.views.barcheck.ListActionMixin djangotools.utils.urlresolverutils.UrlMixin foo.views.ListActionView foo.views.ContextMixin foo.views.fooMixin djangotools.views.ListActionView djangotools.views.ListViewMixin django.views.generic.list.MultipleObjectMixin django.views.generic.edit.FormMixin djangotools.views.DTMixin django.views.generic.base.TemplateView django.views.generic.base.TemplateResponseMixin django.views.generic.base.ContextMixin django.views.generic.base.View object I want to trace what happens if I call self.is_valid(). I want to see all is_valid() calls of these 16 classes. The ideal solution would look like this: result_of_is_valid, list_of_is_valid_methods = trace_method_calls(self.is_valid) I have no clue how to implement trace_method_calls(). It should execute the code and trace the method calls at runtime. Is there a tracing guru which knows how to do this? AFAIK this needs to be done at runtime, since I don't know if all methods calls the is_valid() of the parents via super(). -
Django 1.10 TemplateSyntaxError 'future' is not a registered tag library
I am using Django 1.10 and have this library installed 'nested_inline. I really need this lib however when I load the admin page it gives me the following error. TemplateSyntaxError at /masterproducts/product/add/ 'future' is not a registered tag library. Must be one of: admin_list admin_modify.... Also the stacktrace is as follows {% load i18n admin_static admin_modify %} {% load cycle from future %} <div class="inline-group{% if recursive_formset %} {{ recursive_formset.formset.prefix|default:"Root" }} -nested-inline{% if prev_prefix %} {{ prev_prefix }} -{{ loopCounter }}-nested-inline{% endif %} nested-inline{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-group"> {% with recursive_formset=inline_admin_formset stacked_template='admin/edit_inline/stacked-nested.html' tabular_template='admin/edit_inline/tabular-nested.html'%} <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}" id="{{ recursive_formset.formset.prefix }}"> {{ recursive_formset.formset.management_form }} <fieldset class="module"> <h2>{{ recursive_formset.opts.verbose_name_plural|capfirst }}</h2> {{ recursive_formset.formset.non_form_errors }} <table> <thead><tr> {% for field in recursive_formset.fields %}