I followed this example and it works great but I'm wondering if I can put in an exception so that when I am in the admin all objects show up (active and inactive). This might be simple but I can't find how to do it in the docs.
Here's what my manager looks like now:
class ShareManager(models.Manager):
def get_query_set(self):
...
I don't know why i can't match url when url is "http://localhost:8000/home/CPM%201.6.1001"
since i want pass parameter CPM 201.6.1001 from my template to urls
thanks:)
urls.py
urlpatterns = patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'^home/(?P<build>\[^/]+)/$'...
I am using twisted to pass in a variable into my django environment so I have to run the twisted server. Hence when I am testing my django app I really need to run the twisted code
it runs something like this:
def wsgi_resource():
pool = threadpool.ThreadPool()
pool.start()
# Allow Ctrl-C to get you out cleanly:
reactor...
I want to write url link in views, and then return to template.
views.py
for platform in platform_list:
if (fail_case.platform==platform):
html_front = "<a href=/home/%s/%s/%s>" % (build, run, fail_case.testResult_id)
html_back = "</a>"
brray.append(html_front + "X" + html_back)
else:
brray.appen...
I'm trying to figure out why this works:
>>> comments = Comment.objects.all()
>>>[c.content_object for c in comments]
[returns a list of the objects the comments are attached to]
But this doesn't:
>>> c = Comment.objects.filter(id=111)
>>> c
[<Comment: Related object name here ...>]
>>> c.content_object
Traceback (most re...
Dears
I am working on custom monitoring system to my server.
the application is developed using python and Django.
The server is running java web applications and I need to monitor the JVM under which the application server is running, so I start the applications with enable the JMX.
Now I need to connect my python application to the...
I am using django-localeurl to change the language of a project based on a suffix after the domain (example.com/en , example.com/hu etc). However I also have subdomains for the countries which are exactly the same as the suffixes.
How can I modify the locale-url or add another filter to the links so that I could change the suffix and su...
Suppose I have a Book model containing a foreign key to a Publisher model.
How can I display in the Django admin a column with the number of books published by each publisher, in a way that I can use the built-in sorting?
...
In django is there way to import all modules
ex: from project.models import *
ex: from project1.models import *
Can this be done with one statement
...
If I want to display more than one item of the request.META dictionary:
how can I put e.g. two in this string format:
def myurl(request):
return HttpResponse("You are %s" % request.META['USER'], "Your IP Adress is " % request.META['REMOTE_ADDR'])
does not work.
Any ideas how I can display/extract selective items of that dicti...
I understand everything from this code:
def display_meta(request):
values = request.META.items()
values.sort()
html = []
for k, v in values:
html.append('<tr><td>%s</td><td>%s</td></tr>' % (k, v))
return HttpResponse('<table>%s</table>' % '\n'.join(html))
Except this line: '\n'.join(html)
So \n creates a ...
Hi.
I have been using django-imagekit and django-cumulus now for a while in my app with Rackspace and I seem to be getting random errors, these do not occur on a regular basis, but more on an irregular basis.
Anyone experiencing the same issue?
The error seems to appear on {% for gun in guns %}
<div style="margin-top: 20px;">
{%...
Hi,
In my application i need the opposite to the date_of_talk__lte= as this results in where date_of_talk <= and I need this and this so should I just execute one query using model.objects.raw(query)?
Thanks in Advance,
Dean
...
I'm trying to create an admin user as part of my tests.py to check on persmissions.
UPDATE:
The tests.py is standard format that subclasses TestCase and the code below is called in the setUp() function.
I can create a normal user but not an admin user. If I try this:
self.adminuser = User.objects.create_user('admin', 'admin@test....
I'm new to python and django, and when following the Django Book I learned about the command 'python manage.py syncdb' which generated database tables for me. In development environment I use sqlite in memory database, so it is automatically erased everytime I restart the server. So how do I script this 'syncdb' command?(Should that be d...
I have a model with data in it defined like this:
class SyncJob(models.Model):
date = models.DateTimeField()
user = models.ForeignKey(User, unique=False)
source = models.CharField(max_length=3, choices=FS_CHOICES)
destination = models.CharField(max_length=3, choices=FS_CHOICES)
options = models.CharField(max_length=10, choices...
In certain situation users can send temporary files to my server. I would like to keep track of those temporary files (since they are used later and I would like to know, when I can remove them - or when they weren't used and can be collected). What kind of model should I use for it? I will send those files using AJAX (and iframe).
EDIT...
I'm getting a weird error and I can't track it down. The stack trace doesn't give any clue as to the location of the error either. It's just giving me the standard urlresolvers.py ViewDoesNotExist exception. Here is the error message:
Could not import myapp.myview.views. Error was: No module named model
At first I thought I forgot ...
i want to pass a variable by URL to another page in django admin.
it seems it is not working, i want to pass the variable "/?name=hello", and catch it by request.GET.get["name",""].but the url becomes "/?e=1" after it passed.
if i use the default parameter'q', it works, but it will have a conflict.
it seems this problem is django-admi...
i am using django-admin, and i have a model as following. it shows as a dropdown list in the admin. how can i order it by alphabet? instead of default user ID?
user= models.ForeignKey(User)
...