Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
is Node.js or python using django or ruby on rails better and more secure for developing back-end for webapps that are going to be used heavily
I understand that all back-end languages are secure and the security actually depends on the implementation of the language. I am a new programmer, I need to start on a cross-platform project that is going to be used heavily by a lot of people and the deadline for the project is in 6 months from now. Till now I developed my websites' back end using php but I realised that there were a lot of ways I could leave my websites vulnerable for attacks so I am looking to switch to a new back-end language. I am currently looking at Node.js, Python(using django), Ruby(on rails). which one of these would help me develop more secure back end for webapps while not compromising, if not at all, much on the scalability given the fact that I donot have much experience and chances of wrong implementations exist. I would also like to mention that I know python(OOP concepts, but dont know how to use it for making web-apps) and basic javascript but I have no base in ruby, but I wouldn't take into consideration that i dont know ruby as I am ready to learn it and besides ruby is said to … -
bokeh timeseries plot : how to format x axis?
I am using bokeh (TimeSeries) to generate plots with Django and I do not manage to format time on the x axis : data2 = dict(depth=Y2['depth'],date=X2['date']) plot = TimeSeries(data2, title="test", xscale='datetime', xlabel = 'time' , ylabel='depth') script, div = components(plot, CDN) return render(request, "simple_chart3.html", {"the_script": script, "the_div": div}) X2['date'] is an array of datetime. I get the following plot Depth versus time How to format the x axis ? Thanks for any hint Karim -
django field is required validators
i have some forms at one page and I try to validate some fields too. So if I enter wrong input at the test field, I get obviously the message ' invalid input', but also for each other field the messages 'This field is required.'. How could I fix it? Override the clean function? But how? class ExampleForm(forms.ModelForm): test = forms.CharField(max_length=30, validators=[RegexValidator(r'^[a-zA-Z0-9_-]+$'), MaxLengthValidator(30)]) Thank you very much for help! -
Twilio - generate 6 digit random numbers
Im planning to integrate twilio for two factor authentication in my Django application. Now, I have installed twilio python module and sent some random messages to my number. The next step is for me to send some random 6 digit numbers that's done in banking application or google two factor authentication. How can I generate these numbers in my DJango application? -
How can I mock a boto3 sns call in unit tests?
I am trying to unit test a function: @shared_task() def push_notification(message=None, message_type=None, user_id=None, data={}): # Get the aws arn from token table aws_token_data = AwsDeviceToken.objects.filter(user_id=user_id).latest("id") client = boto3.client('sns', **aws.AWS_CREDENTIAL) message = { 'default': message, more stuff here 'data': data}) } message = json.dumps(message, ensure_ascii=False) response = client.publish( TargetArn=str(aws_token_data.aws_PLATFORM_endpoint_arn), Message=message, MessageStructure='json', MessageAttributes={} ) return response When users register for our service they get a topic arn based on their device type. I have tried: def test_push_notification(self): with mock.patch('boto3.client') as mock_client: data = {'Some data': "to be sent"} push_notification( message="your invitation has been accepted", message_type='b2g_accepted', user=self.user, data=data ) self.assertEqual(mock_client.call_count, 1) Where self.user is a user registered in the setUp method of TestCase. This fails, the call_count is 0 I am scratching my head trying to figure out a way to test this function but mostly coming up with third party modules or examples for S3. Any help is appreciated -
Nginx can't find some static files
I can't figure out why nginx can't find some static files after deploying on a Digital Ocean. I think that I've set everything correctly. The collectstatic worked ok, it created /project/static directory with all static files. Maybe there is something wrong with settings.py: STATIC_URL = '/static/' PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') STATICFILES_DIRS = ( # os.path.join(PROJECT_ROOT, 'static'), ('dolava_app', os.path.join(PROJECT_ROOT, 'dolava_app', 'static')), ('reservations_app', os.path.join(PROJECT_ROOT, 'reservations_app', 'static')), ('admin_stuff', os.path.join(PROJECT_ROOT, 'admin_stuff', 'static')), ('ajax_stuff', os.path.join(PROJECT_ROOT, 'ajax_stuff', 'static')), ) nginx/sites-available/django upstream app_server { server 127.0.0.1:9000 fail_timeout=0; } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; client_max_body_size 4G; server_name _; keepalive_timeout 5; # Your Django project's media files - amend as required location /media { alias /home/django/project/media; } # your Django project's static files - amend as required location /static { alias /home/django/project/static; } # Proxy the static assests for the Django Admin panel location /static/admin { alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin/; } location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://app_server; } } I've restarted nginx and gunicorn too. But still some static files can't be found inside django/project/static/ dir. Do you know what should I do? -
Strip HTML from Django template block?
In my Django base template I have a duplicate title block so that in child templates I only have to declare the title once. My base.html: <html> <head> <title>{% block title %}{% endblock %}</title> </head> <body> <h1>{% block title %}{% endblock %}</h1> ... </body> </html> My home.html: {% extends 'base.html' %} {% block title %}Hello world!{% endblock %} That all works fine. But if I want to use HTML tags within the page's <h1> like this... {% extends 'base.html' %} {% block title %}<b>Hello</b> world!{% endblock %} ...those tags will also appear in the <title>, which isn't allowed. Is there a way around this other than having two differently-named blocks? I don't think there's a way to strip HTML from a block? -
Upload File in DRF
I want to upload file in Django Rest Framework. views.py class HomeworkUploadView(generics.ListAPIView, generics.RetrieveUpdateAPIView): parser_classes = (FileUploadParser, MultiPartParser) serializer_class = HomeworkUploadSerializer queryset = DeliveredHomework.objects.all() lookup_url_kwarg = 'student' def get_queryset(self): student = self.kwargs.get(self.lookup_url_kwarg) homeworks = DeliveredHomework.objects.filter(student=student) return homeworks def put(self, request, student, format=None): file_obj = self.request.FILES['file'] if file_obj is None: return Response(status=400) filename = '{}/{}'.format(MEDIA_ROOT, file_obj) with open(filename, 'wb+') as temp_file: for chunk in file_obj.chunks(): temp_file.write(chunk) return Response(status=204) serializers.py class HomeworkUploadSerializer(ModelSerializer): file = serializers.FileField(max_length=None, use_url=True) class Meta: model = DeliveredHomework fields = [ 'file', 'student', 'description', 'pk', ] models.py class DeliveredHomework(TimeStampModel): file = models.FileField( null=True, blank=True, upload_to=_handle_homework_file, ) I arranged MEDIA_ROOT settings. But the response is coming like this: tmp_00z2ap.upload Where is the problem? Thank you. -
JavaScript template with data in a Django app
I have a very particular situation I am going to describe and then ask about a fitting solution. I am working in a Django app that loads a particular view and passes some data to the Django template. This data is actually used in a script that the loaded view included. The data includes information needed for a plugin that generates a result with HTML, and also extra information that should be added to the result after it is generated, so it is independent to the plugin. To summarize: The routes: urls.py url(r'^some/random/route$', SomeView.as_view()) The view class: views.py class SomeView(TemplateView): def get_context_data(self, **kwargs): context['data'] = {'plugin': something, 'extra': extra_data} return context The HTML file: some_view.html <div> Whatever. </div> <script> var data = {{ data|safe }}; </script> <script src="some_plugin.js"></script> <script src="some_script.js"></script> Finally, the script: some_script.js $(document).ready(function() { // we pass the information the plugin needs; it comes from the Django backend initializePlugin(data.plugin)); // we do something else with the results generated by the plugin using // the extra information from the backed applyChanges($('#plugin_result'), data.extra); }); Now, the result generated by the plugin are a handful of similar elements with some content: <!-- generated by the plugin, I cannot modify it before … -
Django - "missing 1 required positional argument: 'self' " error, while uploading Image
I'm very close to making a fully working blog by uploading a Image with a post. But I hit a wall and can't move forward because I can't properly get the view and models to work properly to upload the Image. The error I'm getting. TypeError at /new/ save() missing 1 required positional argument: 'self' Request Method: POST Request URL: http://127.0.0.1:8000/new/ Django Version: 1.9.8 My model class. class Post(models.Model): author = models.ForeignKey('auth.User') title = models.CharField(max_length = 200) text = models.TextField() docfile = models.FileField(upload_to='documents/%Y/%m/%d') created_date = models.DateTimeField(default = timezone.now) published_date = models.DateTimeField(blank = True, null = True) def publish(self): self.published_date = timezone.now() self.save() def __str__(self): return self.title Form. class PostForm(forms.ModelForm): class Meta: model = Post fields = ('title' ,'text','docfile',) View. def new_post(request): if request.method == 'POST': form = PostForm(request.POST, request.FILES) if form.is_valid(): post = PostForm.save(commit = False) post.docfile = request.FILES["docfile"] post.author = request.user post.published_date = timezone.now() post.save() return redirect('post_detail', pk = post.pk) else: form = PostForm() return render(request, 'core/post_edit.html', {'form' : form}) HTML Template {% extends 'core/main.html' %} {% block content %} <h1>New Post</h1> <form method="POST" class="post-form" enctype="multipart/form-data">{% csrf_token %} {{form.as_p}} <button type="submit" class="save btn btn-default">Save</button> </form> {% endblock %} I'm so close, but I just can't figure out where i'm … -
Multiple DB Django, table with same name and differents field name
Hi i'm working in a project with django, and I need to use two differents DB, but I have the next situation, I define my two db's in my settings file, but in both db's i have a table named Personas, which have differents fields name. How could I define my models? My problem is in Meta definition in "db_table" I have the same name in both models. how can i specify which db contains the table? -
Storing Multiple Files for Each Instance of A Model
I have a simple model of a Student and I'd like to be able to store an unknown amount of documents for each student. I thought about adding a FileField to the model but then I'd have to add a FileField for each document. My question is what is the most efficient way to store documents for each student? -
Django model edit form not showing up uploaded file and remove option
I have a model form with upload field, My form class AccountEditForm(forms.ModelForm): telephone = forms.CharField(label=_('Telephone'), required=False,widget=forms.TextInput({'class': 'input-text input-box'})) cv = forms.FileField(required=True,widget=forms.FileInput({'class': 'input-text input-box'})) class Meta: model = Profile fields = ('telephone','cv') My View class AccountEdit(TemplateView): template_name = 'base/account/edit.html' def get(self,request,*args,**kwargs): profile = request.user.profile data = { 'form': AccountEditForm(instance=profile) } return render(request,self.template_name,data) def post(self,request,*args,**kwargs): profile = request.user.profile form = AccountEditForm(request.POST,request.FILES,instance=profile) if form.is_valid(): form.save() messages.success(request, _('Successfully updated your account.')) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) data = { 'form': form } return render(request,self.template_name,data) My Template <div class="form-group"> {{ form.telephone.label }} {{ form.telephone }} {% if form.telephone.errors %} {{ form.telephone.as_text }} {% endif %} </div> <div class="form-group"> {{ form.cv.label }} {{ form.cv }} {% if form.cv.errors %} {{ form.cv.errors.as_text }} {% endif %} </div> The problem is in edit form uploaded file is not getting displayed instead if I change some other field and submit it is throwing form error for cv is required -
How can I make a user defined "Other" in a field with Choices in Django?
I'm coding up a model in Django and I need some choices - but I would like to let the user choose 'Other' and then type in their own choice too. How can this be done in Django? class Client(models.Model): ENTITY_TYPE_CHOICES = ( ('publicly_traded', 'Publicly Traded Company'), ('limited_liability', 'Limited Liability Company'), ('partnership', 'Partnership'), ('ngo', 'NGO'), ) ... entity_type = models.CharField(choices=ENTITY_TYPE_CHOICES) -
Django Zinnia, extending the entry model followed by documentation, migration issue
Iam trying to follow the Zinnia Django documentation for extending the entry model with a EntryGallery. Following problems: When i want to migrate the new App "zinnia_gallery" this shows up: You are trying to add a non nullable field 'gallery' to entry without default. Plus when I tried the app to migrate, it shows that the 'category' of zinnia can not be imported. my steps what I did: 1. creatin new app "zinnia_gallery" 1. followed the documentation Any help would be highly appreciated, I guess I misunderstand the documentation NOW MY CODE app is in project folder mysite/zinnia_gallery models.py (in /zinnia_gallery) from __future__ import unicode_literals from django.db import models from zinnia.models_bases import entry class Picture(models.Model): title = models.CharField(max_length=50) image = models.ImageField(upload_to='gallery') class Gallery(models.Model): title = models.CharField(max_length=50) pictures = models.ManyToManyField(Picture) class EntryGallery( entry.CoreEntry, entry.ContentEntry, entry.DiscussionsEntry, entry.RelatedEntry, entry.ExcerptEntry, entry.FeaturedEntry, entry.AuthorsEntry, entry.CategoriesEntry, entry.TagsEntry, entry.LoginRequiredEntry, entry.PasswordRequiredEntry, entry.ContentTemplateEntry, entry.DetailTemplateEntry): image = models.ForeignKey(Picture) gallery = models.ForeignKey(Gallery) def __str__(self): return 'EntryGallery %s' % self.title class Meta(entry.CoreEntry.Meta): abstract = True settings.py """ Django settings for mysite project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # Build … -
Class.object.filter does not work properly after project migration from django 1.6 to 1.8
project was written in django 1.6 and recently migrated to django 1.8.15. It works quite well but project tests showed a failure during executing line: objs = Agent.objects.filter(Q(first_name__icontains=term) | Q(last_name__icontains=term) | Q(accord_id__icontains=term) | Q(company__icontains=term)) Traceback (most recent call last): File ".../project/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File ".../project/local/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File ".../project/local/lib/python2.7/site-packages/django_select2/views.py", line 57, in dispatch return super(Select2View, self).dispatch(request, *args, **kwargs) File ".../project/local/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch return handler(request, *args, **kwargs) File ".../project/local/lib/python2.7/site-packages/django_select2/views.py", line 76, in get self.get_results(request, term, page, context) File ".../project/local/lib/python2.7/site-packages/django_select2/views.py", line 194, in get_results return field.get_results(request, term, page, context) File ".../project/project/app/fields.py", line 33, in get_results objs = Agent.objects.filter(Q(first_name__icontains=term) | Q(last_name__icontains=term) | Q(accord_id__icontains=term) | Q(company__icontains=term)) File ".../project/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File ".../project/local/lib/python2.7/site-packages/django/db/models/query.py", line 679, in filter return self._filter_or_exclude(False, *args, **kwargs) File ".../project/local/lib/python2.7/site-packages/django/db/models/query.py", line 697, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File ".../project/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1310, in add_q clause, require_inner = self._add_q(where_part, self.used_aliases) File ".../project/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1332, in _add_q current_negated, allow_joins, split_subq) File ".../project/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1338, in _add_q allow_joins=allow_joins, split_subq=split_subq, File ".../project/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1150, in build_filter lookups, parts, reffed_expression = self.solve_lookup_type(arg) File ".../project/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1036, in solve_lookup_type _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta()) File ".../project/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line … -
gspreed Invalid token: Stateless token expired
I have a web application which use django framework. I am using gspreed to parse some data from googlesheet. On my local machine the script is running well, but one it is deployed in the web server, after estimate one hour I have an error: File "/home/ZhukovGreen/rmkPrjWeb/myvenv/local/lib/python2.7/site-packages/gspread/httpsession.py", line 72, in request response.status_code, response.content)) HTTPError: 401: Token invalid - Invalid token: Stateless token expired Token invalid - Invalid token: Stateless token expired Error 401 Thank you. -
Django-registration how to check if user exists
I'm using Django-registration with Django 1.8.15 to register users. My urls.py looks like this: from registration.backends.hmac.views import RegistrationView url(r'^registration/register/$', RegistrationView.as_view(form_class=MyCustomSubscriberForm), name="registration_register"), This is basically a CBV where I provide the form and the template. Here's the form: class MyCustomSubscriberForm(RegistrationForm): class Meta: model = MyCustomSubscriber fields = ('firstname', 'surname', 'email', ) My problem is how to handle validation in this CBV? At the moment if e.g. somebody tries to register with an already used email address Django gives a IntegrityError at /registration/register/ ... What is the best way to use Validators from Django-registrations? For instance - how do I make sure that if a user with a certain e-mail already exists the users gets notified in the template? How to extend this CBV or handle this error in my code with those validators already provided by Django-Registration? -
How to render templates dynamically for a static user choice
I don't know how to put this question as a title. But my question is I have 2 templates for each view in my django project templates folder. One template for english language and another for spanish language. My templates structure is Project | app | templates | app | home_en.html home_es.html about_en.html about_es.html I need to render the templates according to the user choice of language. I have the project now fully in english running. As a start I only have the templates converted to spanish and ready to render. I am sorry this is a vague question but some directions to this problem would help. My main urls are urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^en/', include('app.urls')), url(r'^es/', include('app.urls')), ] my app urlpatterns are urlpatterns = [ url(r'^about$', views.about, name='about'), url(r'.*', views.home, name='home'), ] I also tried checking the request url with /en/ or /es/ and then render according to it in each views like below. def home(request): if request.path == '/en/': return render(request, 'app/home_en.html', {'title':'HOME'}) else: return render(request, 'app/home_es.html', {'title':'HOME'}) This works fine when I explicitly give url request as /en/ or /es/. How could i set it on the url based on the users selection of language … -
Django ORM: Via double underscore to verbose name of field
I can query my model with MyModel.objects.filter(othermodel__nr='foo'). This works fine. I would like to get the verbose_name of the field. Example: class OtherModel(models.Model): nr=models.IntegerField(verbose_name='Number') In above example it easy since I can access OtherModel, but I would like to do it generic. How to get the verbose name of a field which is used in "key" here? MyModel.objects.filter(**{key: value}) I search a method which resolves the double underscore. In this example "othermodel__nr" to (for example) "Number". -
purpose and example of django.contrib.admindocs inbuilt django app
I am new to python django web framework. I have come through django.contrib.admindocs app. I am not able to understand the real utility of this inbuilt app. I have studied the documentation. But It doesn't contain any useful info. Moreover, I have also googled out, but didn't get any userful example. So, Can anyone let me the significance of this utility ? Moreover, is it used, when app is deployed on production server(When DEBUG settings is False) ? Reference to any demo site, using admindocs app, will be appreciated. Apologizing for newbie question. Thanks in advance. -
Error at TemplateDoesNotExist at /
I am using django 1.10.2 version and I got a error which says TemplateDoesNotExist at / I don't why it's happening I tried fixing with: 'DIRS': ['C:\Users\rahul\django-tuts\cms\blog\templates\blog\post'], or 'DIRS': [os.path.join(os.path.dirname(file), '..//', 'templates').replace('\', '/')], Still encountered the same error. Following are my files as settings.py Django settings for cms project. Generated by 'django-admin startproject' using Django 1.10.2. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'u2!61zgb-klaf=qh)bh@9brkxt%vy5!!esg5=uvs!ahh%@t$-4' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'cms.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], # 'DIRS': ['C:\\Users\\rahul\\django-tuts\\cms\\blog\\templates\\blog\\post'], # 'DIRS': [os.path.join(os.path.dirname(__file__), '..//', 'templates').replace('\\', '/')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'cms.wsgi.application' # Database # https://docs.djangoproject.com/en/1.10/ref/settings/#databases DATABASES = { 'default': … -
How to count number of entries, annotate it and select latest with Django ORM
I need to select entries which match specific pattern, count them and the pick latest. How to do this via Django ORM? Tried: Entry.objects.filter(A=B).annotate(Count("something")).latest("date") This counts only 1 item for each B. If I remove latest("date"), it counts correctly but gives only count number and nothing else. How to perform this task correctly? -
How to generate list of response messages in django rest swagger?
I have upgraded Django Rest Framework to 3.5.0 yesterday because I need nice schema generation. I am using Django Rest Swagger to document my API but don't know how to list all possible response messages that an API endpoint provides. It seems that there is automatic generation of success message corresponding to the action my endpoint is performing. So POST actions generate 201 response code, without any description. How would I go about adding all the response messages that my endpoint provides and give them some descriptions? I am using djangorestframework==3.5.0 django-rest-swagger==2.0.7 -
Django: overriding django-all-auth login form(crispy Layer) is not possible?
forms.py from django import forms from allauth.account.forms import LoginForm from crispy_forms.helper import FormHelper from crispy_forms.layout import ( Layout, Fieldset, Submit, Div, Hidden, Button, ButtonHolder, HTML, Field ) class SpacegraphyLoginForm(LoginForm): def __init__(self, *args, **kwargs): super(SpacegraphyLoginForm, self).__init__(*args, **kwargs) # self.fields['password'].widget = forms.PasswordInput() # You don't want the `remember` field? if 'remember' in self.fields.keys(): del self.fields['remember'] helper = FormHelper() helper.layout = Layout( HTML(""" <p>adfdsa sadfdasfdasfdsafadsf dfadsfdsafdasfaf</p> <header class="size-18 margin-bottom-20">로그인</header> """), Div( 'hi' ), Field('login', placeholder='Email address'), Field('password', placeholder='Password'), Submit('submit', 'Log me in to Cornell Forum', css_class = 'btn-primary') ) self.helper = helper It works for if 'remember' in self.fields.keys(): del self.fields['remember'] (Form doesn't show 'Remember me' check box anymore) But problem is that my cirspy_form's Layout doesn't show anything. It shows only id, pw in browser: <form action="/accounts/login/" method="post" class="login sky-form boxed"> <input type="hidden" name="csrfmiddlewaretoken" value="f8ZcIs6tcs4xbTR0DZgwImb2nodyV9s1"> <div id="div_id_login" class="form-group"> <label for="id_login" class="control-label requiredField"> Login<span class="asteriskField">*</span> </label> <div class="controls "> <input autofocus="autofocus" class="textinput textInput form-control" id="id_login" name="login" placeholder="Username or e-mail" type="text"> </div> </div> <div id="div_id_password" class="form-group"> <label for="id_password" class="control-label requiredField"> 비밀번호<span class="asteriskField">*</span> </label> <div class="controls "> <input class="textinput textInput form-control" id="id_password" name="password" placeholder="비밀번호" type="password"> </div> </div> </form> What's the problem?