I'm still looking into this if anyone has any insight.
On Oct 7, 2:04 pm, Streamweaver wrote:
> On our 500 error page I would like to display a message specifically
> if the error is in the Database connection, and not display the
> message on any other uncaught exception but I
On our 500 error page I would like to display a message specifically
if the error is in the Database connection, and not display the
message on any other uncaught exception but I can't seem to figure out
a way to catch the specific exception going to a 500 page.
Has anyone done this?
--
You rece
Argh!! Please ignore. This is not the message you're looking for.
context varibles are passed to generic views by default.
I got my errors confused.
On Aug 11, 2:59 pm, Streamweaver wrote:
> I use the the standard django login and logout views in the usual way
>
>
I use the the standard django login and logout views in the usual way
url(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'accounts/login.xhtml'}, "login-account"),
url(r'^logout/$', 'django.contrib.auth.views.logout',
{'template_name': 'accounts/logout.xhtml'}, "logout-a
South is working fine for me with Django 1.2 as well. What errors are
you getting?
There's a south discussion group that may be more productive for this
conversation though.
On Jun 1, 9:29 pm, flyinglegs wrote:
> I am having some trouble with South database migration using Fabric. I
> tried sev
elds that a model doesn't have (which could happen in
generic models).
It doesn't do well at ordering obviously.
I'm still struggling with this though and am not sure generic tagging
is the way I should be going with this. Still appreciate any insight
out there.
On May 24, 10:05 am, S
I'm trying to implement tagging using Content Types and Generic
Relationships.What I want to is query any tagged item with a
status of Published.
All my tagged models are implementing an Abstract Model class with a
status field so they share the 'Published' and 'Unpublished' types.
Here are s
I've found the native Python JSON library about the easiest to use out
there.
http://docs.python.org/library/json.html
On May 4, 10:34 am, zweb wrote:
> Is there a django or python equivalent of php json_encode?
>
> the data I am converting to json has text fields that have quotes,
> double quo
No insights? I'm still plugging away at it but it's not working for
some reason.
On Apr 18, 11:15 pm, Streamweaver wrote:
> I'm having trouble developing a feed decorator. I feel like the
> decorator I've come up with should work but isn't and I wanted to ask
I'm having trouble developing a feed decorator. I feel like the
decorator I've come up with should work but isn't and I wanted to ask
if someone can spot my error.
I have two view methods one that returns a normal HTML view and
another that returns an rss feed of the same data. They both take the
Thanks again. Just following up with my model to show how I'm
implementing based on the advice above.
Note I call my categories model Topics instead but you get the
picture.
class Topic(models.Model):
'''
Topics form sections and categories of posts to enable topical
based
conversati
Big thanks for the reply.
I already have a custom save method on the Catagory for slugs so it'll
be easy enough to create a path.
I may not understand the suggested implementation very well but it
sounds like I may not have to do a split at all if I store the
sluggified path then I think all I sh
I'm trying to setup a Django based blog for myself and I'd like to do
wordpress like nested catagories.
The model itself is fine and there are some good posts about how to do
such things around (i.e.
http://swixel.net/2009/01/01/django-nested-categories-blogging-like-wordpress-again/)
The thing
tickets in TicketHistory as they change.
Sorry to have floated this here.
On Feb 8, 5:22 pm, Streamweaver wrote:
> I have a model called 'Ticket' with several fields 'number',
> 'milestone', 'status', 'resolution', 'estimate',
I have a model called 'Ticket' with several fields 'number',
'milestone', 'status', 'resolution', 'estimate', 'last_updated'
These are just multiple entries for the same support ticket that I'm
pulling from another system. I keep multiple entries of a ticket so I
can trac changes in estimation an
] = True
class Meta:
model = Profile
class ProfileAdmin(admin.ModelAdmin):
form = ProfileAdminForm
fieldsets = [
(None, {'fields': ['user', 'gender', 'height',
'birthday']}),
('Calculated Values', {'fields
Is it possible to display calculated values for models in the admin
interface. I know about the list_display attribute for model.Admin
but all I really want to do is add text to a model edit form so I can
see calculated values.
For instance I have a model called Profile with a DateField called
bi
You could set this up as a custom manage.py command and run a cron on
that. Gives the advantage of both initiating from outside the app and
using Django's DB abstraction layer.
A very simple way to do this would be to put all month text names in
order in a tuple.
i.e. monthnames = ('jan', 'feb
I found a solution off of stack overflow. I had to bind an instance
to the form when editing. So I changed the following line:
form = ProjectForm(request.POST, instance=project)
It seems to work and is in testing.
On Oct 7, 5:40 pm, Streamweaver wrote:
> Some more information. The v
'action': reverse('update-project',
args=[slug]),
'button': 'Update Project',
'title': 'Editing Project'
})
On Oct 7, 5:24 pm, Streamweaver wrot
The title field in my model is set to unique and when I use a form to
edit this I get an error that an item with this value already exists.
As I understand it this is because ModelForm throws an error when I
call form.is_valid() and all information I can find tells me to
override the clean method
ct there are others who do as
well.
Thanks to Karen for her help and to my co-worker for his insight.
Hope this post is useful to someone in the future.
On Oct 2, 2:20 pm, Karen Tracey wrote:
> On Fri, Oct 2, 2009 at 11:01 AM, Streamweaver wrote:
>
>
>
>
>
> > I'm c
I'm continuing to struggle with the reverse method in Django. After
fixing some mistakes of mine earlier I'm getting an
ImproperlyConfigured Error whenever I try to use a reverse method.
The site works fine with one but whenever I try to use a reverse
method, even in shell I get the following err
is trying the regex here:
>
> url(r'^(?P\w+)/$', 'view_project', name="view-project"),
>
> I think you want (?P[\w\-]+). Whenever I'm unsure about a
> regex, I open up a shell "import re" and test it out.
>
> --
> Peter
>
> On Sep 23,
gt; url(r'^(?P\w+)/$', 'view_project', name="view-project"),
>
> I think you want (?P[\w\-]+). Whenever I'm unsure about a
> regex, I open up a shell "import re" and test it out.
>
> --
> Peter
>
> On Sep 23, 6:01 pm, Stream
I'm still having considerable problems with my reverse URLs and can't
find what I'm doing wrong. For reference I'm pasting in my
localsettings file (with some info scrubbed out), my root urls.py file
as well as an included urls.py file relevant to the error.
My problem is that I am getting vario
Yet more info here. This might be a particular problem due to the
particular method being called in multiple URL patterns so I tried
making it and calling a named URL pattern but am getting the same
message.
On Sep 9, 5:18 pm, Streamweaver wrote:
> Thanks for all the replies. I'm o
wealth of information about urls in django
> here:http://docs.djangoproject.com/en/dev/topics/http/urls/
>
> Once you get it working, you may find it more convenient to use named
> url
> patterns:http://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-pat...
>
> On Se
I'm having trouble understanding the output of the reverse method.
I have the following URL pattern:
urlpatterns = patterns('dwrangler.project.views',
(r'^in_development/$', 'summary_in_development'),
)
from the documentation I would think I can get the URL by using
reverse('dwrangler.proj
How do I change, what I think is called the "string representation" of
> the object within the Admin interface. Also, is there some sort of
> naming convention when creating models to get these fields
> automatically?
>
> On Fri, Sep 4, 2009 at 1:26 PM, Streamweaver wro
def label_from_instance(self, obj):
if obj.last_name or obj.first_name:
display = ", ".join((obj.last_name, obj.first_name))
else:
display = obj.username
return display
On Sep 4, 2:26 pm, Streamweaver wrote:
> I had a model that lists a
I had a model that lists an owner with a FK relationship to the Users
table.
When using model form the dropdown for the owner field defaults to the
username.
I'd like to override that to use a users name as the choice portion of
the dropdown sorted by users last name but I'm having trouble think
Sorry if I'm getting a little far out here.
I have two models, a parent and a child with a FK relationship (See
the code below for example) and I have a method in each called
is_owner. For the child it checks to see if a user passed is the
objects owner OR if that user passes the parents is_owne
Right. I think option A makes the most sense but I wanted to float
the question here.
I should probably pass the template something and rework this in my
views.
Thanks,
- Scott
On Aug 20, 12:28 pm, Javier Guerra wrote:
> On Thu, Aug 20, 2009 at 11:00 AM, Streamweaver wrote:
>
I'm having a bit of confusion as to how to best approach the display
of edit/delete/create links in my templates as my application needs
this to be based on group permissions OR cascading object owenership.
The situation is I have two models with a FK relationship and each has
a method to check i
I may have a similar post to this that was submitted accidentally as I
fat-fingered a key. Sorry about that.
I'm having a bit of confusion as to how to best approach the display
of edit/delete/create links in my templates as my application needs
this to be based on group permissions OR cascading
It works fine for me with Python 2.6 on Linux (with the errors
mentioned above) . Windows is a bit of a problem as the mysql-python
library doesn't yet support 2.6.
On Aug 17, 12:32 am, Continuation wrote:
> According to the site of the python MySQL driver it only supports
> Python 2.3 - 2.5:ht
Okay I am finnally getting my brain around this.
Thanks so much. I tried the code out and it works great, even on the
login.
I appreciate everyone's help and patience.
On Aug 8, 9:49 pm, Malcolm Tredinnick
wrote:
> On Sat, 2009-08-08 at 13:41 -0700, Streamweaver wrote:
> >
Let me clarify. This method handles the RequestContext obviously since
it's a login but what I mean is the SCRIPT_NAME variable isn't set for
the template and can't be read as far as I can tell.
On Aug 8, 4:15 pm, Streamweaver wrote:
> I appreciate all the comment here and I
est object isn't passed to urls.py
as far as I know.
If you have more insight it would be helpful but so far my
investigation seems to be turning up that I can't use these magic
methods.
Thanks again and I'll keep looking this weekend and post if I find
what I'm doing wrong
There's been some discussion here about what to do when you're trying
to run a Django site not under the root domain.
So for a site like http://mysite.com/django/
Django (or WSGI?) doesn't seem to be able to be able to handle the
SCRIPT_NAME ('/django' in this example) portion of the url well.
I came from the PHP world myself and am even doing some of it still
but I don't think what you're saying is of particular concern.
Even in PHP you have to worry about differences in PHP 4 and 5 and so
on so the concern itself isn't just a Python one. I can say that
support for Python 2.6 will be
I'm not really sure you can but I'm also not clear why this is a
problem. It would seem easy to just not use seconds and filter them
out in the template and views as needed. Is this practical for your
needs or is there a specific benefit you're seeking by filtering out
seconds from the field?
O
Simple Pagination in Django is great but I'm having some trouble with
the best way to design pagination with querysets derived from Search
Forms.
I'm currently using the Django-Pagination middleware and it works
great but there's really pretty bad documentation on it (as with many
projects) and I
ou are doing something wrong in your
> configuration.
>
> Stop trying to jump to solutions when hasn't even been determined what
> you are doing wrong.
>
> As suggested, post the mod_wsgi configuration you are using so can
> confirm that for starters, that that isn'
'This is causing all
> > my template links to break'. Ie., what errors are you getting, what
> > are the URLs it is generating and what they should be etc.
>
> > Graham
>
> > On Jul 31, 12:09 pm, Streamweaver wrote:
>
> > > I'm not actually
rce it to tell proper SCRIPT_NAME himself.
>
> > [1]:http://docs.djangoproject.com/en/dev/ref/settings/#force-script-name
>
> > ---
> > Alex Koshelev
>
> > On Thu, Jul 30, 2009 at 10:55 PM, Streamweaver
> > wrote:
>
> > > I have a django proje
I have a django project that has worked just fine in development but
I'm trying to move it to a demo site and the application is not on a
root domain or sub-domain.
Instead the site root URL is suppose to be something like
https://site.domain.com/appname/
This is causing all my template links to
On Jul 28, 5:25 pm, Streamweaver wrote:
> I have been struggling with this for a few weeks without resolution
> and hope someone can help me.
>
> I have a model that I edit via a form but the field returned for
> editing vary depending on the user permissions and group.
>
>
I have been struggling with this for a few weeks without resolution
and hope someone can help me.
I have a model that I edit via a form but the field returned for
editing vary depending on the user permissions and group.
When I bind a form to POST data some fields may or may not be included
in t
baseform,
'forms': forms,
'action': '%s/release/%s/edit/' %
(release.project_fk.id, release.id),
'button': 'Update Release',
'title': 'E
I have a model with a number of attributes (some included as example
below):
class Release(models.Model):
project_fk = models.ForeignKey(Project)
title = models.CharField(max_length=30)
summary = models.TextField()
owner = models.ForeignKey(User)
planning_status = models.CharF
Why do it inside the template? Do it inside the view and pass each
resultant queryset to the template.
On Jul 16, 1:59 am, ZebraShaSha wrote:
> This seems like a simple question, but it's been bugging me for days
> now. I have two models, Events and Categories, where Events has a FKF
> to Categ
"They" are apparently people who read the documentation and understand
better then "me".
Sigh, and I thought I uncovered somethign, ah well. Simple error and
thanks for clarifying.
On Jul 13, 11:13 pm, Russell Keith-Magee
wrote:
> On Tue, Jul 14, 2009 at 10:31 AM, Strea
Filed a bug report about this. We'll see if they accept it.
On Jul 10, 5:29 pm, Streamweaver wrote:
> I'm using Django 1.0.2 and having some problems with Related Object
> queries.
>
> For example I have a model called Project with a ForeignKey to a
> Djang
When using a ModelForm object to edit data is there any way to tell
Django to save only data included in the ModelForm object and keep
whatever was in the other fields in the model?
I find it a big barrier to have to explicitly define fields after
commit=False just so they don't get nulled out, i
I use netbeans and there is a UML plugin that you can download and use
for free.
On Jul 10, 10:43 pm, dartdog wrote:
> Starting to noodle out some system design stuff for Django
> implementation does anyone have good ideas suggestions for useful
> tools to encompass db (model) business logic an
I'm using Django 1.0.2 and having some problems with Related Object
queries.
For example I have a model called Project with a ForeignKey to a
Django User.
class Project(models.Model):
...
owner = models.ForeignKey(User)
...
by the documentation I would expect the following to give me a
I'm new to decorators but using them in their basic form fine in
Django so far.
My problem is this. I have two model edit forms, each has an owner
field that is a FK to a user.
I also have some groups with permissions to edit the models.
What I want to do is setup a 'is_owner_or_has_perm' deco
is just importing your custome one.
>
> Streamweaver ??:
>
>
>
> > I'm still struggling a bit with template contexts
>
> > What I want to do is put a code snippet in the header of my site base
> > template that either presents the user with a small login f
I'm still struggling a bit with template contexts
What I want to do is put a code snippet in the header of my site base
template that either presents the user with a small login form if they
aren't authenticated or display a "Welcome! user" where user is linked
to their profile.
It seems I have
sort().reverse() before.
Not sure I understand it still and attributing it to me missing
something in general but it's working now.
On Jun 15, 10:08 pm, Ramiro Morales wrote:
> On Mon, Jun 15, 2009 at 10:34 PM, Streamweaver wrote:
>
> > I ran into what I think might be a bug an
I ran into what I think might be a bug and wanted to check here before
possibly posting it.
Essentially what seems to be happening is that Django seems to return
datetime.datetime or datetime.date from DateFields in models and I
can't figure out why it returns one type at one time and another typ
leverage .extra(where=something) but not having much luck.
>
> On Jun 15, 2:36 pm, Streamweaver wrote:
>
> > If I understand your question right there is an example that covers
> > this exact situation that may help at
>
> >http://docs.djangoproject.com/en/dev/topics/
awesome. Thanks for that.
I put that in the comments in my code so if I ever get back to it
after an update I can streamline it a bit.
Thanks again.
On Jun 11, 10:44 am, Karen Tracey wrote:
> On Wed, Jun 10, 2009 at 3:24 PM, Streamweaver wrote:
>
>
>
>
>
> > Than
If I understand your question right there is an example that covers
this exact situation that may help at
http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships
I believe it could come out to something like this:
e = Entry.objects.filter(title__exact='foo')
blo
What I want to do is get the date of the last update across
relationships to figure out when the last update in an entire series
of related objects happened.
I'm pasting the relevant code of my models below but for example, I
want to be able to call a series_updated method on project that
returns
ing something about why I'm getting this error at all.
Thanks again for the reply.
On Jun 9, 2:43 pm, googletorp wrote:
> You can do
>
> Users.objects.exclude(project__owner__isnull=True,
> other__model__isnull=True).distinct()
>
> ~Jakob
>
I caught the OR lookups documentation and this seems to work.
u = User.objects.filter(project__owner__isnull=False).distinct() |
User.objects.filter(release__owner__isnull=False).distinct()
On Jun 9, 2:02 pm, mw wrote:
> Hello,
>
> I have a class full of common information such as email, name,
I have two models with Foreign Key relationships to Users and what I'm
looking to do is reterive a unique list of users from both Models.
class Project(models.Model):
owner = models.ForeignKey(User)
class Release(models.Model):
owner = models.ForeignKey(User)
I know I can retrieve a dis
I'll have to look harder at the documentation then as I'm a bit
confuesed.
What I thought was happening was that I would get a Project object (p)
by filtering.
I thought p.release_set returned a query set of Release filtered to
those related to that project and I could just continue to filter do
Cutting down the code sample I gave above in case that helps. Code
snippet below
Again, my problem is that if I call Release.objects.planning_backlog()
it works and I get all relavant Releases. If I call
Project.release_set.planning_backlog() I again get all Releases that
fit the filter instead
No insights at all in the group?
--~--~-~--~~~---~--~~
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 this group, send email to
You need to call form.save() after you validate the form.
As below:
def add(request):
if request.method == 'POST':
form = AddShow(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/shows/#success')
return HttpResponseRedire
I'm still struggling a bit with related managers. I have what I think
should work right by the documentation but behavior isn't as expect.
I've pasted the actual code below but the basic deal is this.
I have a Project model which has Releases so Releases have a FK field
for Projects. I want to
I'm pretty new to Django still and I know much is still escaping me.
In particular I'm having trouble still with how to query subsets of
related objects.
In this case I have two Models.
class Project(models.Model):
title = models.CharField(max_length=141)
...
class Release(models.Model)
76 matches
Mail list logo