Re: settings.TIME_ZONE

2009-12-06 Thread XtraGreen
Ok, turns out when I set TIME_OUT to 'UTC' it was storing and retrieving the dates correctly. But when I was viewing the dates in psql and pgAdmin III it was showing the dates using my system's time zone data. -- You received this message because you are subscribed to the Google Groups "Django

Re: admin templates issue

2009-12-06 Thread gentlestone
I did not make any changes, just copied the original template to template/admin I tried to copy the tepmplate to root (templates/admin) for every app and model and also I tried copy the template to some app and model - the same result Because it didn't work, I put the line: into base.html.

Re: Pydev + Django + Ubuntu 9.10

2009-12-06 Thread Brian McKeever
I was having the same trouble you are when I installed eclipse from the repository. I fixed it by downloading it again from the website http://www.eclipse.org/downloads/ (Eclipse IDE for C/C++ Developers (79 MB) is the one I picked specifically). On Dec 6, 2:45 am, turkan

Re: Following "first app" tutorial -- admin site can't find css files

2009-12-06 Thread Waqqas Jabbar
for test server i add the following lines in settings.py import os SITE_ROOT = os.path.realpath(os.path.dirname(__file__)) STATIC_DOC_ROOT = os.path.join(SITE_ROOT, 'media/') and add the following lines in urls.py if settings.DEBUG == True: urlpatterns +=

Re: How to validate a form field whose value can only increase?

2009-12-06 Thread Shawn Milochik
On Dec 6, 2009, at 11:01 PM, Continuation wrote: > What do you mean by the __init__ of the model? > Every models.Model object has an __init__ function, like any Python class. You need to override it. Add this into your model (in your models.py): def __init__(self, *args, **kwargs):

Re: settings.TIME_ZONE

2009-12-06 Thread XtraGreen
Not only do I have settings.TIME_ZONE set to 'UTC', I'm also creating datetime objects via utcfromtimestamp() as follows: field = datetime.datetime.utcfromtimestamp(time.time()) So I figured they would be going into the database as UTC anyway. When I figured out that they were showing UTC-6

Re: How to validate a form field whose value can only increase?

2009-12-06 Thread Continuation
What do you mean by the __init__ of the model? My directory structure is: myapp/models MyModel lives inside myapp/models. There's an __init__.py file within myapp, but it's empty and I've never touched it. Can you be more specific about what to do? Thanks. On Dec 6, 10:52 pm, Shawn Milochik

Re: How to validate a form field whose value can only increase?

2009-12-06 Thread Shawn Milochik
The easiest way I know of is this: In the __init__ of the model, create a variable: self.old_value = self.fieldname. In the save() function, you can check self.fieldname against self.old_value. Shawn -- You received this message because you are subscribed to the Google Groups "Django

How to validate a form field whose value can only increase?

2009-12-06 Thread Continuation
I created a form class based on a model: class MyModel(models.Model): increasing_field = models.PositiveIntegerField() class MyForm(forms.ModelForm): class Meta: model = MyModel I created a form to change an existing MyClass instance using POST data to populate the

Re: settings.TIME_ZONE

2009-12-06 Thread XtraGreen
On Dec 6, 9:21 pm, Graham Dumpleton wrote: > Some explanation of this issue in: > >  http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Timezone_and_... > > If using Apache/mod_wsgi, delegate Python web application instances > with specific timezone, locale,

Re: settings.TIME_ZONE

2009-12-06 Thread XtraGreen
On Dec 6, 8:39 pm, Brian Neal wrote: > What is your server setup? Apache on Linux? mod_python or mod_wsgi? > Are you running anything else on your server like PHP apps? The > timezone setting is process-wide, so depending on how you deployed > your server another application

Re: settings.TIME_ZONE

2009-12-06 Thread Graham Dumpleton
On Dec 7, 1:39 pm, Brian Neal wrote: > On Dec 6, 7:40 pm, XtraGreen wrote: > > > I've changed settings.TIME_ZONE to 'UTC' and restarted my server but > > when I create records (postgresql) they're not UTC, they're 'America/ > > Chicago' (-6) in the

Re: How to change this function to use generic view

