0
votes
0answers
18 views

Weird behaviour of urls.py django

I have multiple applications in my django project and in my main urls.py, i have: from django.conf.urls import patterns, include, url import problamatic_app.urls as this_app from django.contrib ...
0
votes
1answer
12 views

Datetime Field Received a Naive Datetime

I'm running into the classic DateTimeField received a naive datetime while time zone support is active warning with a twist. The error occurs when I run tests that utilize factories provided by ...
0
votes
0answers
17 views

Django Admin Urls Not Working

Some of my django urls will not work. I can visit my index page and the django admin page just fine. I can log in and create objects no problem. For example, I can create a site, like below, but when ...
0
votes
0answers
9 views

Set NewRelic app name per-request

I'd like to break some specific views from a django app out into a separate NewRelic application. The NewRelic python docs implies that I can set request.environ['newrelic.app_name'] and it will use ...
0
votes
0answers
18 views

Django custom template loader

I have the following structure: categories category1 app1 template.html views.py app2 template.html views.py category2 ...
0
votes
1answer
12 views

Django CMS auto display correct plugin for placeholder

I'm a bit new to Django CMS (django-cms.org) as am having a difficult time finding a solution for this simple problem. In Django CMS, when I setup placeholders in a template, like so: {% placeholder ...
1
vote
1answer
11 views

Django get_model returns None for Mezzanine BlogPost model

I'm having a problem with get_model for Django. get_model works with every model I'm trying to get except for the BlogPost model from Mezzanine. I've tried: model = get_model('mezzanine.blog', ...
0
votes
1answer
18 views

Per user soft-delete model design in Django

