Re: Add message on specific error to 500 page

2010-10-11 Thread Streamweaver
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

Add message on specific error to 500 page

2010-10-07 Thread Streamweaver
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

Re: Adding request context to standard login/logout views?

2010-08-11 Thread Streamweaver
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 > >  

Adding request context to standard login/logout views?

2010-08-11 Thread Streamweaver
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

Re: Django 1.2.1 doesn't work with South but 1.2 works? How to find the previous version Django 1.2?

2010-06-02 Thread Streamweaver
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

Re: Content Types and Filtering Generic Relationships

2010-05-28 Thread Streamweaver
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

Content Types and Filtering Generic Relationships

2010-05-24 Thread Streamweaver
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

Re: Equivalent of php json_encode?

2010-05-04 Thread Streamweaver
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

Re: feed decorator

2010-04-20 Thread Streamweaver
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

feed decorator

2010-04-18 Thread Streamweaver
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

Re: URL Patterns for Nested Catagories.

2010-04-07 Thread Streamweaver
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

Re: URL Patterns for Nested Catagories.

2010-04-07 Thread Streamweaver
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

URL Patterns for Nested Catagories.

2010-04-07 Thread Streamweaver
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

Re: Grouping and returning latest of each group?

2010-02-08 Thread Streamweaver
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', &#

Grouping and returning latest of each group?

2010-02-08 Thread Streamweaver
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

Re: Displaying Calculated Values in Django Admin

2009-12-17 Thread Streamweaver
] = True class Meta: model = Profile class ProfileAdmin(admin.ModelAdmin): form = ProfileAdminForm fieldsets = [ (None, {'fields': ['user', 'gender', 'height', 'birthday']}), ('Calculated Values', {'fields

Displaying Calculated Values in Django Admin

2009-12-16 Thread Streamweaver
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

Re: efficiently deleting content based on how old it is

2009-10-08 Thread Streamweaver
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

Re: Unique Fields and form submission validation

2009-10-07 Thread Streamweaver
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

Re: Unique Fields and form submission validation

2009-10-07 Thread Streamweaver
'action': reverse('update-project', args=[slug]), 'button': 'Update Project', 'title': 'Editing Project' }) On Oct 7, 5:24 pm, Streamweaver wrot

Unique Fields and form submission validation

2009-10-07 Thread Streamweaver
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

Re: More Reverse Method Woes

2009-10-05 Thread Streamweaver
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

More Reverse Method Woes

2009-10-02 Thread Streamweaver
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

Re: Reverse Method Not finding URLs

2009-09-24 Thread Streamweaver
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,

Re: Reverse Method Not finding URLs

2009-09-23 Thread Streamweaver
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

Reverse Method Not finding URLs

2009-09-23 Thread Streamweaver
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

Re: Having Trouble with Reverse method

2009-09-09 Thread Streamweaver
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

Re: Having Trouble with Reverse method

2009-09-09 Thread Streamweaver
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

Having Trouble with Reverse method

2009-09-08 Thread Streamweaver
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

Re: Users Full Name in model form?

2009-09-07 Thread Streamweaver
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

Re: Users Full Name in model form?

2009-09-04 Thread Streamweaver
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

Users Full Name in model form?

2009-09-04 Thread Streamweaver
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

Related ownership for items that dont' exist yet?

2009-08-27 Thread Streamweaver
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

Re: displaying links based on permissions and object ownership

2009-08-20 Thread Streamweaver
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: >

displaying links based on permissions and object ownership

2009-08-20 Thread Streamweaver
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

displaying links based on permissions and object ownership

2009-08-20 Thread Streamweaver
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

Re: Possible to use Django & MySQL with Python 2.6?

2009-08-17 Thread Streamweaver
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

Re: Continuing problems running Django when not site Root.

2009-08-08 Thread Streamweaver
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: > >

Re: Continuing problems running Django when not site Root.

2009-08-08 Thread Streamweaver
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

Re: Continuing problems running Django when not site Root.

2009-08-08 Thread Streamweaver
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

Continuing problems running Django when not site Root.

2009-08-07 Thread Streamweaver
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.

Re: Django/ Python 3 - nervous about starting large project

2009-08-06 Thread Streamweaver
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

Re: Django TimeField Model without seconds

2009-08-06 Thread Streamweaver
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

django-pagination with search form

2009-08-06 Thread Streamweaver
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

Re: Template links when Django not domain root

2009-08-02 Thread Streamweaver
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'

Re: Template links when Django not domain root

2009-08-01 Thread Streamweaver
'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

Re: Template links when Django not domain root

2009-07-30 Thread Streamweaver
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

Template links when Django not domain root

2009-07-30 Thread Streamweaver
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

Re: ModelForm and saving with excluded Fields

2009-07-28 Thread Streamweaver
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. > >

ModelForm and saving with excluded Fields

2009-07-28 Thread Streamweaver
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

Re: Handling Varying Number of Fields in Model Form

2009-07-16 Thread Streamweaver
baseform, 'forms': forms, 'action': '%s/release/%s/edit/' % (release.project_fk.id, release.id), 'button': 'Update Release', 'title': 'E

Handling Varying Number of Fields in Model Form

2009-07-16 Thread Streamweaver
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

Re: Separate QuerySet into different lists inside templates

2009-07-16 Thread Streamweaver
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

Re: Queries for Related Objects wonky

2009-07-13 Thread Streamweaver
"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

Re: Queries for Related Objects wonky

2009-07-13 Thread Streamweaver
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

Saving with unchanged value by default in ModelForm

2009-07-11 Thread Streamweaver
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

Re: Design Tools any suggestions?

2009-07-10 Thread Streamweaver
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

Queries for Related Objects wonky

2009-07-10 Thread Streamweaver
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

user passes test or is owner

2009-07-05 Thread Streamweaver
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

Re: Easy way to include Request Context always?

2009-07-05 Thread Streamweaver
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

Easy way to include Request Context always?

2009-07-04 Thread 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 form if they aren't authenticated or display a "Welcome! user" where user is linked to their profile. It seems I have

Re: Sometimes datetime sometimes date?

2009-06-15 Thread Streamweaver
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

Sometimes datetime sometimes date?

2009-06-15 Thread Streamweaver
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

Re: Query Help: "Get Blogs where last Entry.title='foo'"

2009-06-15 Thread Streamweaver
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/

Re: Getting a distinct list of Users from two related Models

2009-06-15 Thread Streamweaver
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

Re: Query Help: "Get Blogs where last Entry.title='foo'"

2009-06-15 Thread Streamweaver
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

Date of last update across Relationships

2009-06-15 Thread Streamweaver
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

Re: Getting a distinct list of Users from two related Models

2009-06-10 Thread Streamweaver
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 >

Re: Model gets subset of fields from inheritance, but then admin.py can't find the inherited fields.

2009-06-09 Thread Streamweaver
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,

Getting a distinct list of Users from two related Models

2009-06-09 Thread Streamweaver
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

Re: Related Managers and use_for_related_fields strangeness

2009-06-06 Thread Streamweaver
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

Re: Related Managers and use_for_related_fields strangeness

2009-06-06 Thread Streamweaver
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

Re: Related Managers and use_for_related_fields strangeness

2009-06-06 Thread Streamweaver
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

Re: Noobie question about getting form data to save to the database

2009-06-04 Thread Streamweaver
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

Related Managers and use_for_related_fields strangeness

2009-06-04 Thread Streamweaver
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

Managers to aggregate child object values?

2009-06-02 Thread Streamweaver
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)