Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I have some errors in python of django
OperationalError at /admin/firstapp/aritcle/ no such table: firstapp_aritcle Request Method: GET Request URL: http://127.0.0.1:8000/admin/firstapp/aritcle/ Django Version: 2.0.2 Exception Type: OperationalError Exception Value: no such table: firstapp_aritcle Exception Location: C:\Users\GodLike\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 303 Python Executable: C:\Users\GodLike\AppData\Local\Programs\Python\Python36\python.exe Python Version: 3.6.1 Python Path: ['C:\Users\GodLike\Desktop\project\HelloWorld', 'C:\Users\GodLike\AppData\Local\Programs\Python\Python36\python36.zip', 'C:\Users\GodLike\AppData\Local\Programs\Python\Python36\DLLs', 'C:\Users\GodLike\AppData\Local\Programs\Python\Python36\lib', 'C:\Users\GodLike\AppData\Local\Programs\Python\Python36', 'C:\Users\GodLike\AppData\Roaming\Python\Python36\site-packages', 'C:\Users\GodLike\AppData\Local\Programs\Python\Python36\lib\site-packages'] Server time: Fri, 9 Mar 2018 15:55:50 +0000 -
Generate a pdf file after success signal recieved from django-paypal
I'm working on a Django(1.10) project in which I have implemented Paypal payment method. I need to send a pdf file to the user when he completes the payment to our PayPal account. I'm receiving the payment completed signals from PayPal but now I don't know how I can send the pdf file to the user in a new tab. Here's what I have tried: **from signals.py: ** def show_me_the_money(sender, **kwargs): ipn_obj = sender custom = ipn_obj.custom # Undertake some action depending upon `ipn_obj`. if ipn_obj.payment_status == ST_PP_COMPLETED: print('Get success signal') user_info = ast.literal_eval(ipn_obj.custom) if int(user_info['taggedArticles']) > 11: # here i need to generate and send a pdf file to the user in a new tab pass else: print('Get fail signal') I have another view and URL to generate a pdf file, but can I send a post request to that URL and open it in a new tab? Help me, please! Thanks in advance! -
Django Bootstrap input-group-addon on Model Form without separating fields
I'm currently rendering my Django form in the following way: <form action="/student/" method="post"> {% csrf_token %} {% bootstrap_form form %} <input type="submit" value="Launch" class="btn btn-primary"/> </form> I have multiple fields of different types, with different things applied to each field, such as validators and help-text. I have two fields that I would like to add bootstrap spans to. One money field which I'd like to prepend a pound symbol to, and one percentage field which I'd like to append a percentage symbol to, I know that this is possible to do using bootstrap as follows: This input field. <div class="input-group"> <span class="input-group-addon">$</span> <input type="text" class="form-control" placeholder="Price"/> </div> But to do this in my django template would require me to break up the form into specific fields and create field specific html. Such as the solution to This question proposes. What I'm looking for is a way to specify either in the model, or the modelform, an attribute or class which will only apply to a specific field, but will render it as above without breaking up the form. Thank you. Info: Bootstrap-4 Django-2.0.2 Python-3.6.1 -
Django 2.0.3 upgrade 'WSGIRequest' object has no attribute 'user'
Upgrading from 1.11 The actual error displayed with DEBUG on: AttributeError at /admin/ 'WSGIRequest' object has no attribute 'user' Request Method: GET Request URL: http://127.0.0.1:8000/admin/ Django Version: 2.0.3 Exception Type: AttributeError Exception Value: 'WSGIRequest' object has no attribute 'user' Exception Location: /home/tim/anaconda3/envs/dct/lib/python3.6/site-packages/django/contrib/admin/sites.py in has_permission, line 186 Python Executable: /home/tim/anaconda3/envs/dct/bin/python Python Version: 3.6.4 Python Path: ['/home/tim/DII/datacentrictools/tools/dct', '/home/tim/anaconda3/envs/dct/lib/python36.zip', '/home/tim/anaconda3/envs/dct/lib/python3.6', '/home/tim/anaconda3/envs/dct/lib/python3.6/lib-dynload', '/home/tim/anaconda3/envs/dct/lib/python3.6/site-packages'] Server time: Fri, 9 Mar 2018 15:34:04 +0000 Apps: INSTALLED_APPS = ( 'dal', 'dal_select2', 'dal_queryset_sequence', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.facebook', 'allauth.socialaccount.providers.google', 'django_countries', 'tastypie', 'dmgen', 'translator', ) Middleware: MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) All help is appreciated. -
Iterating over both formset and other list at the same time
I am creating a form that is used for gathering movie ratings. All fields in the model are hidden except for the rating variable. The form is in the form of a formset, for creating multiple instances of form. I also want to pass values for the hidden elements in the form, which is in the form of a list of dicts. The form.py: class RecommendationQuestionsForm(ModelForm): userId = forms.IntegerField(min_value = 0) rating = forms.IntegerField(min_value = 0, max_value = 5) class Meta: model = Movies fields = ['userId','movieId','rating'] The model Movies: class Movies(models.Model): movieId = models.IntegerField(primary_key=True) title = models.CharField(max_length=90) genre = models.CharField(max_length=60) The view for the form: @login_required def recommendationquestions(request,user_id,template_name): RecFormSet = formset_factory(RecommendationQuestionsForm,extra = 7) if request.method == 'POST': #some code else: uid = user_id resp_list = MoviesRetrieval.provide_movie_choices(uid) #print(resp_list) form_and_resp = zip(RecFormSet,resp_list) return render(request, 'questions.html', {"form_and_resp":form_and_resp}) Sample of resp_list: [ { "userId": 672, "movieId": 1950, "title": "In the Heat of the Night (1967)" }, { "userId": 672, "movieId": 3741, "title": "Badlands (1973)" }, { "userId": 672, "movieId": 3959, "title": "Time Machine, The (1960)" }, { "userId": 672, "movieId": 4101, "title": "Dogs in Space (1987)" }, { "userId": 672, "movieId": 8572, "title": "Littlest Rebel, The (1935)" }, { "userId": 672, "movieId": 65230, … -
Dynamically combine Q() - OR objects
I am trying to create a dynamic search in this ListView I have. My idea is to specify the fields and the type of search each time I try to inherit this view. My problem is that every time I try to make a search, it works only on the first field of the tuple. In my example: requests__email is the first field, and when I print the object query_q after making a query for 'app', I get the following output: (OR: (AND: ), ('requests__email__icontains', 'app'), (AND: ('requests__email__icontains', 'app'), ('status__icontains', 'app')), (AND: ('requests__email__icontains', 'app'), ('status__icontains', 'app'), ('license_type__name__icontains', 'app'))) I don't understand why, because I am using the operator I thought it would work |= in query_q |= Q(**query_kwargs). If I try to make a search based on the other attributes, status for example, the search doesn't work. views.py class DefaultListView(ListView): searchable_fields = ( ('requests__email', 'icontains'), ('status', 'icontains'), ('license_type__name', 'icontains'), ) def get_queryset(self): form = self.form_class(self.request.GET) if form.is_valid(): if not self.searchable_fields: raise AttributeError('searchable_fields has not been configured.') term = form.cleaned_data['term'] query_kwargs = dict() query_q = Q() # Build a list of Q objects based on the searchable attribute for field, search_type in self.searchable_fields: query_kwargs["{0}__{1}".format(field, search_type)] = term query_q |= Q(**query_kwargs) ordering … -
django Lists are not currently supported in HTML input
Sorry for my english. I want create field, this field must contains list of files. my serializer: class FileSerializer(serializers.Serializer): file = serializers.FileField() class MySerializer(serializers.Serializer): list_files = FileSerializer(many=True, required=False) But in UI i have this text List files Lists are not currently supported in HTML input. How i can fix it? -
Django request object created by current user
I am trying to make a query where the current logged in user can view the Teams they have created. Therefore I am trying to print a list of the UserTeams where the UserID = the current user's ID. I know I need to use the 'owner' field i have created for the Teams, though I don't really know where/ what to do. Here is my view: def teamsview(request): query = UserTeams.objects.filter(userID=request.user) return render(request, 'teammanager/teams.html', { "teams": query}) My Teams and UserTeams models: class Team(models.Model): name = models.CharField(max_length=100) venue = models.CharField(max_length=100) countryID = models.ForeignKey(Countries, on_delete=models.CASCADE) owner = models.ForeignKey(User) def __str__(self): return self.name class UserTeams(models.Model): userID = models.ForeignKey(User,on_delete=models.CASCADE) teamID = models.ForeignKey(Team,on_delete=models.CASCADE) And my HTML: {%for team in userteams%} <h3><a href='/teams/{{userteam.id}}'>{{team.name}}</a></h3> {%endfor%} -
django - prepending a field in the query set that doesn't exist in the model
I have a model that reads from a pre-existing university database. The username is stored as the students id. I'm not able to add a new column to the database in a save or I could use a save function in my model. class Student(models.Model): student_id = models.IntegerField(db_column = 'Student_ID', primary_key = True) statusid = models.IntegerField(db_column = 'StatusID') fname = models.CharField(db_column = 'Student_First_Name', max_length = 35) lname = models.CharField(db_column = 'Student_Last_Name_Formatted' , max_length = 40) class Meta: managed = False db_table = '[Student]' What i'm trying to do is take the username in a query and match it up with another field that is umich.edu/AAA#### as a primary key. I'm defining the request in one function as: def user_list(request): student = Student.objects.all() passing in the argument for students to my template with a POST to the form. In my next view that gets posted def criteria(request): user = request.POST.get('student_id') print(user) student = CourseCriteria.objects.get(universitystudentid = request.POST.get('student_id')) My print/post of user is coming through correctly as the student id, but I need to prepend umich.edu/ to the student_id in the queryset. How can I accomplish this without being able to add that field to my model? -
Iterate over a mock-patched list does not work
I'm trying to mock a Django property named next_automatic_service_days that returns a list of Date objects. Here is how I do: @freeze_time("2029-01-01") def test_create_next_services_on_monday(self): today = date.today() with patch('restaurants.models.RestaurantParameters._next_automatic_service_days', return_value=[today + td(days=i) for i in range(4)]): # Call create_next_services method here On another file: def create_next_services(self): for day in self._next_automatic_service_days: # We should enter this loop 4 times! The problem is, we never enter the loop. When I use ipdb in create_next_services, I can see _next_automatic_service_days is a magic mock, and the return value is a list of 4 items. What is wrong with my code? Thanks. -
Django Template. How to iterate two contexts {% for a, b in c,d %}
I want to iterate over two contexts that coming from my 2 views. How to iterate two contexts in django template for example {% for parent, child in all_parents, all_childs %} But django does not allow write such code. So is there any solution? -
Define POST in coreapi/django rest framework
Is there a way to define the object for a post function in the schema of django rest framework? I have a rest api view: class DocumentView(viewsets.ModelViewSet): ... queryset = Document.objects.all().order_by('pk') serializer_class = serializers.DocumentSerializer pagination_class = LargeResultPagination permission_classes = (IsAuthenticated,) authentication_class = ( Token, ) def perform_create(self, serializer): serializer.save(user=self.request.user) The data that should be posted is of format: { "items": ["a", "b", "c"], "name": "test" } How can I describe that in the schema using coreapi? manual_fields=[ coreapi.Field( "data", required=True, location="body", description='{"items":[], "name":str}', schema=coreschema.Object() ), ]) So at least it will be in the description. This of course is not very convinient, especially igf you need more fields in the to-be-posted JSON, since the description is single-line only in swagger. The most ideal situation would be if I could get the 'items' and the 'name' field as separate fields in the swagger page. I've googled, but I cannot find an answer for this. Al the examples I saw are for get parameters. So what is best practice here? -
How to represent an unknown number of layers in data with Django models
How is the following data structure best represented in a set of Django database models: Top level element An unknown number n of Mid level element(s), n >= 1 Low level element For example: Top Mid Mid Mid Bottom or Top Mid Bottom The issue is that the model for the Mid-level element cannot have both a Mid-level element and a Top-level element as parents. The solutions I can think of are: Two foreign keys in the Mid-level model The mid-level model can have a foreign key relationship with Top and another one with 'self'. This seems hacky because if you want to move down through the layers, you have to check both keys at each layer - when you know that only the first Mid has a relationship with Top, while everything else has a relationship with Mid. class Mid(models.Model): top_parent = models.ForeignKey(Top) mid_parent = models.ForeignKey('self') Make Top an instance of Mid instead Eliminate Top altogether so that Mids always link to other Mids. The issue with this solution is that Top has some unique properties that I don't want to add to Mid if it can be avoided. Use generic relations Use generic relations so that Mid can … -
Python Kerberos gives permission denied error
While authenticating a user against kerberos, I'm getting a permission denied error. checkPassword breaks with permission denied . Any ideas why it might be giving me this error? Any kerberos expert please help. ` from django.conf import settings from django_auth_kerberos.backends import KrbBackend kerb = KrbBackend() result = kerb.authenticate(settings.KRB5_TEST_USER,settings.KRB5_TEST_PASSWORD) Failure during authentication Traceback (most recent call last): File "/var/www/adlm_python/venv/lib/python3.4/site-packages/django_auth_kerberos/backends.py", line 60, in check_password **kerberos.checkPassword(username.lower(), password, getattr(settings, "KRB5_SERVICE", ""), getattr(settings, "KRB5_REALM", ""), getattr(settings, "KRB5_VERIFY_KDC", True))** kerberos.BasicAuthError: ('Permission denied', 13) ` My settings.py file has the following kerberos settings: ` INSTALLED_APPS= [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'users', 'project', 'rest_framework', 'rest_framework.authtoken', 'corsheaders', 'kronos', 'django_auth_kerberos', ] KRB5_REALM = "AURITASAPP.COM" KRB5_SERVICE = 'feroze@AURITASAPP.COM' KRB5_DEBUG = True KRB5_VERIFY_KDC = True KRB5_USERNAME_MATCH_IEXACT = True LOGIN_REDIRECT_URL = '/' AUTHENTICATION_BACKENDS = ( 'django_auth_kerberos.backends.KrbBackend', ) KRB5_TEST_USER = 'feroze' KRB5_TEST_PASSWORD = '*******' ` -
django2/angular4 url (re_path and path)
i can`t solve problem with new django url path... when i try to navigate to another url like localhost/bla/bla/ #file urls.py path(r'^api/', admin.site.urls), path('', TemplateViews.as_view(template_name='index.html')) this will show django Page not found (404) and if i use old re_path syntax: #file urls.py path(r'^api/', admin.site.urls), re_path(r'^.*', TemplateView.as_view(template_name='index.html')) this will show angular4 Page not found (404) how i can solve this issues with new django path? -
How to cache all site pages with Redis in Django?
Is it possible to cache all site pages automatically with Redis in Django? I'm using django-redis package. How could I implement a function to scan all urls and cache each one? -
Django takes too long to render dictionary
Am using django to render a dictionary to the template. The dictionary have some 150k records. It takes more than 30 secs to render the template. I cannot lazy load the data and I need that entire data to be passed to my template in once. Is there any way to render the template in lesser time? This is my view. def report(request): data = mydict() #returns my dictionary return render(request,'app/report.html',{ 'content' : data}) -
Django Administration: Combine admin application model
I am using all auth and created another model ambassadors. I have currently the issue that Django Administration shows me these both models now in two different boxes. Does anyone know how to combine these? Preview My goal is to have Accounts: Email-Addresses Ambassdadors -
AttributeError: 'AnonymousUser' object has no attribute '_meta'
I am experiencing an issue with my Django code whenever I try to sign up with a new normal user'. Which states the following error, with the traceback: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/Ethan/mysite/polls/views.py", line 57, in normalsignup login(request, user) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/contrib/auth/__init__.py", line 154, in login request.session[SESSION_KEY] = user._meta.pk.value_to_string(user) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/utils/functional.py", line 239, in inner return func(self._wrapped, *args) AttributeError: 'AnonymousUser' object has no attribute '_meta' Here are my views.py from django.http import HttpResponse from django.shortcuts import get_object_or_404, render, render_to_response, redirect from django.contrib.auth.decorators import login_required from django.contrib.auth import login, authenticate from django.shortcuts import render, redirect from polls.forms import NormalSignUpForm, VenueSignUpForm, BLSignUpForm, BMSignUpForm, ProfileForm from django.contrib.auth import get_user_model from django.views.generic.detail import SingleObjectMixin from django.views.generic import UpdateView, TemplateView from django.utils.decorators import method_decorator from django.db.models.signals import post_save from polls.models import User user = get_user_model() def signup(request): return render(request, 'signup.html') def normalsignup(request): if request.method == 'POST': form = NormalSignUpForm(request.POST) if form.is_valid(): raw_password = form.cleaned_data.get('password1') email = form.cleaned_data.get('email') user = authenticate(email=email, password=raw_password) login(request, user) return redirect('home') else: form = NormalSignUpForm() return render(request, 'normalsignup.html', {'form': form}) … -
task queue in celery
I have a service that processes data. It is written in Python (Django) and uses Celery for making it asynchronous. Processing our data uses credits. You can also buy credits and this is triggered by a Stripe-webhook. Each action that involves credit changes is listed as a "job". I have 2 Celery tasks all adding a job to a certain JobId database. I use the "job" concept to keep track of which data is processed at which job. models.py: class JobId(models.Model): user = models.ForeignKey(User, blank=True, null=True, default=None) job_time = models.DateTimeField(auto_now_add=True) # current credit level credits = models.IntegerField(default=0, null=True, blank=True) # credit impact / delta of this job credit_delta = models.IntegerField(default=0, null=True, blank=True) tasks.py: task_1_buy_credits(user): # credit level of user is searched in jobs_database (the users last job) # adds one line in the JobId database with the users new credit balance task_2_use_credits(user,data): # upfront unknown amount of data get processed # credit level of user is searched in jobs_database (the users last job) # decide to process job completely or stop if credit level is insufficient My current issue is that when people start multiple jobs at a time, the previous job is not finished yet. As my final credit … -
Key (user_id)=(7) is not present in table "auth_user"
i am using djoser's create token end point to login user but i am getting following error. I have tried google search but could not find any useful answer. -
How to prevent creation of a record based on a related django-guardian permissions?
How do you prevent a model from being created by a specific user in the django admin if the user does not have a specific permission of a related object. So the object has an object level permission with django-guardian: CHANGE_RATE_PERM = 'change_rates' class Project(models.Model): ... class Meta: permissions = ( (CHANGE_RATE_PERM, 'Change Rates'), ) Permissions are assigned with: assign_perm( CHANGE_RATE_PERM, instance.account_manager, instance ) Then I have a related model called Rate that is related to the project: class Rate(models.Model): project = models.ForeignKey( Project, on_delete=models.PROTECT ) rate = MoneyField( max_digits=10, decimal_places=2, default_currency='ZAR' ) So I want to ensure that when a rate is created on django admin a check is made to see whether the user requesting the rate checks for the CHANGE_RATE_PERM for the the project. If there is no permission, an error is given. -
login_required decorator in Django doesn't work
I'm working on a Django(1.10) project in which I need to load a template only for logged in users, which is coming from profile template.I need to load generateCert.html only for logged in user, this template should display the same navbar as profile template because both of these templates have the same header. Here's my generateCert.html template: {% load staticfiles %} {% load static from staticfiles %} {% load mathfilters %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>NAMI Montana | User's Dashboard</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="description" content=""/> <meta name="author" content="http://webthemez.com"/> <!-- css --> <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet"/> <link href="{% static 'css/fancybox/jquery.fancybox.css' %}" rel="stylesheet"> <link href="{% static 'css/flexslider.css' %}" rel="stylesheet"/> <link href="{% static 'css/style.css' %}" rel="stylesheet"/> <script src="https://www.paypalobjects.com/api/checkout.js"></script> <!--Pulling Awesome Font --> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]><![endif]--> <style> input[type="image"] { padding-left: 30%; padding-top: 5%; font-size: 1em; color: #fff; background: transparent; border: 1px solid #fff; font-weight: bold; width: 70%; } </style> </head> <body> <div class="topbar"> <div class="container"> <div class="row"> <div class="col-md-12"> <p class="pull-left hidden-xs"><i class="fa fa-envelope"></i><span>matt@namimt.org </span></p> <p class="pull-right"><i class="fa fa-phone"></i>Tel No. (406) 443-7871</p> </div> </div> </div> </div> <!-- start header --> <header> <div class="navbar … -
Django 1.11 - child template not inheriting from parent
I've read through similar stackoverflow problems and checked that I wasn't making the same mistake. I don't think this is an issue with URLs or Views as the Django-debug-toolbar shows that it's picking up the parent template, but the child template isn't extending that. I have the following project structure: project templates base.html index.html apps charts templates chart_base.html charts.html project/templates/base.html <body> {% block wrapper %} <div id="wrap"> {% endblock %} <div class="container" id="container-main"> {% block body %} {% endblock %} </div> <footer class="footer"> <div class="container"> {% block footer %} {% endblock %} </container> </footer> ....(scripts).... {% block extrajs %} {% endblock %} </body> project/apps/charts/templates/chart_base.html {% extends 'base.html' %} {% block body %} <!-- chartjs container --> <div class='container'> <!-- charts.js code --> {% block chart %} {% endblock chart %} <!-- / charts.js code --> </div> <!-- /chartjs container --> {% include 'base/js.html' %} <script> $(document).ready(function(){ {% block jquery %}{% endblock %} }) </script> {% endblock %} project/apps/charts/templates/charts.html {% extends 'chart_base.html' %} <!-- charts.html jquery --> <script> {% block jquery %} var labels = [] var defaultData = [] var endpoint = '/api/chart/data/' $.ajax({ method: "GET", url: endpoint, success: function(data){ labels = data.labels defaultData = data.default setChart() }, error: function(error_data){ … -
Django with Postgres - ProgrammingError, migrations not updating the database
Recently, I changed a model called 'Objects' by adding a 'description' field (which has null set to True). Ever since I migrated to the Postgres database hooked up to the Django project, I have received the following error whilst trying to access the 'Objects' model. ProgrammingError at /objects/results/ column objects_objects.description does not exist LINE 1: ...1, "objects_objects"."mapped_product_id" AS Col2, "objects_o... Objects model... class Objects(models.Model): mapped_product = models.ForeignKey(Product,related_name='p_objects',verbose_name='Product',null=True,blank=True,on_delete=models.SET_NULL) description = models.CharField(max_length=1000,null=True,blank=True) slug_key=models.SlugField(unique=True) is_active=models.BooleanField(verbose_name='Active',default=False) In the console, Django says migrations are all successful, and when running the local server it does not show that there are unapplied migrations. Any ideas on how to sync the database up with the models from scratch? I do not mind clearing my development database for this, and have already tried removing all of the previous migrations. I understand that this is somewhat vague at this point since I'm unsure what code I should post here - let me know if there is some code I should post here.