2009-12-06 Thread 一千瓦的刀狼
Hello? Anyone can help me? On Dec 6, 9:18 am, 邓超 wrote: > Hi all, >   I want to change below function to use the generic view function > update_object: > > @login_required > def edit_bug_page(request, bug_id = None): >     if bug_id == None: >         bugInstance = Bug() >  

Re: Parsing XML in the template? (New to Django and Python)

2009-12-06 Thread Sam Lai
2009/12/7 sleepjunk : > Thanks so much for your help. I'm sorry to ask another question, but I > am getting an error and have spent a few hours trying to figure it > out. Googling has not helped me. > > Environment: > > Request Method: GET > Request URL: http://127.0.0.1:8000/

Re: settings.TIME_ZONE

2009-12-06 Thread Brian Neal
On Dec 6, 7:40 pm, XtraGreen wrote: > I've changed settings.TIME_ZONE to 'UTC' and restarted my server but > when I create records (postgresql) they're not UTC, they're 'America/ > Chicago' (-6) in the table. > > Am I missing something or is settings.TIME_ZONE useless?

Following "first app" tutorial -- admin site can't find css files

2009-12-06 Thread Arthur
I'm using svn install. I am using the same virtualhost for django and static files, with ADMIN_MEDIA_PREFIX set to '/media/', which I believe was the default. The admin app works fine so far, but the server gives me a 404 on the css files: Using the URLconf defined in testproject.urls,

PIL zip decoder error (while installed) refering to a template tag ?!

2009-12-06 Thread GoSantoni
Hi all, What does this mean? It doesn't make sense doesn't it? Line 25 isn't referring to the PIL... Thanks TemplateSyntaxError at /bookstore/ Caught an exception while rendering: decoder zip not available Request Method: GET Request URL:http://localhost:8000/bookstore/ Exception Type:

settings.TIME_ZONE

2009-12-06 Thread XtraGreen
I've changed settings.TIME_ZONE to 'UTC' and restarted my server but when I create records (postgresql) they're not UTC, they're 'America/ Chicago' (-6) in the table. Am I missing something or is settings.TIME_ZONE useless? -- You received this message because you are subscribed to the Google

Fwd: Redundant URL during tutorial - Missing attachement here

2009-12-06 Thread f hue
here is the missing attachement. -- Forwarded message -- From: f hue Date: 2009/12/7 Subject: Re: Redundant URL during tutorial To: django-users@googlegroups.com Yes your explanation makes sense to me. Now the only thing that bothers me is that it doesn't

Re: Redundant URL during tutorial

2009-12-06 Thread f hue
Yes your explanation makes sense to me. Now the only thing that bothers me is that it doesn't match with what the tutorial shows there : http://docs.djangoproject.com/en/dev/intro/tutorial02/#customize-the-admin-form-> pool only appears once I join a image with the result I have on my screen, I

How to create a form to edit an existing object without knowing the object's id?

2009-12-06 Thread Continuation
I have: class MyModel(models.Model): fk= models.ForeignKey(AnotherModel) field = models.PositiveIntegerField() class MyForm((forms.ModelForm): class Meta: model = MyModel Now I want to create a form to edit an existing MyModel instance.

Re: Redundant URL during tutorial

2009-12-06 Thread cootetom
Hello, The built in admin system for django names it's URL's by application name then model name. So if you have an application called "polls" and in that application you have a model called "poll" then the admin URL to edit those models would be admin/polls/poll amdin/polls will show all the

Re: FlatPages return 404 when attempting to edit.

2009-12-06 Thread TheLastBookworm
Correction: I meant fork and not "port". On Dec 6, 3:36 pm, TheLastBookworm wrote: > Hi, > > I'm getting a error when attempting to edit a flatpage. > > "Http404 at /admin/flatpages/flat/ > > App u'flatpages', model u'flat', not found. " > > This is the same error

FlatPages return 404 when attempting to edit.

2009-12-06 Thread TheLastBookworm
Hi, I'm getting a error when attempting to edit a flatpage. "Http404 at /admin/flatpages/flat/ App u'flatpages', model u'flat', not found. " This is the same error I get when I try to edit a non-existent flatpage. After some googling I discovered that site ID issues are a common cause of this

No module named il8n after following up all the recommendation on djangoproject.com

2009-12-06 Thread GoSantoni
Hey all, i am new to django and started using pinax. For now i am trying to set up il8n support using http://docs.djangoproject.com/en/dev/topics/i18n/?from=olddocs but it keeps on failing with a TemplateSyntaxError 'il8n' is not a valid tag library: Could not load template library from

Re: How to get the last item of array in a built-in template tag?

2009-12-06 Thread pjrhar...@gmail.com
Try: {{ my_array|slice:"-1:" }} Pete -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.

Re: Django: PYTHON_EGG_CACHE, access denied error

2009-12-06 Thread Sameer Rahmani
thanks for the advice my friend i never forget that -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: Django: PYTHON_EGG_CACHE, access denied error

2009-12-06 Thread Graham Dumpleton
On Dec 7, 8:47 am, Sameer Rahmani wrote: > it's very simple ( if you have root access to your host )  just create a > directory with the name : ".python-eggs" in ther "/" ( root directory ) and > change it owner to the apache user ( the user who run apache ). > ( if you

Re: Django: PYTHON_EGG_CACHE, access denied error

2009-12-06 Thread Sameer Rahmani
it's very simple ( if you have root access to your host ) just create a directory with the name : ".python-eggs" in ther "/" ( root directory ) and change it owner to the apache user ( the user who run apache ). ( if you don't have root access ) change you mod_wsgi or mod_python settings tu use

