Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Id is required Formset editing Django
I'm trying to edit my values for 2 formsets. I'm using a inline formset in one of the forms. I can create data just fine, but updating is not working. What can be wrong? Here is my code. models.py class Projeto(models.Model): nome_projeto = models.CharField('Nome do Projeto', max_length=200) def __str__(self): return self.nome_projeto class Colaboradores(models.Model): projeto = models.ForeignKey(Projeto, on_delete=models.CASCADE, related_name='colaboradores') colaborador_projeto = models.CharField(max_length=200, blank=True) def __str__(self): return self.colaborador_proje forms.py from django import forms from .models import Projeto, Colaboradores class PostForm(forms.ModelForm): class Meta: model = Projeto fields = '__all__' nome_projeto = forms.CharField(label='Nome do Projeto:', required=True, widget=forms.TextInput( attrs={ 'class': 'form-control col-8', 'maxlength': '200', } )) class ColabForm(forms.ModelForm): class Meta: model = Colaboradores fields = '__all__' colaborador_projeto = forms.CharField(widget=forms.TextInput( attrs={ 'class': 'form-control col-8', 'maxlength': '200', } )) views.py def editar_projeto(request, projeto_id): if request.method == 'GET': projeto_editar = Projeto.objects.filter(id=projeto_id).first() if projeto_editar is None: return redirect(reverse('projeto')) form = PostForm(instance=projeto_editar) form_colab_factory = inlineformset_factory(Projeto, Colaboradores, form=ColabForm, extra=1, max_num=5) form_colab = form_colab_factory(instance=projeto_editar) context = { 'form': form, 'form_colab': form_colab, } return render(request, 'editar_projeto.html', context) elif request.method == 'POST': projeto_editar = Projeto.objects.filter(id=projeto_id).first() if projeto_editar is None: return redirect(reverse('projeto')) form = PostForm(instance=projeto_editar) form_colab_factory = inlineformset_factory(Projeto, Colaboradores, form=ColabForm, extra=1, max_num=5) form_colab = form_colab_factory(request.POST, instance=projeto_editar) if form.is_valid() and form_colab.is_valid(): projeto_editado = form.save() form_colab.instance = … -
Failure of Two forms to work in django template
form template please help me out I have tried three different methods to make sure my two forms submit on a page but i keep getting unbound error, i don't know why thats happening. kindly help, thanks these are my views -
How to extend django admin site template into custom view?
I have created a custom admin view as shows in below picture. It’s name is Duplicate Person Model. I followed this link which has steps, https://learnbatta.com/blog/how-to-add-custom-views-to-django-admin-91/ When I click on it it looks like this. I have added only a label and input box. What I am expecting is it should carry the same design as admin site. But I am not sure how do I implement it. There are different links on page however not sure which one is correct. Please advise. -
Failed to import the Cloud Firestore library for Python - Django Visual Studio
I am trying to use firebase in my python django project. This is on a windows machine using visual studio. I get the error "Failed to import the Cloud Firestore library for Python" when I try to import it: import firebase_admin from firebase_admin import firestore I have tried everything I can find through google including: Manually installing grpcio Downgrading protobuff to various versions. This one actually just ends up with a different error depending on which version of protobuff I go with. Uninstalling and re-installing google-cloud-store and all other dependencies Re-installing and upgrading pip And several other minor things over the course of the day that I can't recall. I am at a dead end after a full day of bashing my head against this. Any other solutions or even a direction to look in? Here is installed packages list: CacheControl 0.12.6 cachetools 4.1.1 certifi 2020.6.20 cffi 1.14.2 chardet 3.0.4 defusedxml 0.6.0 diff-match-patch 20200713 Django 2.2.16 django-import-export 2.3.0 docutils 0.16 et-xmlfile 1.0.1 firebase-admin 4.3.0 google-api-core 1.22.2 google-api-python-client 1.12.1 google-auth 1.21.1 google-auth-httplib2 0.0.4 google-cloud-core 1.4.1 google-cloud-firestore 1.9.0 google-cloud-storage 1.31.0 google-crc32c 1.0.0 google-resumable-media 1.0.0 googleapis-common-protos 1.52.0 grpcio 1.32.0 httplib2 0.18.1 idna 2.10 jdcal 1.4.1 MarkupPy 1.14 msgpack 1.0.0 mysql-connector-python 8.0.21 odfpy 1.4.1 … -
Vue app fetches API data, and objects seem toad into my template, but the text does not appear
I have created a Vue app that fetches data from my Django REST API and shows it on a page. The data consists of a list of objects that resemble {'name': Whitney Portal, 'parent': Inyo National Forest', 'camp_id': 232123} I have an input field that users can type text into, and the Vue app will dynamically display all objects that contain the input text. It appears to be that the app is loading objects into the template, but none of the desired text is showing. I want to show the camp attributes, such as the name for each object. I have attached a random string 'I'm HERE!' in the html to each object generated, so I can see how many objects are displayed at any one time. However that is the only text showing for each object. When I type into my input field, the number of objects (and instances of 'I'm HERE!') changes. The objects respond as expected (I know what text to type into the box to make only one object show). For example, if I type in 'Inyo' then only one object remains (because only one of the objects in my database has 'Inyo National Forest' as … -
How to ignore or skip null values of table when filtering in Django?
I want to ignore or skip a filter clause when the data of that clause is null in the DB, in my case sometimes the digital_exp_score variable is Null, but I need to filter by that variable, the normal filter would be like this: review = Review.objects.get(id=review_id) offers = OfferGeneric.objects.filter( is_personalized=True, digital_exp_score__gte=review.digital ) But when digital_exp_score is Null it won't work, I want to ignore those cases and just pass that condition, How I do that? I have tried with the When Clause: offers = OfferGeneric.objects.filter( is_personalized=True, When(digital_exp_score__isnull=False , then=(digital_exp_score__gte=review.digital) ), ) And offers = OfferGeneric.objects.filter( is_personalized=True, digital_exp_score__gte=When( digital_exp_score__isnull=False, then=review.digital ), ) But neither works, I get syntax error, those methods are only for the value at the right of the condition? Is there any method for checking the values at the left of the condition (the DB values)? Something like this would be ideal: offers = OfferGeneric.objects.filter( is_personalized=True, digital_exp_score__gte=review.digital if digital_exp_score is not None else pass ) -
How to get real-time status updates of Django REST API task?
I have a Django REST API. When i hit GET request on this API, this executes my six python selenium bots one by one, And then returns the status of all bots with 200 code. The problem is that bots take too long to execute, so i want the status of first bot when it completes, then status of second bot, etc in the same GET request like Real Time updates. How can i achieve this? -
Changing Django's model attribute value
in models.py class Auction(models.Model): id = models.AutoField(primary_key=True) name=models.CharField(max_length=64) in views.py def Listing(request,Person_id): Per=Person.objects.get(pk=Person_id) if request.method=="POST": Per.name=(request.POST["Rename"]).cleaned_data Per.save() return render(request,"Projectapp/Person.html",{"Person":Person.objects.get(pk=Person_id)}) but then when checking Per.name it returns the old name. I want to ask how to change an attribute's value of django model after object creation -
DateTimeField object has no attribute strftime
My main code is this: class Post(models.Model): title = models.CharField(max_length=200, unique=True) slug = models.SlugField(max_length=200, unique=True) author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='blog_posts') updated_on = models.DateTimeField(auto_now=True) image = models.ImageField(upload_to='images/%Y/%m/%d/', blank=True) content = models.TextField() created_on = models.DateTimeField(auto_now_add=True) status = models.IntegerField(choices=STATUS, default=0) publishdate = created_on.strftime('%Y/%m') class Meta: ordering = ['-created_on'] def __str__(self): return self.title When I run this code, I get: 'DateTimeField' object has no attribute 'strftime' referring to publishdate strftime works with datetime.datetime, and DateTimeField converts to datetime.datetime, so what am I doing wrong? I've tried to convert to datetime.datetime to no avail -
Django Microsoft Authentication
I'm trying to include in my Django website the possibility to sign in using a Microsoft login. I have set up a new App registration and included the below as redirect urls. I then followed this set of instruction in my Django site: https://django-microsoft-auth.readthedocs.io/en/latest/usage.html However when trying to access the admin module and click Microsoft, I'm getting this error. django version: 3.0.4 python version: 3.8.5 -
Django: image tag expected an Image object, got <ImageFieldFile: profile_pics/file_x.jpg>
I'm rendering the photo of a user in a Django/Wagtail template. I've rendered other images in other Wagtail pages, all of them uploaded through the Wagtail Admin page. However, this time I need to render on a Wagtail Page model from a Profile that asks for a photo when user signs up. in the HTML I'm using: {% image page.user.profile.photo fill-150x150 as post_img %} <a href="{{ post.url }}"> <img src="{{ post_img.url }}" class="mr-3" alt="{{ post_img.alt }}"> </a> But getting this error: If I delete that part, the template render ok, of course without the photo. Wagtail model: class PastorPage(Page): template = 'ministros/pastor_page.html' user = models.ForeignKey( settings.AUTH_USER_MODEL, blank=False, null=False, related_name="+", on_delete=models.SET(get_sentinel_user), ) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock(classname='text_and_title')), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ StreamFieldPanel('content'), FieldPanel('user'), ] class Meta: verbose_name = 'Pastor' verbose_name_plural = 'Pastores' -
Django User Login Issue
I am back again with a Django Question. I am having issues with getting my login screen to work. I feel like maybe this is a simple issue that I am just not seeing. I am using the current versions of Python and Django. I am getting a NoReverseMatch error when trying to access my login page. Here is the code, along with some screen shots: base.html: <p> <a href="{% url 'learning_logs:index' %}">Learning Log</a> - <a href="{% url 'learning_logs:topics' %}">Topics</a> - {% if user.is_authenticated %} Hello, {{ user.username }}. {% else %} <a href="{% url 'users:login' %}">log in</a> {% endif %} </p> {% block content %}{% endblock content %} login.html: {% extends "learning_logs/base.html" %} {% block content %} {% if form.errors %} <p>Your username and password didn't match. Please try again.</p> {% endif %} <form method="post" action="{% url 'users:login' %}"> {% csrf_token %} {{ form.as_p }} <button name="submit">log in</button> <input type="hidden" name="next" value="{% url 'learning_logs:index' %}"/> </form> {% endblock content %} users/urls.py: from django.urls import path from django.conf.urls import url from django.contrib.auth.views import LoginView from . import views app_name = 'users' urlpatterns = [ # Login page #path('login/', LoginView, {'template_name': 'users/login.html'}, name='login'), path('login/', LoginView.as_view(template_name='users/login.html')), ] Code location Error message -
Django channels Async Websocket throwing Error while trying to use database query
I don't get it. Even though I've converted all the required fields in async await. But still I'm getting the following error: HTTP GET /chat/8/ 200 [0.02, 127.0.0.1:51354] WebSocket HANDSHAKING /ws/chat/8/ [127.0.0.1:51356] Exception inside application: You cannot call this from an async context - use a thread or sync_to_async. Traceback (most recent call last): File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/channels/sessions.py", line 183, in __call__ return await self.inner(receive, self.send) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/channels/middleware.py", line 41, in coroutine_call await inner_instance(receive, send) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/channels/consumer.py", line 58, in __call__ await await_many_dispatch( File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/channels/utils.py", line 51, in await_many_dispatch await dispatch(result) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/channels/consumer.py", line 73, in dispatch await handler(message) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/channels/generic/websocket.py", line 175, in websocket_connect await self.connect() File "/media/fahadmdkamal/WORK/B-DOPS/api/chat/consumers.py", line 23, in connect other_user = await sync_to_async(User.objects.get(id=others_id)) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/db/models/query.py", line 411, in get num = len(clone) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/db/models/query.py", line 258, in __len__ self._fetch_all() File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/db/models/query.py", line 1261, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/db/models/query.py", line 57, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1150, in execute_sql cursor = self.connection.cursor() File "/media/fahadmdkamal/WORK/B-DOPS/api/env/lib/python3.8/site-packages/django/utils/asyncio.py", line 24, in inner raise SynchronousOnlyOperation(message) django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async. WebSocket DISCONNECT /ws/chat/8/ [127.0.0.1:51356] The error says I … -
Django REST framework: data not posting to database
So i've been banging my head against a wall for a good few hours, thinking I understoodthe django rest framework but I clearly don't. when I try adding an entry via the todo-create api it gives me {'list_item': None, 'complete': False} when I print the serializer without the .data it recognises that there was something inputted into the list_item, but it won't send to the database: TodoSerializer(data=<QueryDict: {'_content_type': ['application/json'], '_content': [' {\r\n "list_item": "test item",\ r\n "complete": false\r\n }']}>): list_item = CharField(allow_null=True, max_length=100, required=False) complete = BooleanField(required=False) I am also getting the following in the terminal: Method Not Allowed: /project2/todo/todo-create/ [14/Sep/2020 23:49:55] "GET /project2/todo/todo-create/ HTTP/1.1" 405 8987 View.py from rest_framework.decorators import api_view from rest_framework.response import Response from .serializers import TodoSerializer @api_view(['GET']) def apiOverview(request): api_urls = { 'List': '/todo-list/', 'Detail View': '/todo-detail/<str:pk>/', 'Create': '/todo-create/<str:pk>/', 'Update': '/todo-update/<str:pk>/', 'Delete': '/todo-delete/<str:pk>/', } return Response(api_urls) @api_view(['GET']) def todoList(request): todo = Todo_list.objects.all() serializer = TodoSerializer(todo, many=True) return Response(serializer.data) @api_view(['GET']) def todoDetail(request, pk): todo = Todo_list.objects.get(id=pk) serializer = TodoSerializer(todo, many=False) return Response(serializer.data) @api_view(['POST']) def todoCreate(request): serializer = TodoSerializer(data=request.data) if serializer.is_valid(): serializer.save() else: print("issue with data") print(serializer.errors) print(serializer.data) return Response(serializer.data) @api_view(['POST']) def todoUpdate(request, pk): todo = Todo_list.objects.get(id=pk) serializer = TodoSerializer(instance=todo, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data) settings.py INSTALLED_APPS … -
Django Form Get Foreign Key Data In Add Form
I am trying to add a "note" to an "applicant," but in the create note form I would like the applicant's name to show above the form. Right now the tags ( {{ applicant.full_name }} ) are not working in the create form template. Here is part of my CreateNote view currently. Thank you for any assistance. def form_valid(self, form): applicant_pk = self.kwargs['pk'] applicant = Applicant.objects.get(pk=applicant_pk) self.object = form.save(commit=False) self.object.applicant = applicant self.object.save() return super(NoteCreate, self).form_valid(form) -
Blog content doesn't show on the html blog page
[Blog content doesn't show on the html page][1] [1]: https://i.stack.imgur.com/SH4OQ.jpg`Hello Blog this is Zee's blog for python {% for blog in blogs %} {{ blog.title }} {{ blog.date }} {{ blog.description }} {{ blog.summary }} {% endfor %}` -
django custom user model form widgets working only for email and name field
in my custom user model that is created with AbstractBaseUser when i try to add widgets which lets me add classes or place holders or input type etc.. it works only for the full_name and email fields but not for password1 and password2 in my models.py from django.db import models from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.conf import settings class MyAccountManager(BaseUserManager): def create_user(self, email, full_name, password=None): if not email: raise ValueError('Users must have an email address') if not full_name: raise ValueError('Users must have a name') user = self.model( email=self.normalize_email(email), full_name=full_name, ) user.set_password(password) user.save(using=self._db) return user def create_superuser(self, email, full_name, password): user = self.create_user( email=self.normalize_email(email), full_name=full_name, password=password, ) user.is_admin = True user.is_staff = True user.is_superuser = True user.save(using=self._db) return user class User(AbstractBaseUser): email = models.EmailField(verbose_name="Email",max_length=250, unique=True) username = models.CharField(max_length=30, unique=True, null=True) date_joined = models.DateTimeField(verbose_name='Date joined', auto_now_add=True) last_login = models.DateTimeField(verbose_name='Last login', auto_now=True) is_admin = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) full_name = models.CharField(verbose_name="Full name", max_length=150, null=True) profile_pic = models.ImageField(null=True, blank=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['full_name'] objects = MyAccountManager() def __str__(self): return self.full_name # For checking permissions. def has_perm(self, perm, obj=None): return self.is_admin # For which users are able to view the app (everyone is) def has_module_perms(self, app_label): … -
How to delete all empty tags in admin with Taggit in Django?
I'm using tags with Taggit and I want to delete an empty tag if it's not associated with a post. This works for the user view but for the admin it doesn't. If I delete a tag from a post in the admin and that tag has 0 posts associated with it, it still exists. Any way to accomplish this for the admin? I was thinking of a function that would run every time the admin dashboard loads and deletes all the empty tags. Admin.py from django.contrib import admin from FileUpload.models import Uploaded class UploadedAdmin(admin.ModelAdmin): list_display = ('name', 'time_uploaded', 'file', 'tag_list') list_filter = ['time_uploaded', 'tags'] class Media: pass def get_queryset(self, request): return super().get_queryset(request).prefetch_related('tags') def tag_list(self, obj): tags = obj.tags.all() return u", ".join(o.name for o in tags) # Register your models here. admin.site.register(Uploaded, UploadedAdmin) -
In which case should I use nosql (mongodb) and in which case postqresql?
1-) I'm building a real estate site. There will be notification, messaging and posting models. Which of these models should I use with which databases? 2-) I'm using express and vue js. Should I use Nuxt.js? I have a chance to use Django. But I can't use channels successfully in django. Can I do this by using node js and django together? -
All the REST API endpoint calls logged in a log file
what is best way to logged in all REST API endpoint calls in a log file ? any kind of help would be highly appericated -
TypeError & AssertionError when clicking on buttons in Django
Apologies for the long post, I am trying to implement a simple button which either add or remove an item from a watchlist. While I initially managed to implement the "addwatchlist" function appropriately, I tinkered my code for a few hours and I somewhat am unable to wrap my head around it again. Here is the error that I receive when pressing the "Add to Watchlist" button : TypeError at /addwatchlist/10 Field 'id' expected a number but got <Listing: "Gloss + Repair Spray">. Request Method: GET Request URL: http://127.0.0.1:8000/addwatchlist/10 Django Version: 3.1.1 Exception Type: TypeError Exception Value: Field 'id' expected a number but got <Listing: "Gloss + Repair Spray">. TRACEBACK : watchlist.save() ▼ Local vars Variable Value id 10 request <WSGIRequest: GET '/addwatchlist/10'> watchlist Error in formatting: TypeError: Field 'id' expected a number but got <Listing: "Gloss + Repair Spray">. Here is the error that I receive when pressing the "Remove from Watchlist" button, note that this is the exact same error I initially received which in turn forced me to try and tweak the way "Add to Watchlist" function : AssertionError at /removewatchlist/1 Watchlist object can't be deleted because its id attribute is set to None. Request Method: GET … -
AttributeError at /sitemap.xml [closed]
'function' object has no attribute 'values' urls.py [sitemaps.py][2]P.png -
Cannot assign "<User: user.name>: must be a "User" instance
I am having an issue writing a custom django migration where I am trying to set a field value for a model to a user. The model in question is shown below (CustomerMachine). This model uses the django-simple-history module to track changes in model instances. I am attempting to query the instance history in the migration and set the review_submitter value to the last user which edited the instance. The result of the history query history_user returns a <class 'django.contrib.auth.models.User'> type, but when I try to set the review_submitter to that value I get the following error: ValueError: Cannot assign "<User: user.name>": "CustomerMachine.review_submitter" must be a "User" instance. Any insight into whats going on here? simplified class example class CustomerMachine(models.Model): review_submitter = models.ForeignKey(settings.AUTH_USER_MODEL, default=None) history = HistoricalRecords() custom migration from __future__ import unicode_literals from __future__ import absolute_import from django.conf import settings from django.db import migrations, models from django.contrib.auth.models import User from acceptance.models import CustomerMachine def set_submitter(apps, schema_editor): machines = apps.get_model('acceptance', 'CustomerMachine') for machine in machines.objects.all(): history = CustomerMachine.history.filter(serial=machine.serial) if history: history_user = history.last().history_user machine.review_submitter = history_user machine.save() def reverse_func(apps, schema_editor): pass # code for reverting migration, if any class Migration(migrations.Migration): dependencies = [ ('acceptance', '0031_auto_20200914_1611'), ] operations = [ migrations.RunPython(set_submitter, … -
Django Admin multiple count issue
I have an issue with duplicated call of count method from Django Admin. Here is my code. class AdminPaginator(Paginator): @property def count(self): cursor = connection.cursor() cursor.execute("SELECT reltuples FROM pg_class WHERE relname = %s", [query.model._meta.db_table]) count = int(self.cursor.fetchone()[0]) return count ... Code from Admin Model list_per_page = 50 show_full_result_count = False def get_queryset(self, request): """ Overrides default query to exclude test entities. """ qs = super().get_queryset(request) active_entities = qs.filter(is_active=False) return qs.exclude(id__in=active_entities) count method calls for 4 times and I don't know why. Thanks for your help! -
Django can't get REMOTE_USER
I need to create SSO Authentication using Kebreros in my Django project. I faced with problem when tried to get username from request.META['REMOTE_USER']. KeyError happens. It seems that variable REMOTE_USER is not set but I don't understand why. I added RemoteUserMiddleWare and RemoteUserBackend as it's said in docs. 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.auth.middleware.PersistentRemoteUserMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',] AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.RemoteUserBackend',] Apache config: <VirtualHost *:80> ServerName test.wit.net ServerAlias test.wit.net DocumentRoot /var/www/test.wit.net/public_html ProxyPass / http://localhost:8000/ ProxyPassReverse / http://localhost:8000/ ProxyPreserveHost On ProxyTimeout 300 RequestHeader set X-Forwarded-Proto "http" <Location "/"> # Kerberos authentication: AuthType Kerberos AuthName "SRV-APP auth" KrbMethodNegotiate on KrbMethodK5Passwd off KrbServiceName HTTP/test.wit.net@WIT.NET KrbAuthRealms WIT.NET Krb5Keytab /etc/krb5.keytab KrbLocalUserMapping On Require valid-user </Location> SSO works Apache authentificate user successfully, but I can't pass REMOTE_USER to Django. What could be wrong?