Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ImportError: No module named toneapp.settings - when i am running python manage.py makemigrations
toneapp/ manage.py toneapp/ settings/ __init__.py base_settings.py dev_settings.py production_settings.py urls.py wsgi.py polls/ __init__.py admin.py apps.py migrations/ __init__.py models.py tests.py views.py Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/core/management/init.py", line 364, in execute_from_command_line utility.execute() File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/core/management/init.py", line 308, in execute settings.INSTALLED_APPS File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/conf/init.py", line 56, in getattr self._setup(name) File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/conf/init.py", line 41, in _setup self._wrapped = Settings(settings_module) File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/conf/init.py", line 110, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: No module named toneapp.settings -
TypeError at /signup 'NoneType' object is not callable in Django
Have custom User model, but using this model I can only create superuser using terminal command "python manage.py createsuperuser". The error : "TypeError at /signup 'NoneType' object is not callable" Traceback: 1 userV= userM.create_user(int(Mno),Role,Pass) 2 mobile_no=mobile_no, models.py class Users(AbstractBaseUser, PermissionsMixin): object = UserManager() mobile_no = models.IntegerField(_('MobNumber'), null=True, blank=True,unique=True) role = models.CharField(_('Role'), max_length=70, null=True, blank=True) activated = models.BooleanField(_('Activated'), default=False) is_admin = models.BooleanField(_('is_admin'), default=False) is_staff = models.BooleanField(_('is_staff'), default=False) views.py def Sign_up(request): Fname = request.POST.get("first_name") Lname = request.POST.get("last_name") Mno = request.POST.get("Mobile") email = request.POST.get("email") Pass = request.POST.get("pass") Role = request.POST.get("role") Loc = request.POST.get("self_loc") if request.method == "POST": userM = UserManager() if Role=="Consumer": userV= userM.create_user(int(Mno),Role,Pass) else: userV= userM.create_staffuser(int(Mno),Role,Pass) userV.first_name=Fname userV.last_name=Lname userV.email=email userV.location=Loc return render(request, "home.html", {}) else: return render(request, "registration/signup.html", {}) -
Need to show distinct items with the highest value in another column
I'm using MongoDB in Django, and am using djongo as the database adapter. To be as specific as possible there are 4 columns being displayed on the main page: effective_date, document_title, description, and revision_number. I need to be able to show only a single distinct row for each document (using document_title), but in the same view I need to show the highest revision_number for that document_title. I have the distinct document_title working, but adding in anything related to any other column seems to either break the distinct flag, or just break the application. The code relating to the query is: class DocumentListView(generic.ListView): # model = Document def get_queryset(self): return Document.objects.filter(deactivated=False).values('document_title').distinct() With this code the application looks like this: Moving forward I need to be able to add in the effective_date, description, and revision_number, but ONLY for the highest revision_number relating to each document_title. Any help would be greatly appreciated. Thank you! -
Comparing DurationField with HTML Video.currentTime
I'm using Django's DurationField in one of my models, and I want to compare it with a Video's current time in a inside some an HTML template. However, when I do so I get a typing mismatch, my duration field is a string that looks like this: 00:00:02.500000 and Video.currentTime is a Number that looks like this: 0.294648 How do I compare the two? -
how to upload files to the same model but different fields (Django)
I have multiple upload buttons per file on the html page but I need to upload it to a different model field per user. HTML {% if user.userextended.chapter == '33' %} <table style="width:100%"> <caption></caption> <tr> <th>Chapter 33 Benefits</th> <th>Checklist</th> <th>Upload</th> </tr> <tr> <td>Concise Student Schedule</td> <td>NO</td> <td><form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <button type="submit">Upload</button> </form> </td> </tr> <tr> <td> Audit</td> <td>NO</td> <td><form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <button type="submit">Upload</button> </form> </td> </tr> </table> and so on... Models.py class UserExtended(models.Model): #fields for checking user = models.OneToOneField(User, on_delete=models.CASCADE) chapter = models.CharField(max_length=4,choices=[('33','33'), ('30','30'), ('31','31'),('35','35'),('1606','1606')],blank=True) #saves file to a userid directory def user_directory_path(instance, filename): return 'students/user_{0}/{1}'.format(instance.user.id,filename) Conc_stud_sched = models.FileField(upload_to=user_directory_path,validators=[FileExtensionValidator(allowed_extensions=['pdf'])],blank=True,null = True) star_deg_audit = models.FileField(upload_to=user_directory_path,validators=[FileExtensionValidator(allowed_extensions=['pdf'])],blank=True,null = True) and so on... I need some help with writing the view and the forms for this task. Thanks. -
Google API integration with Python - Change sender's mail address in Calendar API
I am trying to figure out the Google API integration with Python(Django) to send calendar events to the users. While everything is running fine but the emails are being sent from my google's service account mail address which is in the form: <project_name>-django@<project_name>.iam.gserviceaccount.com which is coming from client_email attribute of my json file. Please read this answer for implementation: https://stackoverflow.com/a/37933674/3520404 Now, I want all the mails to be sent from a specific mail address so that people can reply to the mails. Here is my code: import httplib2 from googleapiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials def get_google_calendar_service(): credentials = ServiceAccountCredentials.from_json_keyfile_name( filename=settings.GOOGLE_SERVICE_ACCOUNT_KEY_FILE_PATH, scopes=['https://www.googleapis.com/auth/calendar'] ) http = credentials.authorize(httplib2.Http()) service = build('calendar', 'v3', http=http) return service def create_event(): service = get_google_calendar_service() start_datetime = datetime.datetime.now(tz=pytz.utc) event = service.events().insert(calendarId='<MY_EMAIL_ID>', body={ 'summary': 'Foo', 'description': 'Bar', 'start': {'dateTime': start_datetime.isoformat()}, 'end': {'dateTime': (start_datetime + timedelta(minutes=15)).isoformat()}, }).execute() print(event) I want to send all the calendar invite mails from <MY_EMAIL_ID> but that's not happening. Is there anyway to control the FROM EMAIL ADDRESS while sending the calendar invite mails? Please help. -
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)
For the past few weeks I have been developing a Django web app on Windows environment and now I am trying to deploy it to AWS. The app's data base is a Azure SQL database and the configuration in the setting.py file is like this: DATABASES = { 'default': { 'ENGINE': 'sql_server.pyodbc', 'NAME': 'nameofdatabase', 'HOST': 'nameofdatabase.database.windows.net', 'PORT': '1433', 'USER': 'user', 'PASSWORD': 'password', 'OPTIONS': { 'driver': 'ODBC Driver 13 for SQL Server', } } } And this is the error I got when trying to access the app. I set DEBUG=TRUE so I can see the exception here. Django Version: 2.1.3 Exception Type: InterfaceError Exception Value: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)') Exception Location: /opt/python/run/venv/local/lib/python3.6/site-packages/sql_server/pyodbc/base.py in get_new_connection, line 307 Python Executable: /opt/python/run/venv/bin/python3 Python Version: 3.6.7 I know this is something to do with the pyodbc package or SQL driver as well as unixodbc on Amazon Linux. I'm quite new to programming so hope you guys can shed some light. Thank you! -
When should I use 'path' over 're_path'?
Here is an example from Django Docs: from django.urls import include, path urlpatterns = [ path('index/', views.index, name='main-view'), path('bio/<username>/', views.bio, name='bio'), ... ] from django.urls import include, re_path urlpatterns = [ re_path(r'^index/$', views.index, name='index'), re_path(r'^bio/(?P<username>\w+)/$', views.bio, name='bio'), ... ] From my understanding path syntax is more readable and offers the angle brackets that can catch information from the URL and convert a type. Should I use re_path only when I need a regular expression and use path for all other cases? -
Invalid block tag 'static', expected 'endblock'. Did you forget to register or load this tag?
below code is showing me error in static tag how to solve? {% extends 'courses/base.html' %} {% load static %} {% block content %} <link rel="stylesheet" type="text/css" href="{% static 'css/checkout.css' %}"> {% endblock %} STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static_root'), ] VENV_PATH = os.path.dirname(BASE_DIR) STATIC_ROOT = os.path.join(BASE_DIR, 'static') -
Attach ImageField to model without saving the file to disk
I'm trying to put an image to ImageField from some external url without saving it to disk. Here is my model: class MyModel(models.Model): id = models.AutoField(primary_key=True) photo = models.ImageField( upload_to=_upload_path, validators=[...] ) That's how I receive a file from url: from io import BytesIO import requests from django.core.files import File fp = BytesIO() fp.write(requests.get(url).content) file = File(fp) and now I need to attach this file to MyModel, if I do like that: mymodel = MyModel() mymodel.photo.save("some_filename.jpg", file) I can see that the file has been saved to upload_path/some_filename.jpg without any validation (all validators of MyModel.photo field were ignored) is it possible to do something like: mymodel.photo = ??? mymodel.save() so some_filename.jpg appears on the disk only after required validations? -
Django setup on pythonanywhere
I have an existing django project which I'm trying to set up on pythonanywhere. I followed the tutorial step by step but I'm getting an error message regarding my secret key: 2019-03-21 15:55:25,202: Error running WSGI application 2019-03-21 15:55:25,212: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. 2019-03-21 15:55:25,212: File "/var/www/2332575y_pythonanywhere_com_wsgi.py", line 33, in <module> 2019-03-21 15:55:25,212: application = get_wsgi_application() 2019-03-21 15:55:25,212: 2019-03-21 15:55:25,213: File "/home/2332575Y/.virtualenvs/QuickPoll/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application 2019-03-21 15:55:25,213: django.setup(set_prefix=False) 2019-03-21 15:55:25,213: 2019-03-21 15:55:25,213: File "/home/2332575Y/.virtualenvs/QuickPoll/lib/python3.7/site-packages/django/__init__.py", line 19, in setup 2019-03-21 15:55:25,213: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) 2019-03-21 15:55:25,213: 2019-03-21 15:55:25,213: File "/home/2332575Y/.virtualenvs/QuickPoll/lib/python3.7/site-packages/django/conf/__init__.py", line 57, in __getattr__ 2019-03-21 15:55:25,214: self._setup(name) 2019-03-21 15:55:25,214: 2019-03-21 15:55:25,214: File "/home/2332575Y/.virtualenvs/QuickPoll/lib/python3.7/site-packages/django/conf/__init__.py", line 44, in _setup 2019-03-21 15:55:25,214: self._wrapped = Settings(settings_module) 2019-03-21 15:55:25,215: 2019-03-21 15:55:25,215: File "/home/2332575Y/.virtualenvs/QuickPoll/lib/python3.7/site-packages/django/conf/__init__.py", line 126, in __init__ 2019-03-21 15:55:25,215: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") 2019-03-21 15:55:25,215: *************************************************** 2019-03-21 15:55:25,215: If you're seeing an import error and don't know why, 2019-03-21 15:55:25,216: we have a dedicated help page to help you debug: 2019-03-21 15:55:25,216: 2019-03-21 15:55:25,216: *************************************************** 2019-03-21 15:55:53,358: Error running WSGI application 2019-03-21 15:55:53,365: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. 2019-03-21 15:55:53,366: File "/var/www/2332575y_pythonanywhere_com_wsgi.py", line 33, in <module> 2019-03-21 15:55:53,366: application = get_wsgi_application() 2019-03-21 15:55:53,366: 2019-03-21 15:55:53,366: … -
Django Forms - CheckboxSelectMultiple does not render in template
Im using crispy forms with Django and am trying to create a select multiple option for a model field as per the below. I am not currently seeing any errors however the form renders nothing in the template class ProfileForm(forms.ModelForm): class Meta: model = UserProfile fields = ['subscriptions',] def __init__(self, *args, **kwargs): super(ProfileForm, self).__init__(*args, **kwargs) subscription_data = SiteSubType.objects.all() subscription_options = ((d.sub_type, d.sub_type) for d in subscription_data) self.fields['subscriptions'].widget = forms.CheckboxSelectMultiple(choices=subscription_options) in the webpage html that's rendered <div class="col-lg-12"> <div id="div_id_subscriptions" class="form-group"> <label for="" class="control-label "> Maintenance Subscription </label> <div class="controls "> </div> </div> </div> -
Django obj.refresh_from_db() vs reload with assignment
I have just come across the obj.refresh_from_db() method which was introduced in Django 1.8. I am curious if there is any advantage/ disadvantage of these two approaches to ensuring the object reference accurately reflects the db. obj = MyModel.objects.create(val=1) MyModel.objects.filter(pk=obj.pk).update(val=F('val') + 1) # At this point obj.val is still 1, but the value in the database # was updated to 2. The object's updated value needs to be reloaded # from the database. # approach 1) obj = MyModel.objects.get(pk=obj.pk) # approach 2) obj.refresh_from_db() Any input would be much appreciated. -
Problems with installation of Django Virtual Enviroment
I´m new in Python and Django and I'm trying to create a virtual enviroment for work with these two. I'm on Windows and when I try to create the virtual enviroments this error shows up: Image of the error I have tried turning off the firewall and create it in the C:\ProgramData\Anaconda3 path because the possible issue with the spaces in the user name, but neither of the two works. What can I do to solve this? -
table has no column named error when trying to add page to site
from django.shortcuts import render from django.http import HttpResponse from rango.models import Category from rango.models import Page from rango.forms import CategoryForm from rango.forms import PageForm from rango.forms import UserForm, UserProfileForm from django.contrib.auth import authenticate, login from django.http import HttpResponseRedirect, HttpResponse from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from django.contrib.auth import logout from datetime import datetime def index(request): request.session.set_test_cookie() category_list = Category.objects.order_by('-name')[:5] context_dict = {'categories': category_list} visitor_cookie_handler(request) response = render(request, 'rango/index.html', context_dict) return response def about(request): if request.session.test_cookie_worked(): print("TEST COOKIE WORKED!") request.session.delete_test_cookie() context_dict = {'MEDIA_URL': "/media/"} visitor_cookie_handler(request) context_dict['visits'] = request.session['visits'] return render(request, 'rango/about.html', context=context_dict) def show_category(request, category_name_slug): context_dict = {} try: category = Category.objects.get(slug=category_name_slug) pages = Page.objects.filter(category=category) context_dict['category'] = category except Category.DoesNotExist: context_dict['category'] = None #context_dict['pages'] = None return render(request, 'rango/category.html', context_dict) def add_category(request): form = CategoryForm() if request.method == 'POST': form = CategoryForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) else: print(form.errors) return render(request, 'rango/add_category.html', {'form': form}) def add_page(request, category_name_slug): try: category = Category.objects.get(slug=category_name_slug) except Category.DoesNotExist: category = None form = PageForm() if request.method == 'POST': form = PageForm(request.POST) if form.is_valid(): if category: page = form.save(commit=False) page.category = category page.save() return show_category(request, category_name_slug) else: print(form.errors) context_dict = {'form':form, 'category': category} return render(request, 'rango/add_page.html', context_dict) def register(request): registered = False if request.method == … -
Highlighting in solr with python
Sorry for the question without standard format, as it is my first question in stackoverflow. If i want to achieve highlight function of Solr in Django with python, how could it be done by using the package solrpy? How did solrpy deal with it, as the highlighting results live in a absolute fragment on the SolrResponse object,shown as a dictionary of dictionaries. sc = solr.SolrConnection("http://localhost:8080/solr/cases") response_c=sc.query('name:*%s'%q+'*',fields='name,decision_date', highlight='name') print(response_c.results) for hit in response_c.results: print(hit) And why above code does not work? Thanks a lot! -
Pyforms web sample now working, only django's default site showing up
I'm trying to follow along with the example shown here: https://pyforms-web.readthedocs.io/en/v4/getting-started/first-app.html to get the first app running. The Directory Structure of the default Django app looks like that. I added the code as in the example, ran migrate and opened the brower, but only the default Django page shows up. I'm using Python 3.6.0, Django 2.1.7 and Pyforms v4. Can somebody help me figure out what I'm doing wrong? Thanks! -
I need a starting point to code an app to extract text from pdf to excel
To start I just want to state that I'm an Electrical Engineer with basic knowledge of programming. My requirement is as follows: I want to create an app where I can load and view PDF files that contain tables. These PDF files tables are of irregular shapes and in a different position on every page. (that's why tools like tabular couldn't help me) Each table entry is multiline and of irregular dimensions (I cannot select a whole row at a time it has to be each element alone. simply copying the lines to excel won't work either because it will need a lot of formatting) So I want to be able to select each table entry individually from the table (like a selection or cropping box over the required text), delete new line if there is a new line in the text and just keep spaces. The generated excel (or access database I do not really mind any) should be reviewable and saveable (if those are even words XD). I have a good knowledge of python and a very elementary knowledge of Django and I'm seeking some expert who can tell me what do I really need to learn (and … -
I'm trying to create a website... But I don't know where to start
I'm kind of new to website development. I want to create a simple website to host my resume and some other information about myself. But I don't simply want to do it in html. I'd like to use something like typescript/angular/react or something like that. I've had some experience with typescript/react, but I also started a website with django/python. What's the best? What should I use? The reason I want to use something else besides html is because I want to use it as a part of my resume and learn something new. -
serializer create function is not called
I am using rest framework serializer with graphql. I am trying to create a user when user signs up and create a profile based on the role user selects when creating an account. For this i have added a serializer layer, however the serializer create function is not called when i have used serializer.save inside my mutate function. why is that so? Here is how i have done class Register(graphene.Mutation): """ Mutation to register a user """ class Arguments: email = graphene.String(required=True) password = graphene.String(required=True) password_repeat = graphene.String(required=True) role = graphene.String(required=True) success = graphene.Boolean() errors = graphene.List(graphene.String) email = graphene.String() def mutate(self, info, email, password, password_repeat, role): if password == password_repeat: try: serializer = RegistrationSerializer(data={ 'email': email, 'password': password, 'is_active': False, 'role': role, }) if serializer.is_valid(): print("valid") user = serializer.save() # user.set_password(password) print ("user is ###########", user) # user = UserModel.objects.create( # email=email, # role=role, # is_active=False # ) # user.set_password(password) # user.save() print ("seraizlier after saving", serializer.validated_data.get('id')) if djoser_settings.get('SEND_ACTIVATION_EMAIL'): send_activation_email(user, info.context) return Register(success=bool(user.id), email=user.email) else: print("serializer error", serializer.errors) # TODO: specify exception except Exception as e: print("exception", e) errors = ["email", "Email already registered."] return Register(success=False, errors=errors) errors = ["password", "Passwords don't match."] return Register(success=False, errors=errors) class RegistrationSerializer(serializers.ModelSerializer): class … -
How to combine the search form and django filter together?
First of all, I have used django_filters which has the following code: from .models import Product import django_filters class ProductFilter(django_filters.FilterSet): product_name = django_filters.CharFilter(lookup_expr='icontains', label='Product Name') product_price = django_filters.NumberFilter() product_price__gt = django_filters.NumberFilter(field_name='product_price', lookup_expr='gt', label='Min Price') product_price__lt = django_filters.NumberFilter(field_name='product_price', lookup_expr='lt', label='Max price') hotel_location = django_filters.CharFilter(lookup_expr='icontains', label='hotel location') class Meta: model = Product fields = ['product_name', 'product_price', 'vendor_name', 'hotel_location'] Template code for the above filter is: <table id="myTable"> <thead> <tr> <th>Image</th> ...... </tr> </thead> <tbody > {% for lap in filter.qs|slice:":20" %} <tr > <td class="col-sm-3"> <div > <div class="product-image-wrapper"> <div class="single-products"> <div class="productinfo text-center"> <img src="{{ lap.product_image }}" alt="" /> </div> </div> </div> </div> </td> ....... </tr> ....... {% endfor %} </tbody> </table> views.py file have the following code for it: def searchTable(request): product_list = Product.objects.all() product_filter = ProductFilter(request.GET, queryset=product_list) return render(request, 'searchTable.html', {'filter': product_filter}) But I have another search form which is in the base template. The code for this is: <form class="navbar-form" method="post" action="{% url 'searchTable' %}" "> {% csrf_token %} <input type="text" name="srh" class="form-control" placeholder="Search To Compare Products"> <button class="btn btn-secondary" type="submit"></button> </div> </form> views.py file has the following code for this: def tablesorter(request): if request.method == 'POST': srch = request.POST['srh'] if srch: match = Product.objects.filter(Q(product_name__icontains=srch) | Q(vendor_name__icontains=srch) | … -
Django/Celery - run one type of tasks synchroniously or prevent duplicated tasks
I have a task backsync_objects which fetches a set objects from API and create or update them in my database. If I change for example order of one object on server, multiple webhooks are sent to my client because multiple objects changed order. The problem is that this type of task can't run multiple times at one moment because it creates object/s if such object doesn't exists. In my case, it creates multiple equal objects because objects from previous webhook weren't commited yet. def post(self, request, *args, **kwargs) -> HttpResponse: tasks.backsync_all_stages.delay() I decided to use celery for this purpose and there are two options Run these tasks synchroniously so we preserve integrity celery -A myproj --concurrency=1 worker -l info Run just first or last task (in other words, prevent duplicated backsync_all_stages tasks in queue) The first solution works but this task is always repeated either 2,3 or even 10 times (depends on how many stages changed order). So I would like to check whether there is such task in queue or working on and either add this task to queue or do nothing. Do you have any advice? Maybe there is even a better option. EDIT There will be for … -
A value from template's form parameters is not passed in View
I have a student that is using django framework to build an app. She has a template that contains a slider. The part of this form in the template is: <form method="GET" enctype="multipart/form-data"> <div class="slidecontainer"> <input name="range" type="range" min="{{ beginframe }}" max="{{ endframe }}" onclick="sLider.oninput();" class="slider" id="range"> <p>Value: <span id="demo"></span></p> <button type="button" class="button4" name="showframebtn" id="showframebtn" >Show frame</button> </div> <input type="hidden" name="fname1" value="{{video_path}}" style=" margin-top: 15px; margin-left: -45px;width: 410px; height: 40px;"> </form> Next, she needs to handle the value of the slider and the {{video_path}} value. This is her code a function in views.py: elif request.method == 'GET' and 'f' in request.GET: if framenumber: print(framenumber) fname_1 = request.GET.get('fname1') print("fname", fname_1) However, the value of hidden input parameter is not passed. The value she gets is None. Can you please help us on how to fix this? Is this due to the fact that she is using a button parameter? Thank you in advance! -
render() unexpected keyword error in Wagtail admin templates
I'm in the process of upgrading from Django 1.11 and Wagtail 2.0 to latest versions of both. Everything seems to be working except when I try to edit or create one specific page type I get a Django error File "/Users/########/new_blog/lib/python3.6/site-packages/django/template/base.py" in resolve 698. new_obj = func(obj, *arg_vals) File "/Users/########/new_blog/lib/python3.6/site-packages/wagtail/admin/templatetags/wagtailadmin_tags.py" in render_with_errors 247. return bound_field.as_widget() File "/Users/########/new_blog/lib/python3.6/site-packages/django/forms/boundfield.py" in as_widget 93. renderer=self.form.renderer, Exception Type: TypeError at /admin/pages/6/edit/ Exception Value: render() got an unexpected keyword argument 'renderer' Full stack trace here: https://gist.github.com/chrxr/0427c6f8bd884828bf332d7cf6290447 I'm sure this is to do with Django 2.0+ changes, and as its just one page I'm pretty sure its to do with my model, but I have no idea what part of the model could be causing this. Can anyone help me identify the issue? The model in question is "Blogpage" and it can be seen here: https://github.com/chrxr/blog_project/blob/upgrade-to-latest/blog/models.py#L118 I suspect its something to do with taggit, or at least I found some similar issues around that online, but I'm really not sure... FWIW my requirements.txt is here: https://github.com/chrxr/blog_project/blob/upgrade-to-latest/requirements.txt Thanks! -
Creating Dropdown Form Headers Django/HTML/CSS
I'm looking for a solution like this one found for a navigation menu on W3's site except applied to a form: I'm working with Django and using a model field like: plant=models.CharField(choices=Plant_Choices, blank=False) On my form I just use a ModelForm Then, to call the form field I use {{form.plant}} Is there a way to place headers above groupings of certain choices say, to break down by region or products made?