Redundant URL during tutorial

2009-12-06 Thread bigshift
Hello I'm just discovering Django and it was exactly the tool I was looking for. This is great ! Following the tutorial, I have an anomaly in my "pool" administration : the page that it supposed to be at http://localhost:8000/admin/polls/ is at http://localhost:8000/admin/polls/poll/ Maybe I

Re: Django: PYTHON_EGG_CACHE, access denied error

2009-12-06 Thread Graham Dumpleton
On Dec 6, 11:12 pm, Oleg Oltar wrote: > Hi! > > I am deploying my django application on a server, and on last stages I am > getting this error: > > ExtractionError at /admin/ > > Can't extract file(s) to egg cache > > The following error occurred while trying to extract

Re: sorl thumbnail: messed-up thumb file path

2009-12-06 Thread omat
It is not something to do with the upload_to path. I managed to track down the problem, I was passing the full url to the thumbnail templatetag (i.e. "provider.logo.url") but it should be just the relative URL (i.e. "provider.logo"). Thanks. -- omat On Dec 6, 9:10 pm, SmileyChris

Re: sorl thumbnail: messed-up thumb file path

2009-12-06 Thread SmileyChris
upload_to should not have a trailing slash On Dec 7, 5:16 am, omat wrote: > The model is as simple as can be: > > class Provider(models.Model): >     name = models.CharField(max_length=100) >     logo = models.ImageField(upload_to='logo/', >                              

Re: Where to store repetitive form logic?

2009-12-06 Thread jwpeddle
Sorry, the above post was meant to say I followed the idea that Heigler presented. On Dec 6, 1:56 pm, jwpeddle wrote: > I followed this type of thinking and have a result I'm happy with. I > have a view that accepts render_to_response args as well as an > additional forms

Re: Where to store repetitive form logic?

2009-12-06 Thread jwpeddle
I followed this type of thinking and have a result I'm happy with. I have a view that accepts render_to_response args as well as an additional forms dict. Rather than call render_to_response, I call my custom view, which looks for results from a number of forms, processes if required, then returns

Re: Parsing XML in the template? (New to Django and Python)

2009-12-06 Thread sleepjunk
Thanks so much for your help. I'm sorry to ask another question, but I am getting an error and have spent a few hours trying to figure it out. Googling has not helped me. Environment: Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.1.1 Python Version: 2.6.4 Installed

Re: Extending result count at bottom of admin pages

2009-12-06 Thread Kaze
You can override "changelist_view" function in admin.py for that model. Tryn googling "def changelist_view(self, request, extra_context=None, **kwargs):". On Dec 6, 7:26 pm, Count László de Almásy wrote: > I'm new to django but working hard to come up to speed. I need to make

Re: sorl thumbnail: messed-up thumb file path

2009-12-06 Thread omat
The model is as simple as can be: class Provider(models.Model): name = models.CharField(max_length=100) logo = models.ImageField(upload_to='logo/', blank=True, null=True) Thanks. -- omat On Dec 6, 4:45 pm, Kenneth Gonsalves wrote: >

Re: New to django, python, etc. - ForeignKey question

2009-12-06 Thread Guy
Thanks so much. I figured that the problem stemmed from working within the class rather than an instance, as you suggest. The suggestion to override the save fxn makes so much sense that I am now embarrassed for asking the question in the first place. It's amazing how much sense things make

Re: sorl thumbnail: messed-up thumb file path

2009-12-06 Thread Kenneth Gonsalves
On Sunday 06 Dec 2009 4:27:47 pm omat wrote: > Sorl thumbnail is creating invalid directories for thumbnails in my > development environment (mac os x, django dev server). > do not blame Sorl thumbnail - please post that part of your model that shows 'upload_to' setting. -- regards Kenneth

Re: What apps do besides provide views?

2009-12-06 Thread esatterwh...@wi.rr.com
@permalink maps a model to a view function through a specific url pattern giving you the ability to use get_absolute_url() just by passing parameters to the function. it will create the url for you. to the app question. An application or an organizational and way to focus your development. An

Re: Where to store repetitive form logic?

2009-12-06 Thread esatterwh...@wi.rr.com
You can use a hidden input in the for as a way of holding the link or id/ct of an object so you can determine where to redirect to. If the action is repetitive and you have a pretty good idea of where you to redirect to, I would think that is a simple solution. This is what django's comment app

Re: Unique model field and case sensitivity (postgres)

2009-12-06 Thread chefsmart
By the way, right now I'm using a State.objects.get(name__iexact=name) in clean_name() method in a form subclass to prevent creation of case- insensitive duplicates. Just wondering if there is a built-in or better way. On Dec 6, 2:57 pm, chefsmart wrote: > Reading

Django: PYTHON_EGG_CACHE, access denied error

2009-12-06 Thread Oleg Oltar
Hi! I am deploying my django application on a server, and on last stages I am getting this error: ExtractionError at /admin/ Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 13] Permission denied: '/.python-eggs'

