Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Extending User fields in UserCreationForm
I am trying to add some custom fields to a user, and extend the UserCreationForm so that I can add these fields when the user is created. I am following the docs but when I try to load the page to create a user I get an error: Unknown field(s) (username) specified for Customer. The docs that I am following: Custom User and Auth Forms models.py class User(AbstractUser): is_restaurant = models.BooleanField(default=False) is_customer = models.BooleanField(default=False) class Customer(models.Model): user = models.OneToOneField(User, primary_key=True, on_delete=models.CASCADE) address = models.CharField(max_length=200) def __str__(self): return self.user.get_full_name() forms.py class CustomerSignUpForm(UserCreationForm): class Meta(UserCreationForm.Meta): model = Customer fields = UserCreationForm.Meta.fields + ('address',) I understand that username is not part of the Customer class, but the docs appear to be doing the same thing... -
opencv function to save image to a memory object buffer instead of file (imwrite)
Currently, I have an image in opencv that is processed. Using imwrite(), I am able to save it to a file. cropped_resize = cv2.resize(cropped_image, (0,0), fx=float(s)/cropped_image.shape[0], fy=float(s)/cropped_image.shape[0]) cv2.imwrite("test.png",cropped_resize) <--- this is where i want to store in an image object I am writing a Django web app, and I dont want it to save to a file everytime for performance issue. I am actually going to upload the image to AWS S3. Through REST API, I upload the image this way https://github.com/ageitgey/face_recognition/issues/324 FYI, Im using imdecode() for converting raw image to cv2. im_cv = cv2.imdecode(np.fromstring(im_obj.read(), np.uint8), cv2.IMREAD_UNCHANGED) How can I do it viceversa? I would prefer to store it in a memory object and then upload it to S3 therefore this object is to assign to Django ImageField. What is the opencv function to do this (meaning store in an image object) instead of imwrite() ? My initial thoughts for the solution is probably using imencode() ? -
why "django.forms.widgets has no attribute RadioFileRender" excetpion occured?
I am a newbie to django and djangocms , when i try to install djangocms's addon aldyrn_bootstrap3 ,my command is python manage.py migrate aldryn_bootstrap3 the following error shows es\aldryn_bootstrap3\models.py", line 26, in <module> from . import model_fields, constants File "C:\Users\shikw\AppData\Local\Programs\Python\Python36-32\lib\site- packages\aldryn_bootstrap3\model_fields.py", line 26, in <module> from . import fields, constants File "C:\Users\shikw\AppData\Local\Programs\Python\Python36-32\lib\site- packages\aldryn_bootstrap3\fields.py", line 8, in <module> from . import widgets, constants File "C:\Users\shikw\AppData\Local\Programs\Python\Python36-32\lib\site- packages\aldryn_bootstrap3\widgets.py", line 10, in <module> class ContextRenderer(django.forms.widgets.RadioFieldRenderer): AttributeError: module 'django.forms.widgets' has no attribute 'RadioFieldRender er' Django (1.11.10) django-cms (3.5.0) i seems that 'RadioFieldRender' has been removed. can somebody help me -
Django URL conf gives a HTTP 405 Error
So i have two very similar endpoint URLs: url(r'^users/(?P<username>.+)/$', user_detail, name='user_detail'), url(r'^users/(?P<username>.+)/followers/$', follow_view, name='follow'), In that order, i get a HTTP 405 (Method Not Allowed), but when the order is changed (/followers on top) i dont get the error, but i get it now in the second endpoint. The respective api_views have the respective allowed method list, for example: @api_view(['POST', 'GET', 'DELETE']) @authentication_classes((BasicAuthentication,)) @permission_classes((IsAuthenticated,)) def follow_view(request, username, format=None): What can i do to make this URL Conf work? Thanks! -
Django: Key (slug)=(*) already exists
I'm pretty new to Django and python and I'd like to learn more about how to populating my Postgres database. Here is my current model:models.py from django.template.defaultfilters import slugify class Skill(models.Model): name = models.TextField() slug = models.TextField(unique = True) def __unicode__(self): return "%s" % self.name` and my views:views.py `r = r.json() try: Skills = r['data']['skills'] except: pass for skill in Skills: skill = Skill.objects.create(name=skill['name'],slug=slugify(skill['name'])) I'm getting the error: Exception Type: IntegrityError DETAIL: Key (slug)=(systems-engineering) already exists. I've been reading a similar post although still haven't been able to solve my problem. objects.create() will shows an error when the object already exists in the database, but I was getting error with the code above. Could "unique = True" be causing the error? and how do you fix this? -
How to test a Django custom filter?
This question is similar to Testing a custom Django template filter, but unlike in that example, the filter is actually defined in a module in the templatetags directory as described in https://docs.djangoproject.com/en/2.0/howto/custom-template-tags/#writing-custom-template-filters. Here is the filter code in templatetags/label_with_classes.py: from django import template register = template.Library() @register.filter(is_safe=True) def label_with_classes(bound_field): classes = f"{'active' if bound_field.value() else ''} {'invalid' if bound_field.errors else ''}" return bound_field.label_tag(attrs={'class': classes}) Here is my first stab at a test for it: from ..templatetags.label_with_classes import label_with_classes from django.test import SimpleTestCase from django.template import Context, Template from ..forms.sessions import SessionForm class CustomFilterTest(SimpleTestCase): def test_1(self): form = SessionForm(data={}) self.assertFalse(form.is_valid()) self.assertEqual( form.errors, {'session_number': ['This field is required.'], 'family': ['This field is required.'], 'session_type': ['This field is required.']}) template = Template('{{ form.session_number|label_with_classes }}') context = Context({'form': form}) output = template.render(context) The problem is that I get an error that the filter was not found: django.template.exceptions.TemplateSyntaxError: Invalid filter: 'label_with_classes' This is because the test case doesn't mimic the behavior of registering the filter and loading it in the template. It seems like in the Django source code, for example https://github.com/django/django/blob/master/tests/template_tests/filter_tests/test_join.py, there is an elaborate setup decorator which provides the test class with a self.engine whose render_to_string method has the required filters already installed. … -
i am trying to create a website with python and django and i am not able to run my server and i tired everything
PS C:\Users\jared\Desktop\django.website> cd mysite PS C:\Users\jared\Desktop\django.website\mysite> python manage.py runserver Performing system checks... Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000028B7237D7B8> Traceback (most recent call last): File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run self.check(display_num_errors=True) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 364, in check include_deployment_checks=include_deployment_checks, File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 351, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\checks\registry.py", line 73, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\checks\urls.py", line 40, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\checks\urls.py", line 57, in _load_all_namespaces url_patterns = getattr(resolver, 'url_patterns', []) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\functional.py", line 36, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\urls\resolvers.py", line 536, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\functional.py", line 36, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\site-packages\django\urls\resolvers.py", line 529, in urlconf_module return import_module(self.urlconf_name) File "C:\Users\jared\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, 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 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 719, in exec_module File "<frozen importlib._bootstrap_external>", line 855, in get_code File "<frozen importlib._bootstrap_external>", line 786, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed **File "C:\Users\jared\Desktop\django.website\mysite\mysite\urls.py", line 22 ] ^ SyntaxError: … -
Django template onclick inline html javascript alternative
I read that using onclick is deprecated and bad practice. I have this do_something function that will proccess the data inside of onclick. How I can convert this to javascript: {% for user in all_user %} <tr> <td>{{ user.code }}</td> <td> <button type="button" onclick="do_something('{{ user.name }}', '{{ user.age }}', 1, '{{ user.desc }}');">small</h6></button> </td> </tr> {% endfor %} -
gaierror while using send_mail django
I'm running into a gaierror [errno 8] when using send_mail for a contact form on my website hosted on my linode server. This is what I have in the setting.py file: EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'example@domainhostedongsuite.com' EMAIL_HOST_PASSWORD = 'password' EMAIL_PORT = 587 EMAIL_USE_TLS = True The server is running apache 2, not sure if that has anything to do with it. Can someone help me out? -
Is it possible to use a block tag ({% block %}) from base html template two or more times in derived html file in Django
I want to be able to reuse the same block tag multiple times in derived html. something like: base.html <body> {% block panel %} # some basic panel structure inside this block {% endblock %} </body> derived.html {% extends base.html %} --first panel <div class="col"> {% block panel %} # override things like panel header {% endblock %} </div> --second panel <div class="col"> {% block panel %} # again override some panel stuff from base template {% endblock %} </div> Is there anyway i can achieve this in Django? -
Dajngo: access the string value in a forms.CharField WITHIN the ModelForm class
Within the Form class below, I let the user enter a street name, a number and a zipcode. class MeldingForm(forms.ModelForm): street = forms.CharField(max_length=256, help_text="Street: ") number = forms.CharField(max_length=10, help_text="Number: ") zip = forms.ChoiceField(choices=((34000, 'TownA'), (34001, 'TownB'), (34010, 'TownC'), (34012, 'TownD'))) I want to automatically extract the coordinates by using the values (strings) of these three fields. I defined a method get_closest_coords() which takes these 3 strings as arguments (and works very well in other occasions) and tried this WITHIN the class definition so I can assign the value to the coordinate variables. lat, lng = get_closest_coords(street.__str__(), number.__str__()) coord_lat = forms.FloatField(widget=forms.HiddenInput(), initial=lat) I have tried various ways to acces the string value of these fields, but none has worked for now... -
Integrating C++ video streaming application with django webframework
We are developing a simple video streaming application that will stream a single channel video over a private WiFi network. The c++ application(using OpenCV) that does the video processing will reside on a Linux server. The users will be able to view the videos live by logging on to the same Linux server using a web interface. The number of users logging onto will be less than 10 at a time. We would like to have the video streaming over the network to be encrypted. The Linux server running the application(both c++ part and django webserver are on one machine) is a standard PC grade machine. Here is a small block diagram {(C++ Image/video processing)--->(webserver)}=====PrivateWifi========> Users(less than 10) My questions are How do i send the video stream from C++ application to the Web server,Here i am planing to use Django webframework? Is it a good way to use Django in this situation?What would be the correct way to do it? Pointers on encrypting the video will be welcome? -
Adding a conditional class to a Django field's label
I'm trying to refactor a Django template which renders fields manually (cf. https://docs.djangoproject.com/en/2.0/topics/forms/#rendering-fields-manually). The labels are generated as follows: <label for="{{ field.id_for_label }}" class="{% if field.value %}active{% endif %} {% if field.errors %}invalid{% endif %}"> </label> where the field is looped over using {% for field in form %} ... {% endfor %}. I'm trying to refactor this by writing a custom filter (cf. https://docs.djangoproject.com/en/2.0/howto/custom-template-tags/#writing-custom-template-filters). So far I've come up with the following. In the templatetags directory, I've added a label_with_classes.py which reads from django import template register = template.Library() @register.filter(is_safe=True) def label_with_classes(value, arg): return value.label_tag(attrs={'class': arg}) which I use to replace the HTML above with {{ field|label_with_classes:"active"}} The problem is that this doesn't actually do what the original template does; it always labels it with the class "active" and doesn't implement the conditional logic. My question: is implementing this logic possible using a filter? What does the value input argument to the filter function actually represent, is it the field.value (as its name suggests) or the field itself? -
How do I write regEx to recognize when a string has anything but a-z 0-9?
I need to write a regex pattern for recognizing when a string has regex in it. I am parsing Django urls.py file to look at what the user has specified as routes. Then in my middleware I'm looking at request.path, and I want to check if the url passed was a url that uses regex or just normal characters. My thoughts are to intercept the regex url and then parse urls.py lines to determine where the incoming request url is tied to. That way if I have a url like: /users/{userid}/delete or /users/{userid} or /{userid} I would normalize the url so that /users/1139/delete would be /users/user/delete I want to use a regex expression to recognize when the django url is specified with regex or if its a normal path. This would be an example of a url with regex in it: articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<slug>[\w-_]+)/ This is a normal path /test/helloworld I just need to determine when it has regex in it and normalize it so metrics searches can be ran easier. Not sure how to write the regex to determine if the string line has regex in it because im parsing the urls file line by line, and im super bad at … -
django custom template tag - import model blog error
I am trying to import a model class called BlogDetails to use in my customised template tags page. Here is the structure of my app: appname (directory) -->core (directory) -->models.py (file) -->templatetags (directory) -->customised_template_tags.py (file) Here is the import message in the customised_template_tags.py file. This is the same structure of other import statements I have used in my view files: from appname.core.models import BlogDetails Here is the error message: from myapp.core.templatetags.customised_template_tags import absolute_static, alternative_file, \ File "C:\Users\me\desktop\appname\appname\core\templatetags\customised_template_tags.py", line 11, in <module> from appname.core.models import BlogDetails ImportError: cannot import name 'BlogDetails' I have re-started my development server and I have read this thread and followed the suggestions in the answer and I have also read the django docs. Can anyone suggest the solution to my issue? -
How to resolve Django migrate stuck?
After I tried to makemigrations/migrate a change (adding a default value to a DateTimeField for testing) on my MySQL database with Django 2.0.2 it run into an error as I formatted the date wrong. Now after removing the default value changing the default value removing the table and recreating the model python manage.py migrate still shows the following error (last line): django.core.exceptions.ValidationError: ["'02.02.2012' value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format."] Like I said: I allready changed my code to (excerpt): class Task(models.Model): uploaddate = models.DateTimeField(auto_now_add=True) and run makemigrations several times. Why does migrate keep on showing my former mistake and wont import the new attribute correctly? Is this possibly a bug? Can I sort of "reset" migrate? -
Saving data in the database with Django
I've been trying to save my POST data to the database using the ModelForm but I couldn't make it go there for some reason.When I try to send the forms the page is redirecting me to the right place however the DB is still empty.I am not sure what am I doing wrong. forms.py class AddProblem(forms.ModelForm): class Meta: model = problem fields = ('lat','lng','email','importance','description','images') models.py class problem(models.Model): lat = models.BigIntegerField() lng = models.BigIntegerField() email = models.EmailField(max_length=70,blank=True) importance = models.IntegerField(default=1) description = models.TextField() images = models.FileField(upload_to='images/') published = models.BooleanField() def __str__(self): return self.email views.py def addproblem(request): temp_name = 'google_api/addproblem.html' form = AddProblem(request.POST,request.FILES) if request.method == 'POST': if(form.is_valid()): form.save() form = AddProblem() return redirect('/') else: messages.error(request, "Error") context = { } return render(request, temp_name, context) urls.py urlpatterns = [ path('', views.index, name='index'), path('add/', views.addproblem, name='addproblem'), ] template <form action="/add/" method="POST"> {% csrf_token %} <div class="form-group"> <label for="">Lat:</label> <input class="form-control" id="lat" name="lat" disabled> </div> <div class="form-group"> <label for="">Lng:</label> <input class="form-control" id="lng" name="lng" disabled> </div> <div class="form-group"> <label for="">Емайл</label> <input type="email" class="form-control" id="email" placeholder="name@example.com" name="email"> </div> <div class="form-group"> <label for="">Важност</label> <select class="form-control" id="importance" name="importance"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> </select> </div> <div class="form-group"> <label for="">Описание на проблема.</label> <textarea class="form-control" … -
Displaying imagefield in Django without HTML
Hi everyone :) I am making a simple web server using Django where one of the fields in my model is an imagefield. I ask the user to upload an image and everything works: The user can select and image, and it gets saved into the location that I want it to. However, I do not know how to make it display. When I am on the web server, I can see the image link like this: image And I want to be able to click on the url and come to a page where I can see just the picture. However, when I click on the url right now, I am taken to the page I am currently on. It pretty much just reloads, but the url above has changed to the one I clicked on. # views.py class CreateView(generics.ListCreateAPIView): """This class defines the create behaviour of our REST Api""" queryset = BucketList.objects.all() serializer_class = BucketListSerializerPostOnly def perform_create(self, serializer): """Save the post data when creating a new bucketlist""" serializer.save() def image_upload(request): if request.method == 'POST': form = BucketListSerializer(request.POST, request.FILES) if form.is_valid(): m = BucketList.objects.get(pk='ID') m.model_pic = form.cleaned_data['image'] form.save() return #urls.py (not the main one, just the on in this … -
One-To-Many and Individual in Django
I've customized the django user object as follows, class User(AbstractBaseUser): mobile = models.CharField(max_length=100, unique=True) email = models.EmailField(max_length=255) username = models.CharField(max_length=255) full_name = models.CharField(max_length=255, blank=True, null=True) staff = models.BooleanField(default=False) admin = models.BooleanField(default=False) root = models.BooleanField(default=False) I also have a feed and a Source object, which has a one-to-many relationship. class Source(Base): name = models.CharField(max_length=255) class Feed(Base): headline = models.CharField(max_length=255) link = models.CharField(max_length=255) summary = models.TextField() published_date = models.DateTimeField() views = models.IntegerField(default=0) shares = models.IntegerField(default=0) source = models.ForeignKey(Source, on_delete=models.CASCADE,) Now I want to simulate a bookmarking action and thus associate many feeds with one user. How do I do that in Django. -
Avoid automatic ordering when concatenating two Django querysets
I am trying to return a queryset in Django to create a list for a view with it. Having the entries for a model indexed with id's from 1 to n (the id's correlate with creation datetimes, but let's not rely on this too much), my goal is to display the first entry as first in the resultant list, but order the rest of the list reversely -- from the most recent, i.e. with the highest id number to the lowest (so id=2 should be the last one). For now I have something like this: class ModelLC(generics.ListCreateAPIView): queryset = Model.objects.filter(id=1) aux_queryset = Model.objects.exclude(id=1).order_by('-created') queryset = queryset | aux_queryset serializer_class = ModelSerializer def perform_create(self, serializer): serializer.save(owner=self.request.user) (id is the index column and created is the datetime field with creation timestamp.) Upon joining the queries together the result inherits the sorting order and no matter how I rewrite it, the query, when it is actually executed, looks the same and the result is sorted by creation time in reverse order, which makes the id's also go from highest to lowest. Is it at all possible to force the query result to be "glued together" in such a weird way, but at the … -
Django - queryset output formatting
I am fairly new to Django, ran into the following problem: I have a model FundPrice storing daily prices of particular funds. I would like to retrieve this from a database and pass to a js based chart. views.py from django.shortcuts import render from fundmgmt.models import FundPrice def fund_details_cards(request): fp = list(FundPrice.objects.values('fund_id','value_date','price')) return render(request,"fundmgmt/fund_detail_cards.html", {'fund_prices': fp}) In my template, by using {{ fund_prices }} reference, the result I get is the following: [{'fund_id': 1, 'value_date': datetime.date(2016, 11, 9), 'price': Decimal('2.574557')}, {'fund_id': 1, 'value_date': datetime.date(2016, 11, 8), 'price': Decimal('2.572507')}, {'fund_id': 1, 'value_date': datetime.date(2016, 11, 7), 'price': Decimal('2.571724')}] Can I somehow format this output? E.g. get rid of these datetime.date(, Decimal( field type indicators? What I would like to print is the following: [{'fund_id': 1, 'value_date': '2016-11-09', 'price': '2.574557'}, {'fund_id': 1, 'value_date': '2016-11-08', 'price': '2.572507'}, {'fund_id': 1, 'value_date': '2016-11-07', 'price': '2.571724'}] -
LookupError: 'base64' is not a text encoding; use codecs.decode() to handle arbitrary codecs
Its showing error LookupError: 'base64' is not a text encoding; use codecs.decode() to handle arbitrary codecs. Last few lines when the execution stops are - thumbnail = resize(photo_data, 200, 200) File "/home/anurag/photoshare/app.py", line 406, in resize image_string = StringIO(img.decode('base64')) LookupError: 'base64' is not a text encoding; use codecs.decode() to handle arbitrary codecs begin photo uploading code photos uploaded using base64 encoding so they can be directly embeded in HTML ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif']) def allowed_file(filename):`` return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS @app.route('/upload', methods=['GET', 'POST']) @flask_login.login_required def upload_file(): if request.method == 'POST': uid = getUserIdFromEmail(flask_login.current_user.id) imgfile = request.files['photo'] caption = request.form.get('caption') album_id = request.form.get('album') tags = request.form.get('tags') photo_data = base64.standard_b64encode(imgfile.read()) thumbnail = resize(photo_data, 200, 200) cursor = conn.cursor() cursor.execute("INSERT INTO Photos (imgdata, thumbnail, user_id, caption, album_id) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')".format(photo_data, thumbnail, uid, caption, album_id)) conn.commit() picture_id = cursor.lastrowid print (picture_id) print (tags) insert_tags(picture_id, tags) return redirect( url_for('get_album', id=album_id)) #The method is GET so we return a HTML form to upload the a photo. else: return render_template('upload.html', loggedin=True, albums=get_all_album_data()) end photo uploading code resizes if greater than (x,y) else returns original def resize(img, x,y): image_string = StringIO(img.decode('base64')) with Image.open(image_string) as image: if image.size[0] > 200 … -
Django AttributeError: 'DatabaseOperations' object has no attribute 'select'
I've got a GeoDjango instance connected to a PostGIS database backend. When I query a table in this database, I get the error in the title: AttributeError: 'DatabaseOperations' object has no attribute 'select' As suggested elsewhere, I checked to make sure that my local_settings.py file specified the correct database engine: 'ENGINE': 'django.contrib.gis.db.backends.postgis'. This is already correct in my settings file. How do you fix this problem? -
Refactoring a Django form which renders fields manually
I'm working on a code base which contains forms which are written along the lines of https://docs.djangoproject.com/en/2.0/topics/forms/#rendering-fields-manually. Here is a snippet of the form's template, which uses Django Widget Tweaks: {% load widget_tweaks %} {% csrf_token %} <div class="row"> <div class="input-field col s12"> {{ form.session_number|add_error_class:"invalid" }} {% if form.session_number.errors %} <span id="{{ form.session_number.id_for_label }}-error" class="error">{{ form.session_number.errors|join:", " }}</span> {% endif %} <label for="{{ form.session_number.id_for_label }}" class="{% if form.session_number.value %}active{% endif %} {% if form.name.errors %}invalid{% endif %}"> Session Number </label> </div> </div> <div class="row"> <div class="col s12"> <label for="email">Scheduled For</label> </div> {{ form.scheduled_for }} </div> {% if form.family.value %} <input name="family" required="" id="id_family" type="hidden" value="{{ form.family.value }}" /> {% else %} <div class="row"> <div class="input-field col s12"> {{ form.family|add_error_class:"invalid" }} {% if form.family.errors %} <span id="{{ form.family.id_for_label }}-error" class="error"> {{ form.family.errors|join:", " }} </span> {% endif %} <label for="{{ form.family.id_for_label }}" class="{% if form.family.errors %}invalid{% endif %}"> Family </label> </div> </div> {% endif %} <div class="row"> <div class="input-field col s12"> {{ form.expert|add_error_class:"invalid" }} {% if form.expert.errors %} <span id="{{ form.expert.id_for_label }}-error" class="error"> {{ form.expert.errors|join:", " }} </span> {% endif %} <label for="{{ form.expert.id_for_label }}" class="{% if form.expert.errors %}invalid{% endif %}"> Expert </label> </div> </div> <div class="row"> <div class="input-field col s12"> … -
Error template when using {%djng_all_rmi %} - django + AngularJs
I'm using django 1.1.10 with Angularjs to developping my first app . according to this document : http://django-angular.readthedocs.io/en/latest/remote-method-invocation.html when using this code : {% load djng_tags %} … <script type="text/javascript"> var tags = {% djng_all_rmi %}; my_app.config(function(djangoRMIProvider) { djangoRMIProvider.configure(tags); }); </script> i get this error : enter image description here Thanks for your help !