django-1.3

issue in loading static contents in django1.3+mod_wsgi+apache2

﹥>﹥吖頭↗ 提交于 2020-01-16 19:23:11
问题 I am facing problem with static files(Django1.3) when tried to deploy it in my local apache server(apache2+mod_wsgi), the problem only for the static contents other parts ok[its worked in the devlopment server]. My project now in a folder 'testcloud' in Ubandu Desktop,My project name is DjangoApis,Following is my project structure: Desktop->testcloud: DjangoApis ... mywebapp static templates templatetags urls.py views.py myapis ..... Settings.py STATIC_ROOT = '/home/jisson/Desktop/testcloud

Django using model of one app into other app's model

此生再无相见时 提交于 2020-01-05 07:39:11
问题 Salam and hi, I am using django and breaking two parts of project in two apps. However there is a reference field of one table as foreign key of other in terms of db. So how can I use one app's model primary key as foreign key of another app's model? And if is not possible then should I just make single app of all such apps. I am actually thinking apps as different modules/components of project, may be I will be adding some apps in future. thanks 回答1: Either import the model from the other

Django 1.3 logging: 500 errors are not logged

邮差的信 提交于 2020-01-03 07:29:10
问题 I'm struggling to make the 'django.request' logger work as advertised - 500 errors don't seem to propagate to handlers attached to it. In the default logging configuration for every new project, the comment says the "logging performed by this configuration is to send an email to the site admins on every HTTP 500 error". Obviously the email is only sent if you've setup ADMINS correctly, but I'm not even seeing the handler get called when a view raises an exception. I built a testcase starting

django admin custom list_filter

て烟熏妆下的殇ゞ 提交于 2019-12-23 04:29:25
问题 I did the upgrade to 1.3 version and this code doesn't work any longer: class CustomChoiceFilterSpec(ChoicesFilterSpec): def __init__(self, f, request, params, model, model_admin): super(CustomChoiceFilterSpec, self).__init__(f, request, params, model, model_admin) self.lookup_kwarg = '%s__id__exact' % f.name # Change this to match the search of your object self.lookup_val = request.GET.get(self.lookup_kwarg, None) self.objects = model.objects.all() self.foreign_key = f.name self.foreign_key

How to specify something other than pk or slug for DetailView

血红的双手。 提交于 2019-12-22 04:20:51
问题 I was wondering if it was possible to use something besides a pk or slug when you are using a DetailView in Django 1.3. For example, I currently have: url(r'^mymodel/(?P<pk>\d+)/$', MyDetailView.as_view()) as my url. Say I wanted something like: url(r'^mymodel/(?P<name>\d+)/$', MyDetailView.as_view()) where name would be a field in the model. Is there anyway to have the DetailView use that to 'grab' the object I want and pass it on to my template? 回答1: A slug doesn't have any particular

How to specify something other than pk or slug for DetailView

我与影子孤独终老i 提交于 2019-12-22 04:20:05
问题 I was wondering if it was possible to use something besides a pk or slug when you are using a DetailView in Django 1.3. For example, I currently have: url(r'^mymodel/(?P<pk>\d+)/$', MyDetailView.as_view()) as my url. Say I wanted something like: url(r'^mymodel/(?P<name>\d+)/$', MyDetailView.as_view()) where name would be a field in the model. Is there anyway to have the DetailView use that to 'grab' the object I want and pass it on to my template? 回答1: A slug doesn't have any particular

how to get POST data in django 1.3

牧云@^-^@ 提交于 2019-12-20 12:35:55
问题 Hey, I am following this tutorial to learn to make a wiki page with Django. However, it is made in django 0.96 and I use Django 1.3 so there are some things that are different. Some I already fixed myself, however this one I can't seem to make it work. I made a form that submits data to a view. This is the form: <form method="post" action"/wikicamp/{{page_name}}/save/">{% csrf_token %} <textarea name="content" rows="20" cols="60">{{content}}</textarea><br> <input type="submit" value="Save

What is the easiest way to clear a database from the CLI with manage.py in Django?

荒凉一梦 提交于 2019-12-18 10:44:15
问题 I am using Django to build a website with MySQL. Now as I am learning so I need to change the Model very often so I want that all tables get cleared and new table get created. But syncdb doesn't touch existing tables. Is there any better way to handle this problem? 回答1: If you don't care about data: Best way would be to drop the database and run syncdb again. Or you can run: For Django >= 1.5 python manage.py flush For Django < 1.5 python manage.py reset appname (you can add --no-input to the

django-userena views.py and user registration issues

╄→гoц情女王★ 提交于 2019-12-13 18:06:41
问题 django-userena does not have a views.py file. It uses instead html files, i would like to use this views.py instead of the html files, because i want to add some other features, like a file uploader. I'm having a hard time implementing apps like django-jquery-file-upload The second question is how to activate the user's account automatically after that he confirms his email. 回答1: The first thing that i would like to do is get rid of the html files and replace them with this views.py, django

How to call a Python function within a Backbone.js view?

被刻印的时光 ゝ 提交于 2019-12-12 01:33:18
问题 I'm working on a project that's in the process of migrating from Django 1.3 to Node/Backbone.js Consequently, I'm working with two sets of views. I have a function for validating and processing images to be uploaded via a form, written in Python using PIL, that was originally designed for use in the Django views; however, the view that handles forms has since been migrated to Backbone. I don't expect it to be an optimal solution, but for the sake of expediency I wondered if there's a way to