I am designing an application where users send/receive records and I would like deletes to be separated for each user listed in the record (one user's delete will not hide the record from the other ...
1
vote
1answer
30 views

Import Error on server, but working OK in local machine

I have the following project structure: apps(python package) | | |----------trips(python package) |----__init__.py |----urls.py ...
0
votes
1answer
18 views

Django or Python active Blog system/engine [on hold]

I've been looking for an active Django/Python blog systems but I can't seem to find something that would be easy and intuitive for non-developers to use (i.e. Wordpress-like). Requirements, Basic ...
0
votes
0answers
28 views

Recommended workflow/best practice for setting up Virtual env within Vagrant

I am following the getting started with Django tutorial and managed to finish the 1st project but when I re-entered Vagrant SSH all packages i installed on my vagrant shared folder and my virtual ...
0
votes
0answers
12 views

Associate-only authentication with Python Social Authentication and Django

For a simple proof of concept, I am configuring a Django app to authenticate against an in-house OAuth2 server via python-social-auth. Note: I am new to Django, so still trying to figure my way ...
0
votes
1answer
16 views

Extra “row-level” data in ListView django

I'm writing my first django app and can't seem to pass "row-level" data to the template through ListView. Specifically I'm trying to show all Polls and their corresponding Vote information using a ...
0
votes
0answers
29 views

Django equivalent of join on self join?

I've got a pair of tables in a mysql database: CREATE TABLE `assets` ( `idasset` varchar(255) NOT NULL, `guid` varchar(36) DEFAULT NULL, `type` varchar(64) DEFAULT 'unknown', PRIMARY KEY ...
0
votes
0answers
19 views

Doc not generated with sphinx

I am trying to generate documentation from a django project with sphinx-apidoc. However, I am only able to see packages and modules names. Docstring are not detected. Here is how I proceed : I ...
0
votes
1answer
29 views

Django get value from foreign key when the object was instantiated

I am writing a simple online ordering app. I am encountering an issue when the item price gets updated. The orders that were completed also changes price. I would like to have the orders with the ...
1
vote
1answer
16 views

django unique relations not unique table

Take the following model: class Foo(models.Model): bar = models.ForeignKey(Bar) name = models.CharField(max_length=30) #... so what this does is connect a Foo model to a Bar model and ...
0
votes
0answers
11 views

Open djnago-filebrowser by HTTPS from TinyMCE

All site work on HTTPS. When open filebrowser from TinyMCE, it's open by HTTP and browser block it! What need for open filebrowser by HTTPS? I tried setup MEDIA_URL and STATIC_URL with HTTPS protocol ...
0
votes
1answer
26 views

Django Serialize ValueQuerySet

I'm new to Django and I'm running into issues trying to return a ValueQuerySet as a JSON. Let's say I have a model: class Poll(models.Model): date = models.DateTimeField() I want to get the ...
0
votes
0answers
19 views

Django Form Validation and Admin Actions

I'm working on a project in which I want to do bulk updates of items in my database. I thought it would be best to leverage the Django Admin page for this. Here is the function and corresponding form ...
0
votes
1answer
31 views

In a Django template, how do I access attributes of a dict element whose key has a space?

I have a dict of forms that my template receives: forms = {'Cholera': CholeraForm(), 'Foot And Mouth Disease': FootMouthDiseaseForm()} The plan is to display each key in a select form element, and ...
0
votes
2answers
31 views

How to add verbose name after a field in Admin - Django

I have inserted a verbose name for a field in my models (Boolean Field) and when displaying in the admin, the checkbox is shown before the verbose name. How can I do so that the checkbox shows after ...
0
votes
1answer
35 views

Python Django save image works in Manage.py shell but not when the viewing page

I have created a small function: def generate_name_img(self, _name): fontPath = os.path.join( settings.BASE_DIR, "DejaVuSans.ttf" ) sans30 = ImageFont.truetype ( fontPath, 30 ) _path ...
0
votes
0answers
103 views

Debugging Apache/Django/WSGI Bad Request (400) Error

My simple Django app worked fine in debug mode (manage.py runserver), and works under WSGI+Apache on my dev box, but when I pushed to EC2 I began receiving intermittent (10-80% of the time) errors of ...
0
votes
2answers
51 views

DJango: formatting json serialization

I have the following DJango view def company(request): company_list = Company.objects.all() output = serializers.serialize('json', company_list, ...
0
votes
2answers
82 views

Django: TypeError: 'is_active' is an invalid keyword argument for this function

I keep receiving this error when I try to create a user via the createsuperuser management command: TypeError: 'is_active' is an invalid keyword argument for this function I have tried adding the ...
2
votes
1answer
72 views

How to setup python-pulsar with apache

Trying to work with Django python pulsar concurrent processing framework. The wsgi server provided by pulsar can be used through command line as $python manage.py pulse which basically starts a ...
4
votes
3answers
151 views

How do I force Django to connect to Oracle using Service Name

Q : How do specify that Django needs to connect to Oracle DB using the service name and not SID ? Hi, I am currently telling my Django configuration to connect to Oracle using my SID. However, ...
4
votes
1answer
271 views

What is causing this error on part 3 of Django tutorial?

I have run into an issue while working through the Django tutorial, specifically when adding more views to the poll application. For reference, this is the beginning of the section that trips me up: ...
8
votes
5answers
4k views

Executing Python script from Django shell

I need to execute a Python script from the Django shell. I tried ./manage.py shell << my_script.py But it didn't work. It was just kinda waiting for me to write something.
11
votes
3answers
4k views

Bad Django / uwsgi performance

I am running a django app with nginx & uwsgi. Here's how i run uwsgi: sudo uwsgi -b 25000 --chdir=/www/python/apps/pyapp --module=wsgi:application --env DJANGO_SETTINGS_MODULE=settings ...
1
vote
1answer
204 views

Using formset_factory in Django

I'm a new user to Django, i use the following code to produce a form class GetMachine(forms.Form): Machine_Name = forms.CharField(max_length=20) Number_of_lines = ...
-1
votes
2answers
2k views

attribute error 'function' object has no attribute 'has_header'

i have been encountered by this error 'function' object has no attribute 'has_header' my url file contans url(r'^HighDefs/$', list_HighDefs), and i have a view defined with the name ...
4
votes
1answer
4k views

Iterating over related objects in Django: loop over query set or use one-liner select_related (or prefetch_related)

I have a newsletter application where a newsletter has multiple articles within each issue. I want to display a summary page online that lists the newsletter year, volume and label, and then in an ...
13
votes
1answer
4k views

How can I login to django using tastypie

I'm trying to override is_authenticated in my custom authentication. I have something simple (to start with) like this: class MyAuthentication(BasicAuthentication): def __init__(self, *args, ...
1
vote
2answers
509 views

Getting the model ID from a Django form after having saved it

view.py someForm = SomeForm(request.POST) ... someForm.customSave(request.user) forms.py class SomeForm(ModelForm): class Meta: model = Some def customSave(self,user): lv ...
13
votes
2answers
6k views

How to use less css with django?

I'm using twitter bootstrap and django. I've got my dependencies handled with a pip requirements file. I've got 2 questions: How can I use less while I'm developing so it'll get compiled when I ...
4
votes
1answer
675 views

Selecting multiples choices in django admin filter list_filter?

Currently i filter by some option in django's admin interface. For instance lets say i filter by 'By status'. Is it possible to select multiple statuses to filter results from? Here is the screenshot ...
8
votes
1answer
1k views

Interoperating with Django/Celery From Java

Our company has a Python based web site and some Python based worker nodes which communicate via Django/Celery and RabbitMQ. I have a Java based application which needs to submit tasks to the Celery ...
0
votes
1answer
952 views

Syntax Error in Django urls.py

I'm having a frustrating time installing a very simple recipes website for myself using Django. Everything has been going fine until I attempt to set up my urls.py, which reads: from ...
40
votes
6answers
22k views

Why don't my south migrations work?

First, I create my database. create database mydb; I add "south" to installed Apps. Then, I go to this tutorial: http://south.aeracode.org/docs/tutorial/part1.html The tutorial tells me to do ...
12
votes
4answers
2k views

What is the clean way to unittest FileField in django?

I have a model with a FileField. I want to unittest it. django test framework has great ways to manage database and emails. Is there something similar for FileFields? How can I make sure that the ...
6
votes
2answers
15k views

Django request get parameters

I django request i have the following POST:<QueryDict: {u'section': [u'39'], u'MAINS': [u'137']}> how to get the values of section and mains if request.method == 'GET': qd = ...
5
votes
1answer
7k views

How to delete a record in django models

I want to delete a record. But I of a particular record. Such as delete from table_name where id = 1; How can I do this in a django model? I am writing a function: def delete(id):` ...
20
votes
2answers
5k views

How do you convert a PIL `Image` to a Django `File`?

I'm trying to take an UploadedFile, convert it to a PIL Image object to thumbnail it, and the convert the PIL Image object that my thumb-creating function returns back into a File object. How can I do ...
21
votes
4answers
18k views

Django DateField default options

I have a model which has a date time field: date = models.DateField(_("Date"), default=datetime.now()) When I check the app in the built in django admin, the DateField also has the time appended to ...
15
votes
4answers
3k views

Django: Where to put helper functions?

I have a couple of functions that i wrote that I need to use in my django app. Where would I put the file with them and how would i make them callable whithin my views?
38
votes
7answers
18k views

html to pdf for a Django site

For my django powered site, I am looking for an easy solution to convert dynamic html pages (generated using django views and templates datas generated using GET forms) which also contains some graph ...
35
votes
9answers
24k views

Format numbers in django templates

I'm trying to format numbers. Examples: 1 => 1 12 => 12 123 => 123 1234 => 1,234 12345 => 12,345 It strikes as a fairly common thing to do but I can't figure out which ...
133
votes
15answers
61k views

In a django form, How to make a field readonly (or disabled) so that it cannot be edited?

In a django form, how do I make a field read-only (or disabled)? When the form is being used to create a new entry, all fields should be enabled - but when the record is in update mode some fields ...

15 30 50 per page