Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Cryptographic "signing.loads(value)" giving None with same SECRET_KEY
I have 2 Django Project with same SECRET_KEY. Using First project we are encrypting some important data using 'signing.dumps(value)' and sending via rest to another django project. Now I am trying to decrypt using signing.loads(value) its giving None why? -
java.io.FileNotFoundException: C:\Program Files x86\Python37-32\lib\multiprocessing\spawn.py
On a windows machine, working on a web app using DJango framework, and I'm completely new to Python as well. Through eclipse, I had setup DJango environment, and trying to get inside the method of certain class by pressing F3, as I used to do in case of Java. But Eclipse is showing following error after pressing F3 on some methods or sometimes on some classes also... Just asking whether I have missed some plug-in or dependency! Or what's wrong happening here, If it would not work properly then It would really become difficult for me to navigate between classes and methods. If more details are required about those classes and methods, please let me know. Thank you -
How to provide data from one input field to two input field of Django generated form?
I am trying get similar look on date range picker like below (figure 1). Figure 1 : Predefined Date Ranges HTML of current form <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="csrfmiddlewaretoken" value=""> <div id="div_id_start_date" class="form-group"> <label for="id_start_date" class="col-form-label "> Start date </label> <div class=""> <input type="text" name="start_date" value="2019-04-25" class="datetimeinput form-control" id="id_start_date"> </div> </div> <div id="div_id_end_date" class="form-group"> <label for="id_end_date" class="col-form-label "> End date </label> <div class=""> <input type="text" name="end_date" value="2019-04-26" class="datetimeinput form-control" id="id_end_date"> </div> </div> <input type="submit" id="btnsubmit" value="Submit"> HTML and JS of Figure 1 look < div id = "reportrange" style = "background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%" >< i class = "fa fa-calendar" > < /i>&nbsp; < span > < /span > < i class = "fa fa-caret-down" > < /i > < /div > < script type = "text/javascript" > $(function() { var start = moment().subtract(29, 'days'); var end = moment(); function cb(start, end) { $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } $('#reportrange').daterangepicker({ startDate: start, endDate: end, ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, … -
Django ModelForm not saving data to Model
I created a model and respective ModelForm, view and Template for it, but ModelForm does not save data to the model even though .save() function is used. I have tried reviewing forms and views but I do not know what is wrong.I have posted the respective models, forms, views and templates in the question. models.py: class Centre(models.Model): Location = ( ('rashmi_heights', 'Rashmi Heights Centre'), ('Levana', 'Levana Centre') ) name= models.CharField(max_length=50, blank=False, choices=Location, unique=True) address = models.CharField(max_length =250) contact = models.CharField(max_length=100, blank=False) phone = PhoneField(blank=True, help_text='Contact phone number') def __str__(self): return self.name forms.py: class CentreForm(forms.ModelForm): class Meta(): model = Centre fields = '__all__' views.py: def centre(request): forms = CentreForm() if request.method == 'POST': forms = CentreForm(request.POST) if forms.is_valid(): centre = forms.save(request.POST) centre.save() else: forms = CentreForm() return render(request,'NewApp/centreinfo.html',{'forms':forms}) template: <!DOCTYPE html> {% extends 'NewApp/base.html' %} {% load staticfiles %} {% block body_block %} <div class="jumbotron"> <h2>Fill details about your centre.</h2><br> <h3> </h3> <form method="post" enctype="multipart/form-data"> {{forms.as_p}} {% csrf_token %} <a class="btn btn-primary" href="{% url 'NewApp:centreinfo' %}">Submit</a> </form> </div> {% endblock %} -
Annotate count of FK of FK
I have a "Team" class, a "Game" class, a "Player" class and a "Goal" class. How can I annotate the count of "goals" for each "Team" considering that I have the following structure: class Team(models.Model): name = models.CharField('Team name', max_length=255) class Game(models.Model): team1 = models.ForeignKey(Team, verbose_name = 'Team 1') team2 = models.ForeignKey(Team, verbose_name = 'Team 2') class Player(models.Model): team = models.ForeignKey(Team, verbose_name = 'Team') class Goal(models.Model): player = models.ForeignKey(Player, verbose_name = 'Player') game = models.ForeignKey(Game, verbose_name = 'Game') What I have tried so far: Team.objects.annotate(nr_goals=Count('goal')).order_by('nr_goals') I also have the possibility to change my models if needed. -
Why I cannot set Django settings DATABASES engine to Postgis?
I have deploy my Django application to Heroku which involved using GeoDjango features and PostGis database. My settings is something like this. import os import django_heroku import dj_database_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'rest_framework', 'rest_framework_gis', 'django.contrib.gis', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'service.apps.ServiceConfig' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'ARProject.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'ARProject.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = {} DATABASES['default'] = dj_database_url.config(default='postgis://...') # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # … -
how to share database in two projects and get data in the form of json from one project to another project with two port numbers in django
Example : how to get employee data in the form of json using rest framework from one project to another project sharing single database in Django with separate port numbers -
Django not showing templates other than base.html
I am having trouble seeing changes made to any template that isn't base.html. I am currently trying to make changes to the homepage, but changes aren't showing in Chrome. I have the cache disabled in Chrome. This was working for me a few days ago, and I haven't made any changes to URLS or VIEWS. {% extends 'base.html' %} {% load static %} {% block content %} <body> <h1>helloooooo</h1> </body> {% endblock content %} -
How do I display output of a python within Html in django?
I'm trying parse my blog posts with rss using feedparser and displaying it within the html tags. How i can display it within html ? Any help would be really appreciated. I have tried it using it within the views.py and def gspace(request): d=feedparser.parse('http://glammingspace.blogspot.com/feeds/posts/defaultalt=rss') r = d.entries[0].summary response_html = '<br>'.join(r) return HttpResponse(response_html) I have tried to display it in html , something like this {{request.gspace}} but it doesn't work fine .. help me to do it in better way. -
Can I name the field myself when I update in django view?
Can I name the field myself when I update in django view? ex if field value is "ca2" Can I use this as the field value for the update function of django-orm? when i try this code below error is occured AttributeError: 'CategoryNick' object has no attribute 'update' def update_shortcut_nick(request): if request.method == "POST" and request.is_ajax(): ca_id = request.POST['ca_id'] field = request.POST['field'] ca_nick_update = request.POST['ca_nick_update'] print('update id : ',ca_id) print('update field : ',field) print('update value : ',ca_nick_update) update = CategoryNick.objects.get(id=ca_id).update( field = ca_nick_update) # .update(field = ca_nick_update) print('update success : ' , update.id); return JsonResponse({ 'message': 'shortcut category nick name update success ' +ca_nick_update, }) else: return redirect('/wm/shortcut') -
How can i convert sql to django orm query
SELECT Em.Emp_FName+' '+Em.Emp_MName+' '+Em.Emp_LName Name, Em.Emp_Code FROM tbl_Dtl_Employee Em, TX_Employee_Checklist empChk WHERE Em.Emp_Code=empChk.EmpCode AND empChk.DepartmentEmail='suchita.thawari@bilt.com' AND empChk.Required='T' AND empChk.Status='F' GROUP BY Em.Emp_FName,Em.Emp_MName,Em.Emp_LName, Em.Emp_Code -
Django save tuple of string unexpectedly
I'm updating data in django, but the string data becomes tuple string when saved in the database. @api_view(["POST"]) def cate_edit(req): if not req.user.is_staff: return HttpResponseNotFound() data=jsonload(req.body) if not has(data,["id","title","other_title","introduction"]): return HttpResponseForbidden() id=toNumber(data["id"]) if id==None: return HttpResponseForbidden() if id==0: c=Category( title=data["title"], other_title=data["other_title"], introduction=data["introduction"] ) c.save() return HttpResponse(c.id) else: c=get_object_or_404(Category,id=id) c.title = data["title"], c.other_title = data["other_title"], c.introduction = data["introduction"] c.save() return HttpResponse(c.id) The problem happened in the final else, I can make sure the data is a valid and normal dict, such as {'id': 1, 'title': '1', 'other_title': '2', 'introduction': '3'} but after this save process, the data in database is title: "('1',)" other_title:"('2',)" introduction: '3' introduction is correct actually. Additionally, here is the model of category class Category(models.Model): title = models.CharField(max_length=50) other_title = models.CharField(max_length=50,blank=True) image = models.ImageField(blank=True,null=True,upload_to=file_path) introduction = models.TextField(default="",blank=True) last_modified = models.DateTimeField(auto_now=True) def __str__(self): return self.title Thanks -
Django oscar vs Django Saleor which one is better for building an e-commerce website?
I am familiar with Django and Django rest But I am a newbie in Django Oscar and Django Saleor. Right now I am exploring Django oscar and woking on it which gives so many customization built in dashboard and all other things but I don't have any idea of Djago Saleor. So anyone have experience of both things and can tell me which one is better for developing an ecommerce website with Django? Django Oscar or Django Saleor? -
xlrd doesn´t read date cells from excel properly
I am reading an exel file using xlrd, and I have some cells with date values: The problem is that xlrd reads this values as numbers. I have tried to change the type of the cells to string, but excel converts them to numbers too. This is the relevant code where I read the file: def import_partners(self): sheet = xlrd.open_workbook(os.getcwd()+settings.MEDIA_URL+'socios.xls', encoding_override="cp1252").sheet_by_index(0) rows = sheet.nrows for row in range(1, sheet.nrows): print("Importing partners: {}%\r".format(int((row/rows)*100)), end="") record = self.get_record('partner', sheet, row) self.save_record('partner', record) def get_record(self, type, sheet, row): record_getters = { 'partner': self.get_partner_record, 'operator': self.get_operator_record } record = record_getters[type](sheet, row) return record def get_partner_record(self, sheet, row): record = { 'clase': self.get_socio_clase(sheet, row), 'economico': self.get_socio_economico(sheet, row), 'nombre': self.get_socio_nombre(sheet, row), 'apellido': self.get_socio_apellido(sheet, row), 'fecha_nacimiento': self.get_socio_fecha_nacimiento(sheet, row), 'lugar_nacimiento': self.get_socio_lugar_nacimiento(sheet, row), 'apodo': self.get_socio_apodo(sheet, row), 'municipio': self.get_socio_municipio(sheet, row), 'telefono': self.get_socio_telefono(sheet, row), 'rfc': self.get_socio_rfc(sheet, row), 'sexo': self.get_socio_sexo(sheet, row), 'fecha_ingreso': self.get_socio_fecha_ingreso(sheet, row), 'tipo_sangre': self.get_socio_tipo_sangre(sheet, row), 'edo_civil': self.get_socio_edo_civil(sheet, row), 'quien_cede': self.get_socio_cede(sheet, row), 'licencia': self.get_socio_licencia(sheet, row), 'vence_licencia': self.get_socio_vence_licencia(sheet, row), 'tipo_licencia': self.get_socio_tipo_licencia(sheet, row), 'expedida': self.get_socio_expedida(sheet, row), 'activo': self.get_socio_activo(sheet, row), } return record def get_socio_fecha_nacimiento(self, sheet, row): fecha = sheet.cell(row, SOCIO_COL_FECHA_NACIMIENTO).value if fecha != '': return self.get_date(fecha) else: return None def get_date(self, fecha): try: date_array = fecha.split('/') except: return None if len(date_array) != 3: … -
Are Django forms ever used in Django Rest Framework?
The DRF tutorial includes the following line about DRF serializers vs Django forms: The first thing we need to get started on our Web API is to provide a way of serializing and deserializing the snippet instances into representations such as json. We can do this by declaring serializers that work very similar to Django's forms. But from what I can see, it says nothing else about the relationship between forms and serializers. Since DRF doesn't need the Forms' ability to render a model in a template, is it fair to assume that Forms have no purpose in DRF, and that serializers can handle all of the validation traditionally completed with forms? If so, when I'm building an API, can I forget about templates and forms entirely? -
how to declare query set in model.py
I want to have a query set in my models.py so that I can access it over admin view and also the templates. The problem I'm having is to declare the query set in admin.py and also view.py differently. I want a single query set which I can access it anywhere Here is my code in admin.py def get_queryset(self, request): qs = super(ItemTableAdmin, self).get_queryset(request) qs = qs.annotate( stock=(F('amount') - F('consumption')) ) return qs def stock(self, obj): return obj.stock and here is my code in views.py my_models = list(ItemTable.objects.all().annotate(stock=(F('amount') - F('consumption')))) my_models_table = items(my_models) RequestConfig(request).configure(my_models_table) which is giving me same result also in admin panel and template. ex: 8.00 - 7.00 = 1.00 Now here is my code in model.py which is to achieve the same goal and get access both in admin and template def query(self): return ItemTable.objects.all().annotate(stock=F('amount') - F('consumption')) I expect the output like 8.00 - 7.00 = 1.00, but the output I'm getting is "", , , , , ]>"" -
Import SQL file in Django (v-2.2)
I have a Django project and I am using MySQL as default. I already have created and migrated 2 models. Now I have a SQL file. I want to create new models and populate those models with this SQL file. I am using Windows 10. I have searched this query but did not get working solution. -
File downloads is not working in django 2.2
am using django 2.2 with python three I have my download function and get download function in the models the link is not working missing something download function def download_product(request,slug,filename): product = Product.objects.get(slug=slug) if product in request.user.profile.ebooks.all(): product_file = str(product.download) filepath = os.path.join(settings.PROTECTED_UPLOADS,product_file) wrapper = FileWrapper(open(filepath,'rb')) response = HttpResponse(wrapper,content_type=guess_type(product_file)) response['Content-Diposition'] = 'attachment;filename=%s' %filename response['Content-Type'] = '' response['X-SendFile'] = filepath return response else: raise Http404 models.py class Product(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,null=True,blank=True) name = models.CharField(max_length=120) description = models.CharField(max_length=500,null=True,blank=True) download = models.FileField(upload_to=download_loc,storage=FileSystemStorage(location=protected_loc),null=True,blank=True) price = models.DecimalField(max_digits=60,decimal_places=2) sale_price = models.DecimalField(max_digits=60,decimal_places=2,null=True,blank=True) slug= models.SlugField() def __str__(self): return self.name the template {% for object in object_list %} <div class="col-sm-3"> <p>{{ object.name }}</p> <p>Price: ${{ object.price }}</p> {% if object in user.profile.ebooks.all %} {% if object.download %} <p><a href='{{ object.download.url }}'>Download</a></p> {% endif %} <!-- add a button here to see the product --> You own this {% elif object in current_order_products %} <a href="{% url 'shopping_cart:order_summary' %}" class="btn btn-warning">Go to Cart</a> {% else %} <a href="{% url 'shopping_cart:add_to_cart' object.id %}" class="btn btn-warning">Add to Cart</a> {% endif %} </div> {% endfor %} So all the products files are upload to the protected folder ,when am adding a product but when comes to downloading first the link points to media … -
Is it safe to delete Django cache folder in htdocs/media?
I have a client who's Django server is running out of space due to new media being constantly uploaded (and stored in htdocs/media). In order to bring the server back up, I'd like to delete the contents of the htdocs/media/cache freeing up about 800m of space and giving it some breathing room (I would hope?). -
How do you implement django rest framework authentication with a 3rd party user authentication micro service?
I have an Angular frontend with a Django Rest Framework api. In order to authenticate the user on the backend I need to redirects the user to an external User authentication service which redirects them back with a token. The backend will then get the token and contact the service to get the users information. I have already implemented a Django Backend that handles this process for Admin logins using "login_required". However, when I use the login required decorator on the DRF routes I get the following error when the external User api is requested: Request Method: OPTIONS Status Code: 405 Method Not Allowed If there is an easy fix for this implementation that would be great. But, something tells me the correct implementation involves a Custom DRF Authentication class. -
Django - How to link a legacy database via API?
How do I go about integrating an online legacy database into my Django web app via API? Is it the same as if the database was hosted on my server? -
Create Dropdown With Values From Model in Django Form
I am attempting to create a dropdown field which populates with values from a model (Customers) and display it to the user. Below is what I am attempting - not exactly sure why, but the dropdown field is not populating with any of the info from the Customer Model, it is just empty. Views.py def add_order(request): if request.method == "POST": form = CreateOrderForm(request.POST) objectlist = Customers.objects.all() if form.is_valid(): form.save() return redirect('add_manifest')#, kwargs={'reference_id': form.cleaned_data['reference']}) #else: form = CreateOrderForm() objectlist = Customers.objects.all() context = { 'form': form, 'objectlist': objectlist, } return render(request, 'add_order.html', context) Template (add_order.html) <div class="container"> <form method="POST"> <br> <h2>Order Information</h2> <br> <div class="column_order"> <select> {% for element in objectlist %} <option value="{{ element.c_name }}"> {% endfor %} </select> </div> </div> Models.py class Customers(models.Model): c_name = models.CharField(max_length=100) c_address = models.CharField(max_length=1000) c_country = models.CharField(max_length=50) def _str_(self): return self.c_name When I go to this url and render the template, the select box displays, but there are no values in it. Any thoughts? -
AttributeError: 'AppConfig' object has no attribute 'urls' when trying to runserver
I'm building a django based ecommerce project with oscar. I pip installed django-oscar and followed the official documentation guide to setup the settings.py and the root url.py files. When i try to runserver i get the following error: AttributeError: 'AppConfig' object has no attribute 'urls' I run on Windows 7, python 3.7.2, django 2.2.2, django-oscar 1.6.2 Below are my settings.py and url.py files: Settings.py: import os from oscar.defaults import * BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '###############################' DEBUG = True ALLOWED_HOSTS = [] from oscar import get_core_apps INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', "django.contrib.sites", "django.contrib.flatpages", "compressor", "widget_tweaks", ] + get_core_apps(['forked_apps.checkout']) SITE_ID = 1 MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', "oscar.apps.basket.middleware.BasketMiddleware", "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware", ] AUTHETICATION_BACKENDS = ( "oscar.apps.customer.auth_backends.EmailBackend", "django.contrib.auth.backends.ModelBackend", ) EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" ROOT_URLCONF = 'commehub_oscar.urls' from oscar import OSCAR_MAIN_TEMPLATE_DIR TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR,"templates"),OSCAR_MAIN_TEMPLATE_DIR], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.contrib.messages.context_processors.messages', "oscar.apps.search.context_processors.search_form", "oscar.apps.promotions.context_processors.promotions", 'oscar.apps.checkout.context_processors.checkout', "oscar.apps.customer.notifications.context_processors.notifications", "oscar.core.context_processors.metadata", ], }, }, ] WSGI_APPLICATION = 'commehub_oscar.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', 'ATOMIC_REQUESTS': True, } } HAYSTACK_CONNECTIONS = { "default":{ "ENGINE":"haystack.backends.simple_backend.SimpleEngine", }, } AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', … -
Is it possible to validate across django-rest serializers?
Okay, so I have situation where I would like to be able to validate uniqueness across multiple serializers. I have a wrapper object that contains other objects. Right now the way that my program works is that I am performing puts on the id of the wrapper object, and any modifications to the contained objects are contained in the payload. Edits and deletes are placed in two different lists, and serialized separately as such: Edit = serializers.ListField(child = EditSerializer(),) Delete = serializers.ListField(child = DeleteSerializer(),) Both of these serializers have an ID field inside of them that ensures that they are referring to a valid pk as such: id = serializers.PrimaryKeyRelatedField(queryset = example.objects.all(),) Items that are in edits cannot be in deletes, and vice versa. I would like to have some extra validation in one of these serializers that checks to ensure that id does not also appear in the other serializer. Thus, we would get a validation error if we have the same id in edits and deletes. I realize that a check for this could be placed inside of the function that runs the actual updates, but I would like to have it inside of the validator function. Is … -
Will using a large array field in django hurt my application?
I have a django application that needs to be able to serve list pages of records of a certain model, sorting based on simple fields like user, time etc. This model, however, also needs a sometimes very large array field associated with it (could be up to 10s of megabytes or more per record in some cases), but this array data will only be used under certain circumstances, while it is not relevant any time a page is being generated. Since loading a model object, to my knowledge, will initialize all of the fields, will this hurt my application's performance, since large amounts of data will be constantly initialized and thrown away just to generate simple list views? Also, even if I make a separate model containing the large array data, with the original record pointing to it with a ForeignKeyField, will this not have the same problem since django will also initialize the foreign key related objects? If there is some way of modifying the objects Manager to only load this array field under certain circumstances, I think that would be decent solution