I'd like the login form (AuthenticationForm from django.contrib.auth) to appear on every page in my site if the user is not logged in. When the user logs in, they will be redirected to the same page. If there is an error, the error will be shown on the same page with the form.
I suppose you'd need a context processor to provide the form...
Hi, all.
I have set up a url mapping that goes like this:
(r'enroll/$', 'enroll')
In my development environment this mapping is used when I visit '/enroll/'.
But in the production environment, the Django application is under '/activity/' and '/activity/enroll/' should be used.
Please tell me how do I get the correct url in both cas...
Trying to learn Django, I closed the shell and am getting this problem now when I call python manage.py syncdb, any idea what happened?:
I've already set up a db. I have manage.py set up in the folder django_bookmarks. What's up here?
Traceback (most recent call last):
File "manage.py", line 2, in <module>
from django.core.manage...
When I use Django's logout function to log out an authenticated user, it switched locale to en_US, the default one.
from django.contrib.auth import logout
def someview(request):
logout(request)
return HttpResponseRedirect('/')
How to keep user's locale after logged out?
...
When debugging my django apps I use pdb for interactive debugging with pdb.set_trace().
However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset.
Is there anyway for this to happen automatically? It can be real annoying, having to cancel the runserver and reset...
I got a model TrackedItem with a generic relation linking to any model it is supposed to track.
If I do that:
t = TrackedItem(content_object=MyModel)
t.save()
t.save()
I get :
IntegrityError: (1062, "Duplicate entry '1' for key 'PRIMARY'")
Indeed, the first save has created an entry with "1" as a PK. But the second save should not...
I use django, and have a lengthy models.py file.
class Foo(models.Model):
name = models.CharField()
class Bar(models.Model):
name = models.CharField()
class Fab(models.Model):
name = models.CharField()
Is there a way to make a list of all the classes in the file which are an instance of (models.Model)?
...
As the title says. Any ideas? When accessing from desktop browser it's all ok.
...
At work we are inte process of starting development on a new web-based product. Before doing so we need to establish what technology stack we are going to use. For this application my preference would have been to use Django but since the development- and management-team is soo heavily rooted with Microsoft the new product will have to b...
Currently all JavaScript files are served from our static/media directory in the top level project directory. When running makemassages -d djangojs it will generate the locale directory in the top level too.
However, javascript_catalog will only consider locale directories created in apps, i.e. listed in the INSTALLED_APPS setting.
Wha...
Hi !
I have an application that splits models into different files.
Actually the folder looks like :
>myapp
__init__.py
models.py
>hooks
...
...
myapp don't care about what's in the hooks, folder, except that there are models, and that they have to be imported somehow, and installed by syncdb. So, I put this i...
I'm a Django newbie who needs help: Even though I change some urls in my urls.py I keep on getting the same error message from Django. Here is the relevant line from my settings.py:
ROOT_URLCONF = 'mydjango.urls'
Here is my urls.py:
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from dja...
I have blog comment forms in Django and I would like to know the following:
Should I add CSRF to the forms?
If I want to use the simple "render_comment_form" method, how do I add it?
If I can't add it like that, what is the best practice for doing it?
Each tutorial or discussion on the subject seems to have a different approach, and ...
I'm writing some unit tests for a Django project, and I was wondering if its possible (or necessary?) to test some of the decorators that I wrote for it.
Here is an example of a decorator that I wrote:
class login_required(object):
def __init__(self, f):
self.f = f
def __call__(self, *args):
request = args[0...
I want to use str(uuid.uuid4()) instead of the name uploaded.
I have this model:
class foo(models.Model):
pic = ThumbnailField(upload_to='pics', size=(200, 200))
I am uploading hello_world.jpg and I should save these named versions should be saved for example in 4ba9b397-da69-4307-9bce-e92887e84d2f.jpg.
How can I do that?
...
Hello,
I'm using Django and I would like to check if there are new records in queryset (which I display in table) and if there are new I would like to either update my table accordingly with fade effect or display most recent 5 records in another div/box.
I've used jquery autorefresh, but it fades in / fades out even if there are no n...
I have an issue where the local version of django is handling image upload as expected but my server is not. Note: I am using a Django Container on MediaTemple.net (grid server)
Here is my code.
def view_settings(request):
<snip>
if request.POST:
success_msgs = ()
mForm = MainProfileForm(request.POST, request.FILES, instan...
I've set up django-filebrowser in my app without any bugs, I already had django-tinymce set up and it loads the editor in the admin forms. I now want to use django-filebrowser with django-tinymce, but I keep getting a weird javascript error when I click on "Image URL" in the Image popup:
r is undefined
the error is js/tiny_mce/tiny_mc...
I'm new to openid, and I am getting an "invalidate_handle" and I have no idea what to do to fix it.
I'm using django_authopenid
[Thu Apr 29 14:13:28 2010] [error] Generated checkid_setup request to https://www.google.com/accounts/o8/ud with assocication AOxxxxxxxxOX5-V9oDc3-btHhFxzAcccccccccc2RTHgh
[Thu Apr 29 14:13:29 2010] [error]...
I am using Django for a project and is already in production.
In the production environment 500.html is rendered whenever a server error occurs.
How do I test the rendering of 500.html in dev environment? Or how do I render 500.html in dev, if I turn-off debug I still get the errors and not 500.html
background: I include some page ele...