Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django breadcrumbs with different kwargs in template
I am trying to implement breadcrumbs in my app. The question I have, is how can I successfully pass the island kwargs to sites_detail.html without causing a NoReseverseMatch error? Obviously, wth the current implementation I get: Reverse for 'sites' with keyword arguments '{'island': ''}' not found. base.html <li><a href="{% url 'sites' island='ni'%}">North Island</a></li> <li><a href="{% url 'sites' island='si'%}">South Island</a></li> site_list.hml {% block breadcrumbs %} {{ block.super }} » <a href="{% url 'sites' island=view.kwargs.island %}">{{ view.kwargs.island }}</a> {% endblock %} sites_detail.html {% extends "palaeo_app/sites_list.html" %} {% block breadcrumbs %} {{ block.super }} » {{ sites.location }} {% endblock %} Thankyou! -
Django telegram bot reply keyboard not working
i have a problem. I've just installed Django with django-telegram-bot package and I use a function from examples and it basically return a message to user. What I want is to send a reply_keyboard to him. It's strange, but its not working. Here is my code: from telegram.ext import CommandHandler, MessageHandler, Filters from telegram import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton from django_telegrambot.apps import DjangoTelegramBot def me(bot, update): keyboard = [ [ InlineKeyboardButton("Option 1", callback_data='1'), InlineKeyboardButton("Option 2", callback_data='2') ], [ InlineKeyboardButton("Option 3", callback_data='3') ] ] reply_markup = InlineKeyboardMarkup(keyboard) # THIS IS PRINTING TEXT BUT Not keyboard! update.message.reply_text('Please choose:', reply_markup=reply_markup) # Again sent text bot.sendMessage(update.message.chat_id, text='text works' ,reply_markup=markup) I stuck already for 3 days with this problem. -
Django - Form in a dynamic HTML table
I am trying to create a HTML table, with a 2 fields on each row for the user to fill in (sports matches predictions). Right now I have a cycle which loops through the matches and based on that creates the HTML table. input.html {% block body %} <form method="post"> {% csrf_token %} <table class="table"> <tr> <th>Round</th> <th>Date</th> <th>Time</th> <th>Home</th> <th class="col-md-1"></th> <th class="col-md-1"></th> <th class="col-md-1"></th> <th>Away</th> </tr> {% for item in query_results %} <tr> <td>{{ item.match_round }}</td> <td>{{ item.match_date }}</td> <td>{{ item.match_time }}</td> <td>{{ item.home_team_name }}</td> <td>{{ form.home_goals_predictions|add_class:"form-control"}}</td> <td class="text-center">:</td> <td>{{ form.away_goals_predictions|add_class:"form-control"}}</td> <td>{{ item.away_team_name }}</td> </tr> {% endfor %} </table> <button type="submit" class="btn btn-success">Submit</button> </form> {% endblock %} This is works and display the table excatly as I want. However I am not able to extract the data as I want from it - to be more exact, when submiting the form, the data from the last row gets assigned to all the rows. views.py if request.method == 'POST': form = PredictionsForm(request.POST) if form.is_valid(): user_prediction = form.save(commit = False) for result in query_results.all(): for home_goals_predictions, away_goals_predictions in form.cleaned_data.items(): user_prediction.id = result.id user_prediction.match_round = result.match_round user_prediction.home_team_name = result.home_team_name user_prediction.away_team_name = result.away_team_name user_prediction.user_id = request.user.id user_prediction.home_goals_predictions = form.cleaned_data['home_goals_predictions'] user_prediction.away_goals_predictions = form.cleaned_data['away_goals_predictions'] … -
Python 3.6.x / Django 2.0.x uuids in paths failig
Python: 3.6.3 // Django: 2.0.2 I am trying two new things at one time. Class Based Views and using UUIDs as "account numbers". urls.py is: from django.urls import path, re_path from .views.index import * from .views import profile urlpatterns = [ re_path(r'^$', index.IndexDetailView.as_view(), name='index'), path('Members', index.IndexDetailView.as_view(), name='index'), path('Members/Profile/<uuid:account_number>/', profile.ProfileDetailView.as_view(), name='profile-detail'), path('Members/Profile/<uuid:account_number>/edit', profile.edit), path('Members/Profile/create', profile.create), ] "Profile" is an extension of the "User" model. The Profile includes an account_number field: account_number = models.UUIDField( max_length=32, default=uuid.uuid4, editable=False, unique=True, blank=False, null=False, ) The ``DetailView` I am trying out is: class ProfileDetailView(DetailView): model = Profile pk_url_kwarg = "account_number" template_name = 'Members/profile2.html' @verified_email_required def get_object(self, queryset=None): queryset = self.get_queryset() if queryset is None else queryset profile = get_object_or_404(queryset, account_number=self.kwargs['account_number']) # profile = super().get_object() return profile @verified_email_required def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form_readonly'] = True return context There is a "partial" view/template that displayes the Profile info. It contains an "Edit" button that looks like: <div id="profileDetails" class="profileDetails"> <h4>Account Holder Details:</h4> <table class="profileDetails text-left"> <tbody> <tr> <th>Name</th> <td>{{ profile.last_name }}, {{ profile.first_name }}{% if profile.middle_name %} {{ profile.middle_name }}{% endif %}</td> </tr> <tr> <th>Address</th> <td>{% if profile.address1 %} {{ profile.address1 }}<br> {% endif %} {{ profile.address2 }}<br> {{ profile.city }}, {{ profile.state }} {{ profile.zip … -
Django staticfiles_dirs not working correctly
I'm working with this website http://fotokluczniok.pl/ now. If You press F12 You will see the staticfiles do not work correctly. Here is my seetings.py code: STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), '/home/fotoklu/fotokluczniok/static/', ] STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static') Here is urls.py code: if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) Project structure: CLICK HERE How to solve this problem ? -
Django-Rest: Poping validated data
My goal is to add tags to a post. I'm using latest taggit and DRF. Goal: To pop tags only from posted request. For each tag in the post request to call post.tags.add("tag1","tag2") to add these tags to the model. Currently, my post serialiser is: class PostSerializer(serializers.ModelSerializer): tags = serializers.ListField( child=serializers.CharField(min_value=0, max_value=3) ) ... def create(self, validated_data): tags_data = validated_data.pop('tags') # Need to pop tags only to_be_tagged, validated_data = self._pop_tags(validated_data) images_data = self.context.get('view').request.FILES post = Post.objects.create(**validated_data) post.tags.add(tags_data) for image_data in images_data.values(): PostImage.objects.create(post=post, image=image_data) return post When I send a post request with the following data: data = { 'title': 'First Post', ... 'tags':'["tag1"]'} I get an error: File "/app/.heroku/python/lib/python3.6/site-packages/rest_framework/serializers.py" in save 214. self.instance = self.create(validated_data) File "/app/app/serializers.py" in create 111. post.tags.add(**validated_data) File "/app/.heroku/python/lib/python3.6/site-packages/taggit/utils.py" in inner 145. return func(self, *args, **kwargs) Exception Type: TypeError at /app/posts/ Exception Value: add() got an unexpected keyword argument 'title' -
Django + Angular 5 development setup CSRF handling
I am having a bit of an issue with my current development setup when it comes to CSRF verification. Since I am running an angular development server and a django development server side by side and (naturally) need to send requests to the backend, CSRF becomes an issue. Django usually hands the token out when a user connects, but now that the front- and backend are so disconnected I do not get the CSRF token in the natural way. What I now tried was to add a @csrf_exempt decorated function to be able to get the cookie, also by decorating the function with @ensure_csrf_cookie. The problem I am having is that still when setting the appropriate header for the request to include the CSRF token, the server still returns me a message saying that the CSRF cookie was not included (bullshit!). So, my question is firstly how to properly set the header for the CSRF token, this is how I currently do it (typescript below): constructor(private httpClient: HttpClient) { const cookies = document.cookie.split(';'); for (let cookie of cookies) { cookie = cookie.trim(); const re = new RegExp('^csrftoken'); if (re.test(cookie)) { this.csrfToken = cookie; // this.csrfToken = cookie.substr(10, cookie.length); break; } … -
Django ModelForm : How to use update_or_create on form.save()?
I have a Questions model with question_no being unique. I would like to update the question or create a new one if not exists. models.py class Questions(models.Model): question_no = models.CharField(max_length=255,blank=False,unique=True) question_img = models.ImageField(upload_to='avirbhav/2/images/ques/',blank=False) question_desc = models.CharField(max_length=255,blank=True) question_ans = models.CharField(max_length=255,blank=False) date_created = models.DateTimeField(auto_now_add=True) forms.py class UploadForm(forms.ModelForm): class Meta: model = Questions fields = ('question_no','question_img','question_desc','question_ans') views.py def upload_admin(request): if request.method=='POST': form = UploadForm(request.POST, request.FILES) if form.is_valid(): form.save() return JsonResponse({'created':'True'}) Now, the above code throws an error: Questions with this Question no already exists. I would have done it the other way with: question_no = form.cleaned_data['question_no'] question_img = form.cleaned_data['question_img'] question_desc = form.cleaned_data['question_desc'] question_ans = form.cleaned_data['question_ans'] question, created = Questions.objects.update_or_create(question_no=question_no,defaults={"question_img":question_img,"question_desc":question_desc,"question_ans":question_ans}) But I would like to update the database with form.save(). I need to save the image to a folder, and also update the database. I there any other way to do it? like overriding the save() to create_or_update database???? -
No module named 'django.contrib.postgres.search' Error
Trying to build a full text search view in Django, but getting this error message when I try to run the server: No module named 'django.contrib.postgres.search I did just switch my db from sqlite to postgres, so not sure if there is some sort of error that happened in that move here is my full stack trace Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x06B2D1E0> Traceback (most recent call last): File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception six.reraise(*_exception) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 115, in populate app_config.ready() File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\debug_toolbar\apps.py", line 15, in ready dt_settings.patch_all() File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\debug_toolbar\settings.py", line 243, in patch_all patch_root_urlconf() File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\debug_toolbar\settings.py", line 231, in patch_root_urlconf reverse('djdt:render_panel') File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\urlresolvers.py", line 568, in reverse app_list = resolver.app_dict[ns] File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\urlresolvers.py", line 360, in app_dict self._populate() File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\urlresolvers.py", line 293, in _populate for pattern in reversed(self.url_patterns): File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\urlresolvers.py", line 417, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Users\crstu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 33, in __get__ res … -
How do I make a django model form whose authorization can only be done by admin for positng?
So I have the following models.py class Incubators(models.Model): # These are our database files for the Incubator Portal incubator_name = models.CharField(max_length=30) owner = models.CharField(max_length=30) city_location = models.CharField(max_length=30) description = models.TextField(max_length=2500) rating = models.FloatField(validators=[MinValueValidator(0), MaxValueValidator(10)]) logo = models.CharField(max_length=30) picture = models.CharField(max_length=30) def __str__(self): # Displays the following stuff when a query is made return self.incubator_name + '-' + self.owner Now what I am trying to do is create a form for user who has to fill the above field for advertising there incubator on the wall. Before posting, I want to make sure that these details get verified by the admin (django admin), and after verification from admin it gets posted on the wall ? Is there any model field for the same specially meant for admin ? -
How to save data to database at 1 minute intervals on Django?
I'm writing a django survey application and it's required to save votes on a queue structure and at 1 minute intervals save the elements of the queue on database. Thats for save I/O overhead. Currently I'm saving the votes directly from my votes view: def vote(request, question_id): question = get_object_or_404(Question, pk=question_id) selected_choice = question.choice_set.get(pk=request.POST['choice']) selected_choice.votes += 1 selected_choice.save() return HttpResponseRedirect(reverse('enqueteapp:results', args=(question.id,))) My problem is that I don't know where I can start the queue and the thread to do what I need to do. PS: I don't wanna know if there is a better way to do it. I'm required to use the queue stuff. -
Host Django site on windows on lan
I have a site that I want to expose to a bunch of colleagues that serves as an interface for some Machine learning tools. I’ve made the site in Django 2.0 and would like to serve it from a small windows PC under my desk, and then from a more dedicated server once it’s operational. I’ve had a look around and it looks like my options are using uWSGI or Django it self to serve the site. Obviously Django is mich slower, but on a PC with an i5 i recon it should be able to handle a couple of requests a minute, which is the peak traffic I’m expecting. FastCGI appears to be depreciated, so what other options, prioritizing ease of confit on my part are there? -
ImportError: No module named googleads
I have a django project and want to deploy it on Google App Engine(GAE). I followed all this link for the tutorial: https://cloud.google.com/python/django/appengine When I finished deploying, and go to my project URL, I got an error and when I look on the Error Reporting in Google Cloud Platform It says "ImportError: No module named googleads", but I already installed it on my local before I uploaded it. Please help! Thanks! -
how to install packages inside virtualenv
I have a virtualenv created for a Django project. Inside this project I have app folder with 'views.py'. I have installed beautiful soup and requests inside this virtualenv and they import correctly into the 'views.py'. However, for testing puroposes I have another script created inside the same folder as 'views.py' but when I try to import same modules there I get 'no module named...' error. Is that possible? -
How to update database in django without taking id of the object
When i am doing a post request without id of the object it is showing "subject": [ "This field is required." ] subject has a field called title , so can i update the database using the title. -
Why is Postgres query faster than Redis query?
I am learning about Redis, and how its blazing fast since its an in-memory database. In my Django application, I have a Postgres table with about 1500 rows in it. The model only has two fields 'name' and 'occurrence'. To test out how much faster it would be to query for objects out of memory, compared to from my local database, which I believe is stored on disc, I created two queries 1) Simple order by query using Django objects manager 2) ZRANGE command on Redis server, getting same items back from a Redis sorted set. After making both queries, I found that getting the same number of items from a Redis sorted set took 250 times longer than it took to make the Postgres Query. Why is this ? Script def get_word_results(request): now = datetime.datetime.now() words = Word.objects.all().order_by('-occurrence') after = datetime.datetime.now() diff = (after - now).total_seconds() * 1000 print(diff) rnow = datetime.datetime.now() words_redis = redis_server.zrange(name='myzset', start=0, end=-1, withscores=True) rafter = datetime.datetime.now() diff2 = (rafter - rnow).total_seconds() * 1000 print(diff2) Results 0.199 48.048 -
django heroku server error
i have a django project which was uploaded to heroku. In my django project I used redis also to store some data. the application works on heroku but It happens that when ever I click a link, I get the error Server Error (500) I do not know the cause of the error but here is my redis setting that I use on local and development server. #REDIS FOR VIEWS REDIS_HOST = 'localhost' REDIS_PORT = 6379 REDIS_DB = 3 further codes would be provided on request -
How to execute Django project commands from Visual Studio
I can't find a way to run Django commands within a Visual Studio Project. I need to run the following command to fix my recent migration issue: python manage.py makemigrations --merge I found 2 options to open a command window, but none of them is suitable for this type of action (Open Interactive Window & Open in PowerShell). existing VS options Django Management Console Please advise. -
django db routing incorrect migrations
I've got a setup where my django instance is using 4 different databases. I've written a router per db to ensure I am writing to the correct db: class AppRouter: def db_for_read(self, model, **hints): if model._meta.app_label == 'myapp': return conf['db_name'] return None def db_for_write(self, model, **hints): if model._meta.app_label == 'myapp': return conf['db_name'] return None def allow_relation(self, obj1, obj2, **hints): if obj1._meta.app_label == 'myapp' or \ obj2._meta.app_label == 'myapp': return True return None def allow_migrate(self, db, app_label, model_name=None, **hints): if app_label == 'myapp': return db == conf['db_name'] return None This router is supposed to write/read/migrate some specific models to the db in question. This db should not contain the default tables. However when migrating, both my default db and this db will receive all models from auth and other packages. settings.py: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': config('DEFAULT_DB_NAME'), 'USER': config('DEFAULT_DB_USER'), 'PASSWORD': config('DEFAULT_DB_PASSWORD'), 'HOST': config('DEFAULT_DB_HOST'), 'PORT': config('DEFAULT_DB_PORT', cast=int), 'COMMAND_TIMEOUT': 5, 'ATOMIC_REQUESTS': True, }, 'myapp': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': config('MYAPP_DB_NAME'), 'USER': config('MYAPP_DB_USER'), 'PASSWORD': config('MYAPP_DB_PASSWORD'), 'HOST': config('MYAPP_DB_HOST'), 'PORT': config('MYAPP_DB_PORT', cast=int), 'COMMAND_TIMEOUT': 5, ......... }, DATABASE_ROUTERS = [ 'myapp.db_router.AppRouter', 'myapp2.db_router.AppRouter', 'myapp3.db_router.AppRouter', 'myapp4.router.Router', ] Thoughts? :) -
Enums in Django and Graphene always result in null
I am having some issues trying to use enums with Django and Graphene. Even though the values of the enum are persisted in the SQLite and are retrieved properly, it keeps resulting in an error. Below is a sample of the error. { "message": "Cannot return null for non-nullable field DjangoObject.vanillaEnum.", "locations": [ { "line": 10, "column": 5 } ] }, I'm using Django 2.0.3 and Graphene 2.0.1 with Anaconda3 5.0.0 and Python 3.6.4. I managed to reproduce the error using a trivial example, which is available on my GitHub account. In the models.py, I defined a Python Enum and a Django model that uses that enum. The models here work as intended (AFAIK) without involving any Graphene dependencies. The default SQLite database also appears to have the correct values. models.py import enum from django.db import models @enum.unique class VanillaEnum(enum.Enum): RED = enum.auto() BLUE = enum.auto() GREEN = enum.auto() @classmethod def choices(cls): return tuple((x, x) for x in cls) class DjangoModel(models.Model): name = models.CharField(max_length=20) vanilla_enum = models.CharField(choices=VanillaEnum.choices(), default=VanillaEnum.GREEN, max_length=20) def __str__(self): return f'name={self.name}, vanilla_enun={self.vanilla_enum}' Next, in the schema.py, I defined the two enums. One uses the graphene.Enum.from_enum to convert the VanillaEnum into one that supposedly Graphene can use. The second … -
Fail to return context and var to the html in django
I want to render context_dic and the current time to my html file(inherit form another html) But it doesn't work. Could anybody help me fix this problem? Thanks a lot! This is my python file def homepage(request): now=datetime.datetime.now() list_list = List.objects.order_by('author') context_dict = {'Lists': list_list} return render(request, ('index.html',context_dict), {'current_date':now}) And here is my base.html <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>This is my base page.</title> </head> <body> <p>Hello.</p> {% block content %}{% endblock %} </body> {% block footer%} <p>It is now {{current_date}}.</p> {% endblock %} </html> And index.html {% extends "about.html"%} {% block content %} {% if lists %} <ul> {% for list in lists %} <li><a href="/List/{{ list.slug }}">{{list.title }}</a> </li> {% endfor %} </ul> {% else %} <strong>There are no lists present.</strong> {% endif %} {% endblock %} My url is like this url(r'^home',homepage), -
Django rest framework Custom User model with token error
I've tried to use custom user model instead of default user. My Django project structure is below. Project name : project_rest App name : app_rest To make it happen, I refer https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#substituting-a-custom-user-model [settings.py] AUTH_USER_MODEL = 'app_rest.User' [models.py] from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from rest_framework.authtoken.models import Token from django.conf import settings from django.contrib.auth.models import AbstractUser @receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_auth_token(sender, instance=None, created=False, **kwargs): if created: Token.objects.create(user=instance) class User(AbstractUser): username = models.CharField(unique=True, null=False, max_length=254) password = models.CharField(max_length=200) [serializers.py] from app_rest.models import User from rest_framework import serializers class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('username', 'password') [views.py] from django.shortcuts import render from app_rest.serializers import UserSerializer from app_rest.models import User from rest_framework import viewsets class UserViewSet(viewsets.ModelViewSet): queryset = User.objects.all() serializer_class = UserSerializer [urls.py] from django.conf.urls import url, include from app_rest import views from rest_framework import routers from django.contrib import admin from rest_framework.authtoken import views as rest_views router = routers.DefaultRouter() router.register(r'user', views.UserViewSet) urlpatterns = [ url(r'^', include(router.urls)), url(r'^token-auth/', rest_views.obtain_auth_token), url(r'^admin/', admin.site.urls), ] I seems work properly, But when I delete user, It throws error. IntegrityError at /admin/app_rest/user/1/delete/ (1452, 'Cannot add or update a child row: a foreign key constraint fails ('rest'.'django_admin_log', CONSTRAINT 'django_admin_log_user_id_c564eba6_fk_auth_user_id' FOREIGN KEY ('user_id') REFERENCES … -
How can I set/provide a default value while django migration?
Scenario: I have a model, Customer class Customer(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() company = models.CharField(max_length=100) and now I updated the company attribute witha ForeignKey relationship as below, class Company(models.Model): name = models.CharField(max_length=100) location = models.CharField(max_length=100) class Customer(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() company = models.ForeignKey(Company) What I need is, when the new migrations applied to the DB,corresponding Company instance must automatically generate and map to the company attribute of Customer instance.Is that possible? How can I achieve this ? -
How to disable IE11 cache in django REST
I have some Internet Explorer problems with my Angular 5 app, because in the IE 11 my get-requests to a django-REST backend are cached by the browser. I found a question suggesting to add special cache-control-headers to the response, but I didn't find a working answer how to do it with Django REST. All other browsers I have tested seem to work without problems. -
Django won't start tests, complaining on fixtures
I'm trying to test an app after making a dump, but Django raises the following error: django.db.utils.IntegrityError: Problem installing fixtures: The row in table 'auth_permission' with primary key '65' has an invalid foreign key: auth_permission.content_type_id contains a value '17' that does not have a corresponding value in django_content_type.id. The problem is that there's no row with primary key 65 in auth_permission table. I've tried --natural-primary/--natural-foreign, but this won't help. Please help.