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 re
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
--
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 additiona
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/
Eclipse
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
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] 7
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
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'
T
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 through some discussions on this
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 do
@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 app
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 Gons
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 when
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:
> On Sunday 06 Dec 200
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
> a small change to
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 App
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
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 dict. Rather than call r
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/',
> blank=True, null=True)
>
>
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 wrote:
> u
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 file(s) to the Python egg
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 made
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 on
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 don't have root access )
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
django-users+unsubscr...@googl
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.
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 django.tem
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
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 I get when I try to edit a non-e
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 mod
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. But
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 h
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 match with what the
tu
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 Gr
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: Templat
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,
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?
What is your server setup?
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/
> Django Version: 1.1
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()
> else:
> bug
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 table.
>
> > Am I missing something or is sett
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 could be overwriting
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, lang requirements to a separate
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 form
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 users
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 w
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 i
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):
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 += patterns('',(r'^site_media/(?P.*)$
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 wrote:
> Hello Liam,
>
How to use a permission.
./manage.py syncdb
then how to create a users permissions
--
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 t
2009/12/6 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
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. Af
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
53 matches
Mail list logo