sorl thumbnail: messed-up thumb file path

2009-12-06 Thread omat
Hi All, Sorl thumbnail is creating invalid directories for thumbnails in my development environment (mac os x, django dev server). In my local development settings: MEDIA_URL = "http://localhost:8000/; I use the "thumbnail" template filter and it generates crazy directories under my media root

Extending result count at bottom of admin pages

2009-12-06 Thread Count László de Almásy
I'm new to django but working hard to come up to speed. I need to make a small change to the admin interface, and am hoping i could get a pointer on how to do this. At the bottom of an admin page, the number of results is displayed in a summary, along with pagination buttons. For example, "1 [2]

Unique model field and case sensitivity (postgres)

2009-12-06 Thread chefsmart
Reading through some discussions on this mailing list and elsewhere, I saw a lot of material on mysql case sensitivity and collation. Consider the following situation: - Suppose my app allows users to create the states / provinces in their country. Just for clarity, we are considering only ASCII

Re: Pydev + Django + Ubuntu 9.10

2009-12-06 Thread turkan
Hello Liam, I am sorry ... I can't access your provided link. Even after registering there, it says "You are not authorized to view this workspace.". I am also not sure why you suggest me Posgresql/PostGIS. I don't have any problems with setting up the database, just with setting up Pydev/

Re: Initial values and unbound forms (apparently a bug?)

2009-12-06 Thread Manu
Hello, I would say that the behavior you have is normal. Quoting the doc "Using initial data with a formset: Initial data is what drives the main usability of a formset. As shown above you can define the number of extra forms. What this means is that you are telling the formset how many

Model as database views

2009-12-06 Thread goto
Hi, I am trying to make a django model that will show data from different other models as a single model. Kind of like a database view to a database table. My idea is to make a custom field that maps to another field in some other model code for fields.py is as follows

Re: Where to store repetitive form logic?

2009-12-06 Thread Manu
I got the same need and wrote up a FormView wich handles all the repetitive process of a form. In your case, you could build your view like this: http://dpaste.com/129827/ You will find basic example (and explanations) here: http://www.obviews.com/form/simplest/. Hope this helps, Manu -- You