Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Timster
You cannot do something after the "return" line. This is Python functionality. When you return, the function exits and does not process anything else. What exactly are you trying to do? There is probably another way to accomplish it. -- You received this message because you are subscribed to

Re: reverse funtion gives me url including server path

2013-06-19 Thread Timster
It's this line: PythonOption django.root /var/www/project Change that to / or anything else and you should be all set. On Wednesday, June 19, 2013 10:32:12 AM UTC-4, Jiří Kupka wrote: > > Hi! I have little trouble with reverse function in my project. When I run > it over ./manage runserver, eve

Re: readonly_fields

2013-06-19 Thread Timster
gets do you know as some of > these are choice fields i.e. non text and non integer fields > > > On Wed, Jun 19, 2013 at 1:26 PM, Timster > > wrote: > >> Where are you setting that? readonly_fields is for ModelAdmin when you >> are working with the admin app. >&g

Re: readonly_fields

2013-06-19 Thread Timster
Where are you setting that? readonly_fields is for ModelAdmin when you are working with the admin app. If you want to do it in a normal form, you will need to set readonly attribute on the widget. -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: get_initial on a ForeignKey on ModelForm not working properly

2013-02-04 Thread Timster
By setting "initial" on a field, you are not changing the list of available options. Setting the initial like this determines which of all the locations are selected when the form is shown for the first time. The default would be to select the location for the event, but you are overriding that

Re: get_initial on a ForeignKey on ModelForm not working properly

2013-02-04 Thread Timster
You need to return initial from the method. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, sen

Re: django.conf.urls.defaults is deprecated

2013-01-07 Thread Timster
Are you including any other apps that are not located under your project folder? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/et1JsOmLoUQJ. To post to t

Re: RuntimeWarning "DateTimeField received a naive datetime" with TIMESTAMP MySQL field

2012-11-16 Thread Timster
It's well-documented. Check out the Django documentation page on time zones: https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/ When time zone support is enabled, Django uses time-zone-aware datetime objects. If your code creates datetime objects, they should be aware too. In this mod

Re: Duplicate entry in database on refreshing the submitted form

2012-09-29 Thread Timster
After saving the form, instead of doing a render_to_response, you should redirect the user to another page. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-

Re: Basic auth struggle

2012-09-13 Thread Timster
What does the rest of your views.py file look like? Do you happen to have a view named login()? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ANUnnrLEVB8

Re: Error: App with label world could not be found. Are you sure your INSTALLED_APPS setting is correct?

2012-09-06 Thread Timster
Well, do you have an app named "world" in your INSTALLED_APPS setting? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/jvL-1nGXQxEJ. To post to this group,

Prevent sorting in admin

2012-08-15 Thread Timster
Picture the following model and admin: class Section(models.Model): position = models.PositiveIntegerField(editable=False) title = models.CharField(max_length=200) class SectionAdmin(admin.ModelAdmin): list_display = ['title'] ordering = [ 'position'] The position is a column tha

Re: Template Question (for loop)

2006-07-28 Thread timster
That's not a bad solution. I just came up with a solution I'm very happy with. I created a custom manager that only returns visible objects. This way I can just do categories = Category.objects.all() and category.forum_set.all() in my template and it will only display visible objects. It works g

Re: Template Question (for loop)

2006-07-28 Thread timster
Yuck. I don't want to do it that way. It couples the display logic with the template. If I ever need to change the criteria that determines when to display forums/categories, I will need to change it in two places (view and template). --~--~-~--~~~---~--~~ You rec

Template Question (for loop)

2006-07-28 Thread timster
To start off, I have two models: class Category(models.Model): name = models.CharField(maxlength=50) visible = models.BooleanField(default=True) class Forum(models.Model): category = models.ForeignKey(Category) name = models.CharField(maxlength=50) visible = models.BooleanFie

Re: ImageField upload_to

2006-04-05 Thread timster
Thanks for the reply Ian. I seem to have solved this for the most part. The second message in that thread was very helpful. I was able to use that solution almost exactly. I added the following save() method to my model: def save(self): if self.image: import shutil from os im

ImageField upload_to

2006-04-04 Thread timster
I'm trying to create a simple image gallery. Here's what my models look like. It's very simple, a gallery can have one or more images. class Gallery(meta.Model): name = meta.CharField(maxlength=50) class Image(meta.Model): gallery = meta.ForeignKey(Gallery)] image = meta.ImageField(u

Re: How does one access the human readble names given in the model

2006-03-01 Thread timster
I think you may be able to do v.freshness.verbose_name. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from th

Django Admin

2006-03-01 Thread timster
to access the built-in admin site, I get the following error: AttributeError at /admin/ 'WSGIRequest' object has no attribute '_user_source' /home/timster/django_src/django/core/handlers/wsgi.py in _get_user 124. self._user = self._user_source.get_user(self) To the bes