django-1.6

Django 1.6 TransactionManagementError: database doesn't behave properly when autocommit is off

非 Y 不嫁゛ 提交于 2019-12-31 20:03:16
问题 I'm trying to update a project from Django 1.5.5 to Django 1.6 however I've been getting this error everywhere. Traceback (most recent call last): File "project/virtualenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "project/virtualenv/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 215, in wrapper return self.admin_view(view, cacheable)(*args, **kwargs) File

Django can't access raw_post_data

大憨熊 提交于 2019-12-23 07:26:37
问题 I am experiencing a strange thing with Django, here is my views.py: def api(request): return HttpResponse("%s %s" % (request.method,request.raw_post_data)) Now I make an HTTP POST with POSTMAN (small app for google chrome). I set POSTMAN to make a POST request with 'test' in the raw field. Django returns me 3 different thing (random): Sometime Django returns 'GET' sometime nothing at all and sometime: AttributeError at / 'WSGIRequest' object has no attribute 'raw_post_data' Request Method:

Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

此生再无相见时 提交于 2019-12-20 18:09:15
问题 I'm trying to get django-register to work on my website but I keep getting this error which I do not understand I'm using django 1.6 on Python 3.3 NoReverseMatch at /accounts/register/ Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] Request Method: GET Request URL: http://127.0.0.1:8000/accounts/register/ Django Version: 1.6.1 Exception Type: NoReverseMatch Exception Value: Reverse for 'index' with arguments '()' and keyword arguments '{}'

Setting initial Django form field value in the __init__ method

情到浓时终转凉″ 提交于 2019-12-18 11:00:54
问题 Django 1.6 I have a working block of code in a Django form class as shown below. The data set from which I'm building the form field list can include an initial value for any of the fields, and I'm having no success in setting that initial value in the form. The if field_value: block below does indeed populate the initial form dictionary attribute, but the initial value is not being displayed. Note that (in case you are wondering) the .initial attribute does not exist until after the super()

View permissions in Django [duplicate]

假装没事ソ 提交于 2019-12-17 10:37:41
问题 This question already has answers here : Permission to view, but not to change! - Django (12 answers) Closed 3 years ago . As django admin has three permissions in it's auth : add, change, delete! I want to add view permission in this auth in admin panel.I know i have to customize permissions to add view permission in 'auth|permission|can view permission' to view all entries! THE WAY: [X] 1. Added 'view' to default permission list #./contrib/auth/management/init.py def _get_all_permissions

Django NoReverseMatch

ぃ、小莉子 提交于 2019-12-17 09:38:18
问题 I'm making a simple login app in django 1.6 (and python 2.7) and I get an error at the beggining that is not letting me continue. This is the site's url.py from django.conf.urls import patterns, include, url from django.contrib import admin import login admin.autodiscover() urlpatterns = patterns('', url(r'^$', include('login.urls', namespace='login')), url(r'^admin/', include(admin.site.urls)), ) And this is login/urls.py: from django.conf.urls import patterns, url from login import views

Send email to multiple recipients with bcc 'hidden' address - Django 1.6

∥☆過路亽.° 提交于 2019-12-13 06:05:18
问题 I'm developing an app on Django 1.6 In this app, there is a section, where a User which publishes a project can receive a message from a freelancer interested into this project. So far this is the code I have: # Send email if user_profile.contracting: subject = _('Your question on project {} has been answered') body = _('You can read your answer here {}') email = question.user.email else: subject = _('Your have a new question on project {}') body = _('You can read your question here: {}')

Slow django database operations on large (ish) dataset.

╄→гoц情女王★ 提交于 2019-12-12 02:58:24
问题 I set up a system to filter the twitter real time stream sample. Obviously, the database writes are too slow to keep up with anything more complex than a couple of low-volume keywords. I implemented django-rq as a simple queuing system to push the tweets off into a redis based queue as they came in, and that works great. My issue is on the other side. The context to this question is I have a system that's running right now, with 1.5m tweets for analysis, and another 375,000 queued through

static files in django 1.6 not found

孤人 提交于 2019-12-12 02:46:26
问题 I'm just starting with django 1.6 and my css is not working neither my images, I get a 404 error, even the admin(s css is not working Here is my file structure : myproject --myproject ----templates --static ----css ----media --myapp --mp.db --manage.py This is my base.html : <link rel="image_src" href="{% block image_src %}http://{{ request.META.HTTP_HOST }}/static/images/logo.png{% endblock %}" /> <link rel="stylesheet" media="screen" href="{{ STATIC_URL }}css/utils.css"> <link rel=

How to set initial value for read only field

跟風遠走 提交于 2019-12-11 21:22:51
问题 I have a django application which is using django.contrib.admin for administrative tasks. For one model I now need to add a field which indicates which part of the code each row was created from. I am using readonly_fields to prevent this value from being changed through the administration interface. A default value in this field will tell me that the row was either created before the field was introduced created by code which has not been updated to set the field created through the