Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Dynamically-sided table with integer inputs in Django
I'm new to Django and I was wondering how to do the following task: Make a table with m rows and n columns where both m and n are specified by the user. The user should be able to type an integer into any cell of the table, and when they're done, they can hit a submit button that POSTs their input. I think Django forms are the way to go. I don't necessarily need an explicit solution (of course that is welcome too); merely pointing me towards helpful resources or design strategies would suffice. -
Vue Routing isn't returning blog posts
I am unable to return data once I click on the blog post. I believe that it is an issue with routing. When clicking to a blog post we no content is return. -
Backend web service point system
Im new to backend but I want to build a point system that has "users" have points in their account and can spend them but the admin can track their points like how much points were spent and when. I want to be able to add the tranactions, make sure the points never go negative and the oldest points to be spent first. im mostly looking for tips on how to start this and what to look for when trying to meet the conditions stated, I am going to code in python and django as the frame work. Any tips for anything I stated will be helpful and thanks in advance trying to build the database using MySQL as well for holding the points -
Reverse for 'design' with arguments '('', '')' not found. 1 pattern(s) tried:['builder\/design\/(?P<template_id>[^/]+)\/(?P<template_type>[^/]+)\\/$']
I am trying to use a builder where users can choose layout. But getting the following error - > NoReverseMatch at /builder/ > > Reverse for 'design' with arguments '('', '')' not found. 1 pattern(s) tried: > ['builder\\/design\\/(?P<template_id>[^/]+)\\/(?P<template_type>[^/]+)\\/$'] I am really lost. I saw many similar questions. I tried the solutions offered in those but could not resolve the issue. I have checked the variable names, I have checked the template, The context I am sending out has all the elements. My view is - def index(request): user_id = request.user.id templates = Template.objects.filter(Q(user_id=user_id) | Q(user_id=1), builder=2).order_by('id') layouts = templates.filter(layout=1, user_id=1).order_by('title') others = templates.filter(layout=2, user_id=1).order_by('id') owns = templates.filter(user_id=user_id).order_by('id') context = {'title': 'Template Builder', 'layouts': layouts, 'others': others, 'owns': owns} return render(request, 'builder/index.html', context) urls.py - from django.urls import path, re_path from . import views urlpatterns = [ path('', views.index, name='builder'), path('design/<str:template_id>/<str:template_type>/', views.design, name='design'),] template for builder is - <div class="card-body"> <div class="row"> {% for layout in layouts %} <div class="col-md-6 col-lg-4 col-xl-3 mb-30"> <div class="card"> <a target="_blank" type="button" href="{% url 'design' layout.id 'layouts' %}"> {# <img width="100%" height="100%" class="_1xvs1"#} {# src="/media/builderjs/1/templates/{{ layout.id }}/thumb.png"#} {# title="{{ layout.title }}" alt="{{ layout.title }}">#} {{ layout.icon|safe }} </a> <div class="p-15"> <a target="_blank" type="button" href="{% url … -
Django filter date returns none
I am trying to generate a pdf file in django It works without the filter dates but I want the data in the generate pdf to get only the date range but I cant seem to make it work with filter dates. In my view, when I print the fromdate and todate it returns none, why was the date returns none even if I enter the date in the field (HTML). Thanks View class GenerateInvoiceCollision_i(View): def get(self, request, *args, **kwargs): try: fromdate = request.POST.get('fromdate') todate = request.POST.get('todate') print(fromdate, todate) # incident_general_accident = IncidentGeneral.objects.filter(user_report__status = 2).values('accident_factor__category').annotate(Count('severity'), filter=Q(severity='Damage to Property')) incident_general_collision = IncidentGeneral.objects.filter(user_report__status = 2, user_report__date__range=["2022-10-13", "2022-10-26"]) incident_general_collision1 = IncidentGeneral.objects.filter(user_report__status = 2,severity='Fatal', user_report__date__range=["2022-10-13", "2022-10-26"] ).annotate(Count('severity')) incident_general_collision2 = IncidentGeneral.objects.filter(user_report__status = 2,severity='Damage to Property', user_report__date__range=["2022-10-13", "2022-10-26"] ).annotate(Count('severity')) incident_general_collision3 = IncidentGeneral.objects.filter(user_report__status = 2,severity='Non-Fatal', user_report__date__range=["2022-10-13", "2022-10-26"] ).annotate(Count('severity')) incident_general_classification = IncidentGeneral.objects.filter(user_report__status = 2, severity="Damage to Property", user_report__date__range=["2022-10-13", "2022-10-26"]).distinct('accident_factor') except: return HttpResponse("505 Not Found") data = { 'incident_general_collision': incident_general_collision, 'incident_general_classification': incident_general_classification, 'incident_general_collision': incident_general_collision, 'incident_general_collision1': incident_general_collision1, 'incident_general_collision2': incident_general_collision2, 'incident_general_collision3': incident_general_collision3, # 'amount': order_db.total_amount, } pdf = render_to_pdf('pages/generate_report_pdf_collision.html', data) #return HttpResponse(pdf, content_type='application/pdf') # force download if pdf: response = HttpResponse(pdf, content_type='application/pdf') filename = "Collision_Type.pdf" #%(data['incident_general.id']) content = "inline; filename='%s'" %(filename) #download = request.GET.get("download") #if download: content = "attachment; filename=%s" %(filename) … -
How do I add a percentage field to a model in Django?
I don't know how to go about it in My models.py so basically, i want to be able to input a number let's say 5 in the form field or from the admin panel and it renders in out as 5% I don't know if it's possible so what function do i use in my models.py did some research not helping help me out here. My models.py is like this below Username = models.Charfield(max_length=100) Percentage = So that's where I'm stuck -
Django double curly braces tag not loading in html templates
I am new here so I may have worded the title wrong I apologize if I did so. So I created a checkout page in my django project for the user to purchase coins but it wont render the variable attribute on the browser it just shows up empty. Here's the coinpack model.py code. ` class Coinpack (models.Model): amount= models.CharField(max_length=50) price= models.FloatField() image_url= models.CharField(max_length=3000) ` Here's the coinpack views.py code. ` def buycoins (request): buycoins = Coinpack.objects.all return render(request, 'buycoins.html', {'buycoins': buycoins}) ` Here's the html template code ` {% extends 'base.html' %} {% block content %} <div class="row"> {% for Coinpack in buycoins %} <div class="col"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">{{ Coinpack.amount }} coins</h5> <p class="card-text"> ${{ Coinpack.price}}</p> <a href="{% url 'checkout' Coinpack.id %}" class="btn btn-primary">Buy Now</a> </div> </div> </div> {% endfor %} </div> {% endblock %} ` After this the coipack page works well but when I add the checkout page the attributes are not rendered, here's what I did. checkout page views.py ` def checkout(request, pk): checkout = Coinpack.objects.get(id=pk) context = {'checkout':checkout} return render(request, 'checkout.html', context) ` checkout page url.py ` path('checkout/<int:pk>/', views.checkout, name="checkout"), ` checkout page html template ` <body> <div class="container"> <div … -
How can I detect that the form is not complete with twig and django?
I am making a form in django with some required fields and some not. I want with a conditional to show a validation in the front like this: and show this message: otherwise, show it like this when submitting -
How to create own syntax checker
So, as a pet project I want to try do own online syntax web checker for Python. Can you help how to start? May some advice in libraries, API's or something like that. Because I have no idea how to do that. I thought to do this on Python/Django. How it may works: user paste his code and then program give him answer where PEP8 rules were violated. It's like flake8 lib on Pycharm but in Web Interface. For example https://www.pythonchecker.com Some advices in how to do it -
Django page where media picture is displayed from database is loading slow
In production the page where I got media picture displayed from database is loading slow, like I can see the image but it loading forever. Also Other page on the website where there no media are loading fine and fast. I been trying to fix it for 2 days and I tried many things and I am out of idea. Note: In development the media page is loading fine mysite/urls.py urlpatterns = [ path('admin/', admin.site.urls), path('', include('main.urls')) ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) models.py class TestImage(models.Model): name = models.CharField(max_length=100) imagelol = models.ImageField(null=False, blank=False) def __str__(self): return self.name views.py def home(request): testimage = TestImage.objects.all() context = {'testimage': testimage} return render(request, 'main/home.html', context) home.html {% for photo in testimage %} <img class="card-img-top" src="{{photo.imagelol.url}}" alt="Card image cap"> {% endfor %} settings.py (In development) STATIC_URL = 'static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') So my media folder is place like this: So I in production I am using ubuntu and apache settings.py (In Production) STATIC_URL = '/static/' STATIC_ROOT = '/var/www/mysite/static/' MEDIA_URL = '/media/' MEDIA_ROOT = '/var/www/mysite/media/' apache config file <VirtualHost *:80> ServerName MY-SERVER-IP ErrorLog ${APACHE_LOG_DIR}/mysite-error.log CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined WSGIDaemonProcess mysite processes=2 threads=25 python-path=/var/www/mysite WSGIProcessGroup mysite WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py Alias /robots.txt … -
Django localization / Language from model
I'm trying to take user language from UserProfile model. User choosing language in form, and after that website have to be translated on that language. I created switcher which can change language but it's not what i need because it doesn't communicate with my model. I know that i have to rewrite LocaleMiddleware, but i don't know how to do it in right way. I've tried some solution from stackoverflow, but it doesn't work for me. So the question is: what i'm doing wrong? or maybe there is no problem with middleware but problem somewhere else? My middleware: from django.utils import translation class LocaleMiddleware(object): """ This is a very simple middleware that parses a request and decides what translation object to install in the current thread context. This allows pages to be dynamically translated to the language the user desires (if the language is available, of course). """ def __init__(self, get_response): self.get_response = get_response def __call__(self, request): language_code = request.LANGUAGE_CODE translation.activate(language_code) response = self.get_response(request) translation.deactivate() return response def process_request(self, request): language = translation.get_language_from_request(request) translation.activate(language) request.LANGUAGE_CODE = translation.get_language() def process_response(self, request, response): translation.deactivate() return response My model: from core.settings.base import LANGUAGES, LANGUAGE_CODE class UserProfile(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, related_name="user_profile" ) … -
Depending on the selection of product variations, the link in the forwarding button also changes
I prepared the variation features of the products with the html buttons. As I select the properties of the variations, I could not enable the other variation properties to be activated and selected. After all these variation selections, I couldn't make the forward button's link orientation change according to the selected variations. Link that can be changed automatically as you add variants to products. How can I prepare the link that the next button will open when I click on the product additional feature buttons that I created with html and css, with python django? -
No module named 'signals' in Django Project
I'm practice Django and I'm trying to make function ( Ready ) in the app.py and import ( users.signals ) into this function and I already used pip install signals to install signals package and didn't solve it yet. apps.py `from django.apps import AppConfig class UsersConfig(AppConfig): name = 'users' def ready(self): import users.signals` signals.py `from django.db.models.signals import post_save from django.contrib.auth.models import User from django.dispatch import receiver from .models import Profile @receiver(post_save, sender=User) def create_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_profile(sender, instance, **kwargs): instance.profile.save()` No module named 'signals' -
Next.js not receiving cookie from Django
I am messing around with Next.js and regular Django to do some testing, study etc. I am trying to make a basic authentication system that simply takes the email and password, send to the Django server and it simply returns a cookie with the user id. When I login with valid credentials, the server returns an "OK" (as it is supposed to do), however I don't get any of the cookies I'm supposed to have (not even the default csrf token from Django). (sample data for design testing) Using Django 4.0.6 and Next.js 12.3.1 Login route on Django @csrf_exempt def login(req): body = json.loads(req.body.decode("utf-8")) res = None if (User.objects.filter(email=body["email"])): user = User.objects.get(email=body["email"]) if (user.password == body["password"]): res = JsonResponse({"success": True}) res.status_code = 200 res.set_cookie("AuthToken", json.dumps( {"id": user.id}), max_age=60 * 60 * 24, httponly=False, samesite="strict", ) else: res = JsonResponse({"success": False}) res.status_code = 401 else: res = JsonResponse({"success": False}) res.status_code = 404 res.__setitem__("Access-Control-Allow-Origin", "*") print(res.cookies) return res My login page on Next import Link from "next/link"; import { useRouter } from "next/router"; import React, { FormEvent, useState } from "react"; import styled from "styled-components"; import { CONFIG } from "../../../DESIGN_CONFIG"; export default function Login() { const [email, setEmail] = useState(""); const … -
how to create django model by pressing button
I am fairly new django user a few months of project creation and messing around with it, and I have created models before using forms, but this would be my first time trying to create one using just a button, and I have no idea how to do that, I looked for examples on stackOverFlow and I found a few but I couldn't figure out how to apply them to my project I have a products model that uses a category model class Category(models.Model): class Meta: verbose_name_plural = 'Categories' name = models.CharField(max_length=254) friendly_name = models.CharField(max_length=254, null=True, blank=True) def __str__(self): return self.name def get_friendly_name(self): return self.friendly_name class Product(models.Model): category = models.ForeignKey('Category', null=True, blank=True, on_delete=models.SET_NULL) sku = models.CharField(max_length=254, null=True, blank=True) name = models.CharField(max_length=254) description = models.TextField() has_tiers = models.BooleanField(default=False, null=True, blank=True) price = models.DecimalField(max_digits=6, decimal_places=2) image_url = models.URLField(max_length=1024, null=True, blank=True) image = models.ImageField(null=True, blank=True) favorites = models.ManyToManyField( User, related_name='product_favorites', blank=True) def __str__(self): return self.name and I have a favorite model class Favorite(models.Model): """ A Favorite model so users can save products as their favorites """ user = models.OneToOneField(User, on_delete=models.CASCADE) product = models.ForeignKey(Product, null=False, blank=False, on_delete=models.CASCADE) I want that when a user is on the products_details.html page, which is just a normal page … -
Counting the number of rows with the same date but different type?
I have a model like this: class Class(models.TextChoices): STANDARD = "Standard", _("Standard") JWW = "JWW", _("JWW") class Competition(models.Model): cls = models.CharField(choices=Class.choices) date = models.DateField() I would like to get all of the dates where a Standard Competition occurred AND a JWW Competition occurred. My current solution takes a long time for a low number of rows (~300), and relies on an intersection query. I have a large amount of data upon which this calculation will need to be performed, so the faster the query, the better. Memory is not a concern. -
GraphQL - AssertionError: resolved field 'attributes' with 'exact' lookup to an unrecognized field type JSONBField
I'm trying to query a JSONBField in Python-Django. But Graphql throws this error: AssertionError: ResponseFilterSet resolved field 'attributes' with 'exact' lookup to an unrecognized field type JSONBField. Try adding an override to 'Meta.filter_overrides'. See: https://django-filter.readthedocs.io/en/main/ref/filterset.html#customise-filter-generation-with-filter-overrides Here is my query in my test.py: attributes_to_query = {"Priority": ["low"], "Category": ["Service", "Speed"]} response = self.query( """ query responses($attributes: GenericScalar){ responses(attributes: $attributes){ edges { node { id name attributes } } } } """, headers=self.get_auth_headers(), variables={ "attributes": attributes_to_query, }, ) Here is the schema.py class Response(AuthorizedObjectType): class Meta: model = models.Response fields = [ "id", "name", "attributes", ] filter_fields = ["id", "name"] >>>>>>> Adding "attributes" to this list causes the error mentioned above. filter_overrides = { models.Response: { "filter_class": django_filters.CharFilter, "extra": lambda f: { "lookup_expr": "icontains", }, }, } interfaces = (relay.Node,) class Query: response = relay.Node.Field(Response) responses = DjangoFilterConnectionField( Response, variables=graphene.Argument(GenericScalar), attributes=graphene.Argument(GenericScalar), ) def resolve_responses(self, info, **kwargs): queryset = models.Response.objects.all() if (attributes := kwargs.get("attributes")) is not None: queryset = queryset.filter( Q(attributes__icontains=attributes["Category"][0]) | Q(attributes__icontains=attributes["Category"][1]) ) queryset = queryset.filter(attributes__icontains=attributes["Priority"][0]) # TODO - Here I have the right 2 Responses, but test returns all, Why ? print("Qset", queryset.values()) return queryset # The values in this queryset are fine ! But in the tests they are different … -
query a user and the date range in which the user had an event using django
As the tile says, I want to specify a user and a date range in which an event happen for that user. I have the date range bit down but I'm not sure how i can specify what user i want to see in my query. Here is what I have VIEW def attendance_detail(request): form = DateRangeForm() emp = AttendanceForm() queryset = None if request.method == 'POST': form = DateRangeForm(data=request.POST) emp = AttendanceForm(data=request.POST) if form.is_valid(): start_date = form.cleaned_data.get('start_date') end_date = form.cleaned_data.get('end_date') + timedelta(days=1) queryset = Attendance.objects.filter(date_created__range = [start_date, end_date]) context = { 'form':form, 'queryset':queryset, 'emp':emp, } return render(request, 'employee_management/attendance_detail.html', context) So i need a drop down that will allow me to pick from the users that are listed on the site and tie it to the date range that has been chosen. FORMS class AttendanceForm(forms.ModelForm): class Meta: model = Attendance widgets = { 'time': DateInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%dT%H:%M'), } fields = [ 'emp_name', 'absent', 'tardy', 'left_early', 'details', 'excused_or_not', 'time', ] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['excused_or_not'].label = "Was this excused?" self.fields['time'].label = "Date and time" class DateRangeForm(forms.Form): start_date = forms.DateField() end_date = forms.DateField() TEMPLATE {% block content %} <link href="{% static 'css/styles.css' %}" rel="stylesheet" /> <div class="card"> <div class="card-header text-dark"> … -
Populate Django python pdf after submition from user input
I've done the HTML as well as the pdf blank file for my web framework, but when it comes to the submission POST, I cannot seem to get it to work. Its supposed that once you press the submit it will save the user input to the blank pdf created, to later through a button (which is already created and functional, but downloads blank) download a pdf with the users inputed data. Home1.html {% extends "users/base.html" %} {% block title%} Home2 {%endblock title%} {%block Formulario%} <form id="form" method='post'> {%csrf_token%} <div class="form-control"> <label for="fecha" id="label-fecha"> Fecha </label> <input type="date" id="date" placeholder="Ingrese fecha" /> </div> <div class="form-control"> <label for="Cargo Actual" id="label-Cargo Actual" >Su cargo actual</label > <input type="text" id="cargo" placeholder="Ingrese Cargo" /> </div> <div class="form-control"> <label for="Lugar y Fecha de Nacimiento" id="label-F/L nac" >Lugar y fecha de Nacimiento</label > <input type="text" id="FLNac" /> </div> <div class="form-control"> <label for="Discapacidad" id="label-Disc">Grado de discapacidad</label> <input type"text" id='discapacidad' placeholder='En caso de tener discapacidad ingrese el grado,caso contrario deje vacio '> </div> <div class="form-control"> <label for="edad" id="label-edad"> Edad: </label> <input type="text" id="edad" placeholder="Ingrese edad" /> </div> <div class="form-control"> <label for="tipo_sangre" id="label-tipo_sangre">Tipo de Sangre:</label> <input type ="text" id="tipo_sangre" placeholder="Ingrese tipo de sangre" /> </div> <div class="form-control"> <label for="Estatura" … -
'AnonymousUser' object has no attribute '_meta' error in Django Register function
I was trying to do Register and Login form but I am taking "'AnonymousUser' object has no attribute '_meta'" error. How can I solve this error. And also if you have suggestion for better code writing or better way for this form I would be happy. Here is my views.py. from django.shortcuts import render,redirect from .forms import RegisterationForm from django.contrib import messages from django.contrib.auth import login as dj_login from django.contrib.auth import authenticate from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import logout as dj_logout def register(request): if request.method == "POST": form = RegisterationForm(request.POST) if form.is_valid(): user = { "username" : form.cleaned_data["username"], "email" : form.cleaned_data["email"], "password1" : form.cleaned_data["password1"], "password2" : form.cleaned_data["password2"] } user = form.save() dj_login(request,user) messages.success(request,"Kayıt İşleminiz Başarıyla Gerçekleştirilmiştir.") return redirect("index") else: messages.error(request,"Kayıt İşlemi Sırasında Bir Hata Meydana Geldi.") return render(request,"register.html",context={"RegisterForm":form}) else: form = RegisterationForm() return render(request,"register.html",context={"RegisterForm":form}) And here is my register.html file. {% extends 'layout.html' %} {% load crispy_forms_tags %} {% block title %} Register {% endblock title %} {% block body %} <h1>Register</h1> <form method="post"> {% csrf_token %} {{RegisterForm.username.label}} {{RegisterForm.username}} <br><br> {{RegisterForm.email.label}} {{RegisterForm.email}} <br><br> {{RegisterForm.password1.label}} {{RegisterForm.password1}} <br><br> {{RegisterForm.password2.label}} {{RegisterForm.password2}} <br><br> <button type="submit">Kayıt Ol</button> </form> {% endblock body %} and this is my error. Environment: Request Method: POST Request URL: http://localhost:8000/users/register/ … -
how to make an Image qualifier project in django
first of all I must say that I am new to django and I am practicing. I explain, I am creating a project to rate images by showing the user several pairs of images and the user must select the one they like the most. And I'm stuck on how I can do to show the records of the images in pairs according to whether there was already a rating. It shows you a couple of images, you select the one you like the most and they must change the images for two others, that's the idea. Here is my models, the image model contain the image field atribute and the likes atribute who stores the likes of users. The UserLike model contain just the like of one user who will be add in the likes atribute (possibly i defines the class models incorrectly, 'couse i dont find the foreign key 'user_like' in users table) from django.db import models from django.core.validators import FileExtensionValidator from django.contrib.auth.models import User # Create your models here. class UserLike(models.Model): user_like = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) class Images(models.Model): image = models.ImageField(validators=[FileExtensionValidator]) likes = models.ManyToManyField(UserLike, blank=True) def __str__(self): return f'Image: {self.image}' Here is my views, i already made … -
Django display images on custom domain directly without showing Digital Ocean Endpoint on webaddres
I have an django app that hosts images on digitalocean spaces. The images are correctly uploaded to my digital ocean spaces. But when I click on the image it is shown with the digital ocean web address. With CDN and custom domain, I thought the web address for the image will be my custom domain (e.g. media.mydoamin.com) but it is directed to digital ocean's endpoint still. sfo3.digtialoceanspaces.com. I already included a custom domain url in the settings and added a CNAME record to my domain registry media.mydomain.com to an alias as domainname.sfo3.cdn.digitaloceanspaces.com I can see the cname record is already updated online. what am I missing? -
Read the image as Array from Django Model
The django model is a follows class Post(models.Model): title = models.CharField(max_length=100) file = models.FileField(null=True,blank=True,upload_to='Files') content = models.TextField() date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) I want to read the file. Let's say its an image. I want to read this image in an array format. I tried this but it doesnt work. img = Post.objects.all()[0].file print(img) OR print(np.array(img)) Output is : car-1.jpg Expected output : 2d Array -
Is there any solution for this Django register post method.?
!this is register syntax in views.py](https://i.stack.imgur.com/US67H.jpg) I've registration form attached as shown above I've created helloworld_Register table in But the data is fetching to user_auth but not to the helloworld_register However data is fetching in user_auth but while logging in with registered credentials it's not logging in !this is login syntax in views.py](https://i.stack.imgur.com/MvV4m.jpg) Can any one sort me this it'll be helpful :) "I've tried fetching data to the helloworld_register but couldn't It's fetching to user_auth However data exist in user_auth It's unable to login." -
How to implement AbstractBaseUser with two user types ("Individual" & "Business"), where user can be both types
I am working on a custom user using AbstractBaseUser, where there are multiple types of user ("individual" users and "business" users). I have defined a User model with these two types and created a separate app for their profiles which will be different depending on the user type. I have used two models to split this out, both with a OnetoOne relationship to the User model, then used proxy models & managers to filter each queryset. The part which I'm struggling with is in that I would like for a user to be able to sign up to both an Individual account, and a Business account using the same email authentication. I.e. one user, can be two types, and therefore access application components which relate to both user types. At the moment I believe they can only be one or the other. Has anyone come across this before or have any ideas of how I might implement this? The tutorials I have found haven't covered this as they have said it is "too complex", but I thought it might just be a case of making the type field a multiple choice field, but not sure if this is the case?