Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Registration and Login on Same Index Page
I'm trying to have a registration and login form both on my index page (NOT separate login/register urls). I'm able to display the forms, but having trouble with submission. At first I just had the registration form and submission for account creation worked just fine, but adding the Login form has started to cause some issues. Relatively new to Django and can't seem to find the documentation to fit my use case. views.py from django.shortcuts import render, redirect from django.contrib.auth.forms import UserCreationForm from .forms import UserRegisterForm from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import authenticate, login, logout from django.contrib import messages import datetime from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from django.contrib.auth.decorators import login_required def index(request): if request.method == 'POST': if request.POST.get('submit') == 'login': login_form = AuthenticationForm(request.POST) username = request.POST.get('username') password = request.POST.get('password') user = authenticate(username=username, password=password) if user: if user.is_active: login(request,user) return HttpResponseRedirect(reverse('index')) else: return HttpResponse("Your account was inactive.") else: return HttpResponse("Invalid login details given") elif request.POST.get('submit') == 'register': form = UserRegisterForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') messages.success(request, f'Account created for {username}!') return redirect('index') else: form = UserRegisterForm() login_form = AuthenticationForm() now = datetime.datetime.now() cur_year = now.year context = { 'login_form': login_form, 'form' : form, 'year' : … -
Access a custom made list in django template
In my view I created a list as below: dict = {"visited": "positions"} try: positions = Position.objects.filter(company=request.user.userprofile.company, status='ACTIVE') positions_dict = {} for k, position in enumerate(positions): try: hiringPos = HiringPosition.objects.get(position=position) except HiringPosition.DoesNotExist: hiringPos = None positions_dict[k] = {"position": position, "hiringPos": hiringPos} except Position.DoesNotExist: positions_dict = None dict['positions'] = positions_dict print(dict['positions']) return render(request, 'user_view.html', context=dict) It returns like this as i printed into console: {0: {'position': <Position: Position object (1)>, 'hiringPos': None}} Can someone tell me how do i iterate in my user_view.html template? There I have: {% for obj in positions %} {% endfor %} But any try didnt printed anything such as obj.position or positions[obj] or positions.obj ... My Django version: 2.2.2 and python version: 3.6.4 -
Ajax + Django : Ajax is not recognized
I don't understand why my AJAX request is not executed by JQUERY when the method is well executed. I have a form, linked to a JQuery function event with AJAX method that send data to Django function. When I click on the save button, my page reloads while browsing the function to capture the event. It displays the alert well but does not send any information with AJAX. Is my function correct? Is this a problem with Django? This is my html form : <form method="post" id="insert_idea__form"> {% csrf_token %} <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="insert_idea__titre">Titre de votre idée</label> <input type="text" class="form-control" id="insert_idea__title" required=""> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="insert_idea__content">Contenu de l'idée</label> <textarea class="form-control" rows="5" id="insert_idea__content" name="centent"></textarea> </div> </div> </div> <button type="submit" class="btn btn-sm btn-primary">Sauvegarder</button> </form> This is my JQUERY function : <script type="text/javascript"> $("#insert_idea__form").on('submit',(function(e) alert("Stop"); $.ajax({ url: '{% url "insert_idea" %}', type : 'POST', data: { 'title': $("#insert_idea__title").val(), 'content': $("#insert_idea__content").val() }, dataType: 'json', success: function (data) { alert('success'); } }); })); </script> This is my url.py on Django : urlpatterns = [ url(r'^ajax/insert_idea/$', ideas.insert_idea, name="insert_idea"), ] This is my view : def insert_idea(request): title = request.GET.get('title') centent = request.GET.get('centent') return JsonResponse() If … -
Overriding an UpdateView's get_form_kwargs() method
I'd like to override an UpdateView's get_form_kwargs() method, and have something similar to the following: class GroupRatingView(UpdateView): model = Group fields = ['rating'] def get_form_kwargs(self, *args, **kwargs): kwargs = super(GroupRatingView, self).get_form_kwargs(*args, **kwargs) import ipdb; ipdb.set_trace() However, if I try this out, I get the following error: File "/venv/lib/python2.7/site-packages/django/views/generic/edit.py" in post 181. form = self.get_form() File "/venv/lib/python2.7/site-packages/django/views/generic/edit.py" in get_form 45. return form_class(**self.get_form_kwargs()) Exception Type: TypeError at /groups/5/rate Exception Value: ModelFormMetaclass object argument after ** must be a mapping, not NoneType It seems that self.get_form_kwargs() is returning None, whereas I would expect to drop into the debugger. Why am I getting an error instead of hitting the debugger trace? -
Python vs PHP and Laravel vs Django, what is easy to learn?
I heard of people say python is the easiest language and that is why i started learning it. but most of the people think PHP is the easiest language over python.. even laravel more easier than Django, is it true? I guess you are bored with my post but it is may something someone can be inspired by your opinion... Let's open discussion -
Django Foreign key field validation in a forms or models ( getting info created by only that user from foreign key)
I'm trying to build courses and add lessons to a course later and the problem I encounter is that every user can choose to add courses to another person created courses. Like if you create some courses, another user will see as an option to add his lesson to it View file ''' def creatingLessonsForm(request): form = CreatingLessonsForm(request.POST or None) if form.is_valid(): post = form.save(commit=False) post.CreatedBy = request.user post.save() form = CreatingLessonsForm() context = {'form': form} return render(request, 'courses/creatingLessonsForm.html', context) ''' Model file ''' class CreatingCourses(models.Model): NameOfTheCourses = models.CharField("Name of the courses", max_length=60, blank=False) Category = models.ForeignKey(Subject, on_delete=models.CASCADE) CreatedBy = models.ForeignKey(User, on_delete=models.CASCADE, null=True) Document = models.ForeignKey(Document, on_delete=models.SET_NULL, verbose_name= "Select document for courses introduction", blank=True , null=True) IncludeTest = models.ForeignKey(GenaratedTest, on_delete=models.SET_NULL, verbose_name= "Include test for courses", blank=True , null=True) AdditionalInfo = models.TextField("Additional info for courses introduction", max_length=300, blank=False) Note = models.TextField("Notes", max_length=180, blank=True) Show_the_courses = models.BooleanField(verbose_name= "Show the courses for everyone?",default=True) def __str__(self): return str(self.NameOfTheCourses) if self.NameOfTheCourses else '' class CreatingLessons(models.Model): Courses = models.ForeignKey(CreatingCourses, on_delete=models.SET_NULL, null=True) NameOfTheLesson = models.CharField(max_length=60, verbose_name= "Name of the lesson", blank=False) Document = models.ForeignKey(Document, on_delete=models.SET_NULL, verbose_name= "Document for lesson", blank=True , null=True) CreatedBy = models.ForeignKey(User, on_delete=models.CASCADE, null=True) Lesson = models.TextField(max_length=250, verbose_name= "Lesson", blank=False) Note = models.TextField("Notes", max_length=100, … -
Wagtail - Revisions for Non-Page Objects
I use vanilla django models (they do not inherit from Page) and the modeladmin module of wagtail to replace the standard django admin with the wagtail admin interface. This is all working great, but I now wish to add revision history and rollback to these models. Wagtail of course has it's own system for managing revisions of objects that inherit from Page, but they would not apply to standard django models. On the other hand, I have been looking at using the django-revisions app to have this functionality. Although this works, django-revisions only provides a standard django admin view, which is not compatible with wagtail, and I would prefer to not have users switching between the two completely different looking admin areas. Does anybody have experience with managing revisions and rollbacks of standard model instances within the context of wagtail? -
Django message is not cleared on web-page reload, causing previous pop up to redisplay
I have a web-page that shows a contact-form. Details are entered and using this an email is sent. To indicate success of sending the email I used Django messages framework, which adds a message with text content 'success'. The html-template checks 'messages' list in a for loop and if met with a message with content 'success', defines a div that contains an ok button (to click and remove this div). I could not find a way to get a JS alert pop up box to trigger after comparison met, so this is why Im defining an absolute position div box myself. I have managed to get the pop up to be removed on click on 'OK', and to bring a new pop up on sending new email, but after I have cleared the pop up and then reload the page, the pop up returns. I suspect the message list containing 'success' message from previous form submit persists on the new page and template has matched it with its condition again. I've tried to use body tag onload to trigger a JS function to clear 'messages' but nothing happened. Not sure 'messages' can be accessed. Tried putting some code found online … -
Model Object from Database not returning Iter
I'm trying to query my Postgresql DB and it's not returning something I can work with. I keep getting Employee object, not Iterable. I've tried adding the iter() function to my Model build up but that also doesn't work models.py class Employee(models.Model): first_name = models.CharField(max_length = 200) last_name = models.CharField(max_length = 200) name = models.CharField(max_length = 200 , blank=True, null=True) employee_id = models.IntegerField(null=False, blank=False, unique=True) email = models.CharField(max_length = 200) address = models.CharField(max_length = 200) employment_type = models.CharField(max_length = 200) employment_status = models.CharField(max_length = 200) role = models.CharField(max_length = 200) marital_status = models.CharField(max_length = 200) gender = models.CharField(max_length = 200) join_date = models.DateField() end_date = models.DateField(blank=True, null=True) location = models.CharField(max_length = 200) hod = models.CharField(max_length = 200) phone_number = models.CharField(max_length = 200, null=False, blank=False) date_added = models.DateTimeField(default = datetime.now, blank=True) date_of_birth = models.DateField() department = models.ForeignKey(Department, on_delete = models.DO_NOTHING) credentials = models.ImageField(upload_to = user_directory_path ) passport = models.ImageField(upload_to = user_directory_path1) views.py def edit(request, pk): employee = get_object_or_404(Employee, id=pk) logging.info(type(employee)) departments = Department.objects.all() # field_values = { 'first_name':employee.first_name,'last_name':employee.last_name,'email':employee.email,'employee_id':employee.employee_id,'department':employee.department,'address':employee.address,'employment_type':employee.employment_type, # 'employment_status':employee.employment_status,'role':employee.role,'marital_status':employee.marital_status,'gender':employee.gender,'join_date':employee.join_date, # 'end_date':employee.end_date,'location':employee.location,'credentials':employee.credentials,'passport':employee.passport,'hod':employee.hod, # 'phone_number':employee.phone_number,'date_added':employee.date_added,'date_of_birth':employee.date_of_birth } # form = AddEmployeeForm(field_values) context = { 'employee': employee, 'departments':departments } if request.method == "POST": first_name = request.POST['first_name'] last_name = request.POST['last_name'] name = last_name +' '+first_name … -
read csv file saved in static folder
I have some javascript in index.html that visualizes data stored in population.csv. But nothing is displayed. My directory and the javascript code is listed below. I think I need to change the directory to reach the population.csv but what I have tried hasn't worked. I have tried /static/population.csv. -
How to calculate call @property method from models.py in template in Django?
I have posted the question referred in the link below. How to calculate total price of a product in models in Django? Can anyone please help in this regard i shall be really grateful? Thanks in advance -
Wanting to display csv page with django-rest-framework
I'm trying to display a csv file like I would normally do with Json or XML with Django Rest. Here's an example of what I have. I did what the documentation told me and I have my setting.py set up as REST_FRAMEWORK = { 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer', 'rest_framework_xml.renderers.XMLRenderer', 'rest_framework_csv.renderers.CSVRenderer', but whenever I click on the 'csv' it automatically downloads. Anyway to show the csv file on the browser? -
Create a new app in a Django project with multiple databases
I currently have a PostgreSQL database setup using Django which contains a bunch of loans and different attributes. I am now looking to grab a subset of these loans, perform some operations (randomize attributes using a distribution), and load these into a separate database. I am also looking to keep a mapping of the original loans to their new counter parts, should I be creating a new app in my project or starting a new project? I have been looking into using multiple databases as I don't see a way around this and have started with a new app in my current project but am stuck on creating the mapping and choosing which database to select data from and which one to write the updated data to. I'm fairly new to Django and the original database and Django files were created by another person, any help or advice is greatly appreciated. -
Extra field is not showing in Django administration user creation form
I have written forms.py and admin.py. but extra field such as email, full name is not showing in Django administration user creation form. -
how to edit the particular user details in profile page of User module in django
I created the signup form and login form.Now I want to edit and delete the particular details of signup form.I tried it with below code but it is not working.It is allowing me only to edit the admin panel user details only. Here is my code models.py from django.db import models from django.contrib.auth.models import User class UserProfileInfo(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) def __str__(self): return self.user.username forms.py from django import forms from .models import UserProfileInfo from django.contrib.auth.models import User class UserProfileInfoForm(forms.ModelForm): class Meta(): model = UserProfileInfo fields = [ ] class editProfile(forms.ModelForm): class Meta(): model = User fields = ['first_name','last_name','username','email','password'] help_texts={ 'username': None } views.py from django.shortcuts import render from .forms import UserForm,UserProfileInfoForm,editProfile from django.contrib.auth import authenticate, login, logout from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from django.contrib.auth.decorators import login_required def edit_profile(request): if request.POST: user = User.objects.get(pk=request.user.id) user.username=request.POST.get('user') user.email=request.POST.get('email') user.first_name=request.POST.get('first_name') user.last_name=request.POST.get('last_name') user.password=request.POST.get('password') user.save() return HttpResponseRedirect(reverse('signupapp:index')) user_profile = request.user.get_profile() return render_to_response('edit.html',{'profile':user_profile },context_instance=RequestContext(request)) Can anyone help me to solve this. -
Incorrect path rendering during the update
I've developed a custom form for upload a file using custom-file-input class of Bootstrap 4. It happen something strage when I try to update an existing file as you can see on the image below. The file's path is not correct rendered. I don't understand where is the problem. What I've wrong? forms.py class FileUploadForm(forms.ModelForm): name = forms.CharField( max_length=50, help_text="<small>Write file name here. The name must be have max 50 characters</small>", widget=forms.TextInput( attrs={ "placeholder": "Titolo", "type": "text", "id": "id_title", "class": "form-control form-control-lg", } ), ) description = forms.CharField( max_length=200, help_text="<small>Write a short description here. The description must be have max 200 characters.</small>", widget=forms.Textarea( attrs={ "placeholder": "Descrizione", "type": "text", "id": "id_description", "class": "form-control", "rows": "2", } ), ) publishing_date = forms.DateTimeField( input_formats=['%d/%m/%Y %H:%M'], label="Data di pubblicazione", help_text="<small>Write data and hour of publication. You can use also a past or a future date.</small>", widget=forms.DateTimeInput( attrs={ "id": "publishing_date_field", 'class': 'form-control datetimepicker-input', 'data-target': '#publishing_date_field', } ), ) file = forms.FileField( help_text="<small>Upload the file here.</small>", widget=forms.ClearableFileInput( attrs={ "placeholder": "Carica il file", "type": "file", "id": "id_file", "class": "custom-file-input", } ), ) class Meta: model = FileUpload fields = [ 'name', 'description', 'publishing_date', 'file', ] views.py def createFile(request): if request.method == 'POST': form = FileUploadForm(request.POST or None, … -
Get Firestore realtime updates with Django websockets
I think I need to use Firestore realtime updates to keep a track of realtime updates made in Firestore via Django channels. I have created a basic chat application using Django Channels which saves user's messages in Cloud Firestore following this tutorial. I am new with both Django and Firstore and pretty much confused as to how to integrate Firstore realtime listener with Django websockets. Couldn't find any tutorial which uses both of them together. Is it possible to use any one and still get realtime updates, am I on the correct path or missing something? Any guidelines will be appreciated. -
Dynamic query in django with "|" character in WHERE clause and variable in tablename
I have a dynamic sql query running in my views.py and have already ran others that work fine. I am really worried about sql injections because this is a private website. However, the parameters in my And clause has the character "|" in it which throws the error Unknown column "X" in 'where clause' I have looked at solutions but they all use non dynamic query which then prohibits me from making the tablename a variable. Here is what I want: mycursor = mydb.cursor() assembly_name = "peptides_proteins_000005" group_id = 5 protein_id = "sp|P48740|MASP1_HUMAN" qry = "SELECT * FROM %s WHERE group_id = %i AND protein_id = %s" % (assembly_name, group_id, protein_id) mycursor.execute(qry) But this throws the error: mysql.connector.errors.ProgrammingError: 1054 (42S22): Unknown column 'sp' in 'where clause' However if I try doing something more along the lines of this, like the did in the previous questions I have seen: qry = "SELECT * FROM %s WHERE group_id = %i AND protein_id = %s" mycursor.exectue(qry, (assembly_name, group_id, protein_id)) I get the error: mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement Changing the %i to a %s fixes this problem but then I get the error: mysql.connector.errors.ProgrammingError: 1064 (42000): You have … -
I want to use url parameters as optional filters django rest framework
I have a django rest framework application and I want to use my url parameters as optional filtering for queryset it they are given in the url. Right now, i am trying to grab the parameters from the url and they are not grabbing, it is also then not applying the parameters as a filter. can someone help me wit this. urls: router.register(r'preferences', PreferenceUserViewSet, basename='Preference') router.register(r'preferences/(?P<namespace>\w+)', PreferenceUserViewSet, basename='Preference-namespace') router.register(r'preferences/(?P<namespace>\w+)/(?P<path>\w+)', PreferenceUserViewSet, basename='Preference-path') viewset: class PreferenceUserViewSet(viewsets.ModelViewSet): model = Preference serializer_class = PreferenceSerializer def get_permissions(self): if self.action == 'create' or self.action == 'destroy': permission_classes = [IsAuthenticated] else: permission_classes = [IsAdminUser] return [permission() for permission in permission_classes] @permission_classes((IsAuthenticated)) def get_queryset(self): namespace = self.request.query_params.get('namespace', None) path = self.request.query_params.get('path', None) print(namespace) print(path) queryset = Preference.objects.filter(user_id=1) if path is not None: queryset = Preference.objects.filter(user_id=1, namespace=namespace) if namespace is not None: queryset = Preference.objects.filter(user_id=1, namespace=namespace, path=path) return queryset -
Tempus Dominus Bootstrap 4: blank DateTimeInput field
I've developed a custom form using Tempus Dominus Bootstrap 4 in CDN When I create an object I can add a correct date and time but when I try to update an existing object the input field of the form is blank; I aspect to see the previous date and time. I don't understand where is the problem. What I've wrong? forms.py class FileUploadForm(forms.ModelForm): name = forms.CharField( max_length=50, help_text="<small>Write file name here. The name must be have max 50 characters</small>", widget=forms.TextInput( attrs={ "placeholder": "Titolo", "type": "text", "id": "id_title", "class": "form-control form-control-lg", } ), ) description = forms.CharField( max_length=200, help_text="<small>Write a short description here. The description must be have max 200 characters.</small>", widget=forms.Textarea( attrs={ "placeholder": "Descrizione", "type": "text", "id": "id_description", "class": "form-control", "rows": "2", } ), ) publishing_date = forms.DateTimeField( input_formats=['%d/%m/%Y %H:%M'], label="Data di pubblicazione", help_text="<small>Write data and hour of publication. You can use also a past or a future date.</small>", widget=forms.DateTimeInput( attrs={ "id": "publishing_date_field", 'class': 'form-control datetimepicker-input', 'data-target': '#publishing_date_field', } ), ) file = forms.FileField( help_text="<small>Upload the file here.</small>", widget=forms.ClearableFileInput( attrs={ "placeholder": "Carica il file", "type": "file", "id": "id_file", "class": "custom-file-input", } ), ) class Meta: model = FileUpload fields = [ 'name', 'description', 'publishing_date', 'file', ] views.py def createFile(request): … -
How to store data over time in Django ORM?
I would like to store numerical data that corresponds to a certain date, as in stock prices. Each stock would have a list of days and a corresponding price for that day. I am aware of Django's ArrayField, but that wouldn't work as a dictionary; I'd have to have two separate arrays with the indices of each day and price matching up. In theory a One:Many relationship between the stock and the day, with a One:One relationship beteen day and the price could work, but this seems very inefficient. Am I correct in thinking so? This is what some data might look like in pure Python appl = {Datetime.date(2000, 1, 1): 100, Datetime.date(2000, 1, 2): 200} googl = {Datetime.date(2010, 1, 1): 100, Datetime.date(2010, 1, 2): 200} #etc I'm using Python 3.6, Django 2.2 and PostgreSQL for the database. What is a way of accomplishing this? -
Can't get the val() of any child from Firebase to Django
I'm trying to connect a Django project to google firebase account using pip install Pyrebase Here is my config in the views.py: cred = credentials.Certificate("Cpanel/fostania-3b742-firebase-adminsdk-hk9hn-393fb87471.json") config = { "apiKey": "AIzaSyCTOTpYu25cyT7WuFRCE4lOFnCxXWHQsYg", "authDomain": "fostania-3b742.firebaseapp.com", "databaseURL": "https://fostania-3b742.firebaseio.com", "storageBucket": "fostania-3b742.appspot.com", } firebase = pyrebase.initialize_app(config) default_app = firebase_admin.initialize_app() print(default_app.name) I've created a service account credential and used the JSON file as you see in the code cred = credentials.Certificate("Cpanel/fostania-3b742-firebase-adminsdk-hk9hn-393fb87471.json") Also, added GOOGLE_APPLICATION_CREDENTIALS to envoirment variables. And now using this view only prints (None): @login_required def index(request): db = firebase.database() all_agents = db.child("cities").get().val() print(all_agents) return render(request, 'Cpanel/index.html') -
How to perform a double step Subqueries in Django?
I have the below models: class Group(models.Model): group_name = models.CharField(max_length=32) class Ledger(models.Model): ledger_name = models.CharField(max_length=32) group_name = models.ForeignKey(Group,on_delete=models.CASCADE,null=True,related_name='ledgergroups') class Journal(models.Model): By = models.ForeignKey(Ledger,on_delete=models.CASCADE,related_name='Debitledgers') To = models.ForeignKey(Ledger,on_delete=models.CASCADE,related_name='Creditledgers') Debit = models.DecimalField(max_digits=20,decimal_places=2,default=0) Credit = models.DecimalField(max_digits=20,decimal_places=2,default=0) As you can see the Journal model is related with the Ledger models with a Foreignkey relation which is further related with Group model. My scenario is kind of complex. I want to filter the Group objects and their balances (Balances are the difference between their total Debit and their total Credit). I want to filter the total Group names and the subtraction of total Debit and total Credit..(Debit and Credit are the fields of Journal model). Can anyone help me to figure out the above. I have tried Subqueries before in Django but haven't done a two step Subquery in Django. Any solution will be helpful. Thank you -
error in AUTH_USER_MODEL after upgrading Django
i am working on django 1.8 and python 2.7 then i upgraded my django to 2.2 and python to 3.6 but when i run python manage.py runserver i got error in terminal that show me: django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'users.User' that has not been installed i use AUTH_USER_MODEL = 'users.User' in setting.py no changes i made for the code but just i upgraded my django and python -
Django Unable to send CSV via POST request
I have an extremely minimal app, where the relevant view function is defined like so: def upload_payment(request): if request.method == "GET": return HttpResponse(content="foo", status=200) elif request.method == "POST": file = request.FILES['file'] decoded_file = file.read().decode('utf-8').splitlines() reader = csv.DictReader(decoded_file) for row in reader: print(row) return HttpResponse(content="done", status=200) The above is the relevant view method. Now I run: curl -X POST -H 'Content-Type: text/csv' -d @test_file.csv http://localhost:8000/invoice_admin/upload_payments/ I'm getting an error: <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"> <title>403 Forbidden</title> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; background:#eee; color:#000; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; margin-bottom:.4em; } h1 span { font-size:60%; color:#666; font-weight:normal; } #info { background:#f6f6f6; } #info ul { margin: 0.5em 4em; } #info p, #summary p { padding-top:10px; } #summary { background: #ffc; } #explanation { background:#eee; border-bottom: 0px none; } </style> </head> <body> <div id="summary"> <h1>Forbidden <span>(403)</span></h1> <p>CSRF verification failed. Request aborted.</p> <p>You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked …