Select Date Time Widget

2008-11-18 Thread brad

Hi All,

I've written a SelectTimeWidget that functions very similarly to the
SelectDateWidget in django.forms.extras.widgets.  Now, I'd like to
write a SelectDateTimeWidget that contains select elements for date,
month year (which are in SelectDateWidget) and  hour, minute, second
(which are in SelectTimeWidget).

Any suggestions on the best way to "combine" these two classes in a
robust, maintainable way?

My SelectTimeWidget is located here:
http://www.djangosnippets.org/snippets/1202/

Thanks!
Brad

PS: please ignore my horrible regex. its inefficiency was kindly
pointed out to me on IRC (thx again Magus) :)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Select Date Time Widget

2008-11-19 Thread brad

In case anyone runs across this, I've figure out A solution to this
problem.  There's a class in django.forms.widgets called MultiWidget
that allows creating a widget that is composed of multiple other
widgets.  So, I've copied what was done with
django.forms.widgets.SplitDateTimeWidget, and created a class which
I've called SplitSelectDateTimeWidget.

More information (and links to code) can be found here:
http://bradmontgomery.blogspot.com/2008/11/extending-djangos-multiwidget.html

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Do you recommend "Practical Django Projects"?

2009-01-05 Thread brad


On Jan 5, 2:21 am, HB  wrote:
> Do you recommend "Practical Django Projects" instead?

I got this book as soon as it came out, and very soon after Django hit
1.0.  It's a good book, and I learned a few "big picture" ideas from
the sample apps, but I really had to read the docs to figure out how
to do the specifics.

If you're looking for the "big picture", grab it from a library or
borrow it from a friend.. otherwise, wait for the next edition or just
read the docs (which are very excellent, btw).

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANNOUNCE: Django 1.0 released

2008-09-04 Thread brad

W00t!  :)

(i've been patiently waiting :))
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Need suggestions on subversion structure for project

2008-09-05 Thread brad


> anyway, putting settings.py under version control is tantamount to  
> suicide, so all you need to do is change your settings.py on each  
> installation

Until just recently, I've only been developing a project (I haven't
had anything in production), and my subversion repo looks like this:

|-django_working_dir
|--media
|--myproject
|---app1
|---app2
|--templates
|---app1_templates
|---app2_templates


Now that I'm trying to put this into production (Apache+mod_python), I
created a symlink to my media directory (/var/www/site_media -> /path/
to/django_working_dir/media).  I've also run into the problem of
keeping my settings.py under version control, so I just created
multiple settings files for the various servers on which my apps would
run, so I've got:

settings.py
settings_server1.py
settings_server2.py
settings_dev.py

I know this violates DRY to some degree, but it's fairly easy to just
copy the appropriate settings file over to settings.py whenever I
deploy the app.  In my settings files, I just use /path/to/
django_working_dir/templates (since all of my various app templates
are under one directory).


I'm open to suggestions on better ways to handle this.

brad


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Soliciting Feedback on SelectTimeWidget

2008-09-29 Thread brad

Hi All,

I've started working on a SelectTimeWidget that is very similar to the
SelectDateWidget in django.forms.extras.

http://dpaste.com/hold/81196/

This is my first look at Django's internals, so any (constructive)
criticism is welcome!

Brad
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ifequal and DateQuerySet objects

2009-02-03 Thread brad

On Feb 2, 6:37 pm, Bret W  wrote:
> I've run into a problem with ifequal in one of my templates.
>
> I'm using date-based generic view to display all objects for a given
> year.
> urls.py:
> (r'^taken/(?P\d{4})/$' ...
>
> Part of the extra_context I pass is a DateQuerySet object:
> months = Photo.objects.dates('date_taken', 'month', order='DESC')
>
> In my template, I have the following:
> {% for month in months %}
> {% ifequal year month.year %}
> ...
>
> It always evaluates to false.
>
> I know this is because Python won't handle the casting:
>
>
>
> >>> from datetime import datetime
> >>> now = datetime.now()
> >>> now.year == 2009
> True
> >>> now.year == "2009"
> False
>
> So, is it possible to handle this comparison in the template?


You could use the built-in __str__ method on now.year.
In [11]: now.year.__str__()
Out[11]: '2009'

In [12]: now.year.__str__() == '2009'
Out[12]: True

In your template you'd do something like this:
{% ifequal year month.year.__str__ %}


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: A Very Puzzling MySQL Issue Performance...

2009-02-06 Thread brad

> You may have query caching turned on.
>
> http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/

Also here (for mysql 5.0):
http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CMS on Google Appengine

2009-03-04 Thread brad

On Mar 4, 9:51 am, poematrix  wrote:
> Is it possible to utilize the Django CMS on Google Appengine?

I've just starting looking into Google's App Engine as a possible
place to deploy a Django Project.  I can't answer your question
directly, but there are a couple of articles that might help you:

Running Django on Google App Engine
http://code.google.com/appengine/articles/django.html

Using Django 1.0 on App Engine with Zipimport
http://code.google.com/appengine/articles/django10_zipimport.html

There are probably more articles concerning this at the AppEngine
site:
http://code.google.com/appengine/articles/
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sort of OT on the django book

2009-03-19 Thread brad



On Mar 19, 2:03 am, James Bennett  wrote:
> Well, what's not welcome is being asked the same question over and
> over again when the publication date's listed on the Amazon page for
> anyone and everyone to look at ;)


Which just happens to be June 1, 2009.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django book mostly done?

2009-03-24 Thread brad



On Mar 23, 8:15 pm, Malcolm Tredinnick 
wrote:
> On Mon, 2009-03-23 at 15:08 -0700, Graham Dumpleton wrote:
>
> [...]
>
> > More of a concern is that mod_python is still regarded as the most
> > robust production setup. I can't see that mod_wsgi is even mentioned
> > at all.
>
> Here's a wild thought from out of left field: have you thought of
> contacting the author of said book and mentioning it to him? Adrian (the
> author) doesn't read this group, so this approach isn't going to work.
>
> Malcolm

There's actually this cool commenting system for the Django Book's
website.
You could leave comments there (and in fact, this very comment has
already been posted)
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: TemplateDoesNotExist at /admin/ on Linux (Xubuntu) while doing Django Tutorial 2

2009-03-24 Thread brad



On Mar 2, 10:14 am, Karen Tracey  wrote:
> On Sun, Mar 1, 2009 at 10:56 PM, Chris Verehhotti <
>
> chris.peresso...@gmail.com> wrote:
>
> > > however, in my Thunar file viewer, every icon has a little "X" on it
> > > -- this makes me think it's a permissions issue, but I'm a Linux n00b
> > > and am not sure how to go about fixing this.  Do I need to do some
> > > kind of recursive chmod on the entire django tree in site-packages?
>
> > So.  Probably was a stupid question, and I pretty much had my
> > answer... looked a *nix tutorial about chmod, realized that every file
> > in that django site-package was 700.  I performed chmod -R 755 on the
> > whole thing and it works.
>
> How did you install Django?  It should not have been necessary to fix up the
> permissions after install, and it's not something I can remember hearing
> from anyone else, so whatever install method you used seems to have been a
> bit unusual and somewhat broken
>
> Karen


I've just installed Django-1.0.2-final on a Red Hat Linux system, and
I've also run into this problem (TemplateDoesNotExist at /admin/).
I installed django the using "python setup.py install", and all of the
admin templates (located in /usr/local/lib/python2.6/site-packages/
django/contrib/admin/templates/admin) had rw permissions for the user
and r for the group, but no permissions for others.

I'm not sure, but one possible cause of this may relate to the umask
of the user who unpacks the original Django source code (My umask is
0007).  When Django is installed, does it preserve some file
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-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



File Storage Suggestions

2009-09-08 Thread brad

I currently have a django site running on a single machine (web server
+ database + file storage).  This site contains many multimedia files
(audio, video, documents) that are uploaded and retrieved by end-
users.

We've reached the point where we need to push the multimedia storage
off of this server, and I'm looking for suggestions on ways to do
this.  We're considering purchasing another machine or pushing our
files out to something like S3.

I've also run across django-storages, so I'm intrigued by the
solutions that it supports as well.

I'd just like to get feedback on what other people are doing before
jumping in too deep.

Thanks!




--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Best way to store arbitrary key:value pairs?

2009-09-19 Thread brad


> I have an arbitrary set of key:value pairs I'd like to store in a
> database.  

It's my uderstanding that this is exactly the scenario for which
CouchDB was created. There's django-storages that let's you interface
with couchdb.

I haven't personally used either, so I can just speculate. Good luck!
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread brad

> The document says we can get a tinymce editor in the admin site after
> this. But nothing different shows with mine.

Just to clarify, are you trying to get tinymce displaying in your
django admin?  If so, you have to tell the admin for your BlogPost
model to use the BlogForm.  So do you have an admin.py with something
like the following?

class BlogPostAdmin(ModelAdmin):
form = BlogForm


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosts

2009-09-24 Thread brad

+1 Linode. They've got great management tools. I've enjoyed their
service.

On Sep 24, 12:28 am, Kenneth Gonsalves  wrote:
> On Thursday 24 Sep 2009 7:24:25 am neri...@gmail.com wrote:
>
> > I think I'm ready to finally switch to a django vps host due to
> > problems with django on DreamHost. Can anyone recommend a good vps
> > host?
>
> slicehost
> gandi.net
> linode
> --
> regards
> kghttp://lawgon.livejournal.com
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Module ho.pis can not be found when running on apache

2009-11-24 Thread brad


On Nov 24, 1:43 pm, "philip.bar...@impaerospace.com"
 wrote:
> When I try running my project via Apache I get a "No module named
> ho.pisa" error message.
>
> However, when I run the same project from django's built-in dev
> server, it works just fine.
>

Well, this sounds very similar to a problem I'm having (but with
cx_Oracle, rather than ho.pisa).  Are you using virtualenv?

I've described by problem here:
http://bradmontgomery.blogspot.com/2009/11/gahhh-django-virtualenv-and-cxoracle.html

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Moved server, can't log in

2009-12-10 Thread brad


On Dec 10, 4:57 am, Oli Warner  wrote:
> A couple of days ago I moved a site from one server to another server and
> changed the DNS on the domain so it stayed the same. After the DNS had
> migrated everybody but me could log in. All other users trying to log into
> the admin were getting the "Looks like your browser isn't configured to
> accept cookies [...]" error. There's also a log in page for non-admins and
> that was also just refusing to log people in.
>
> The only way I could fix it was to set the server to redirect the users
> through to a different subdomain. I would like to go back to the original
> domain but I can't if it breaks (this is a business-to-business webapp - it
> can't have downtime).
>
> I've also got to move a couple more sites in the coming days but I can't
> until I can figure out what happened here so I can prevent this happening
> again in the future.
>
> I need ideas... Ideally more advanced than "clear the cookies" as there are
> a couple of hundred users on the system - this is vastly impractical.
>
> Thanks in advance.
>
> This question is also on stackoverflow (if you're a user and you think you
> have the answer, you can get some 
> points):http://stackoverflow.com/questions/1872796/changed-django-server-loca...

Are you using Django's session framework? If so, it stores session
info in the database, which you might want to clear.

See:
django-admin.py help cleanup

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Hosting for django?

2009-12-22 Thread brad
> Has anyone had good experiences with hosting companies that I can use
> for production django apps, with backups, etc.?

If you're comfortable administering a linux box, I'd highly suggest
Linode (http://www.linode.com/).  Their service has been great for me.

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Display first name and last name for user in dropdown lists in the Admin

2010-04-22 Thread brad
This thread has prompted me to blog about my solution to this
problem.  Here's how I've done this:

1) I created a UserModelChoiceField(ModelChoiceField) class whose
label_from_instance method returns a string containing the User's full
name (and username in parenthesis)
2) Create a ModelForm for the Model containing the FK to User. In this
form, use the UserModelChoiceField to override the FK attribute.
3) In the ModelAdmin class, set a form attribute that points to the
above ModelForm.

More detail (and some samples) are available here:
http://bradmontgomery.blogspot.com/2010/04/pretty-options-for-djangos-authuser.html

There's probably a simpler way, but I've been using this method for
about a year in some production code.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Updating a video rating using AJAX

2010-10-20 Thread brad

> I would like to do this without using a view or doing a form POST or GET of
> any kind. Any pointers?

Why?  If you're building a web app, you should use HTTP to for the
client to communicate with the app (AJAX is just another form of that
communication).

You're almost there, though, because your function is pretty close to
a view:

def save_rating(request, video_id, rating):
if request.is_ajax():
# the rest of your code...

json_content = '{"rating":"%s"}' % video.rating
return HttpResponse(json_content, mimetype='application/json')

Just be sure to return some sort of data that your client-side
javascript can interpret, such as JSON (of which I've given you an
untested example).

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Updating a video rating using AJAX

2010-10-20 Thread brad
Also, if you DO choose to pass JSON back to your client, you should
serialize it first.  See this:

http://docs.djangoproject.com/en/dev/topics/serialization/

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and ldap

2010-02-03 Thread brad
> i need to authenticate users through ldap but i need also to store their
> preferences in the database, i cant really understand if

> what is the best way to go?

One thing you might consider doing is just write a custom backend:
(http://docs.djangoproject.com/en/1.1/ref/authbackends/#ref-
authentication-backends).

I have a project where user's authenticate agains Active Directory.
If the authentication is successful, the backend checks to see if an
corresponding User (from django.contrib.auth) exists.  If not, it
pulls the their full name, username, and email from Active Directory
and creates the User object.

The pitfall to this approach is that if their info changes in AD, the
corresponding User data is out-of-sync.

This approach works well for me, but YMMV.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and ldap

2010-02-04 Thread brad
On Feb 4, 2:33 am, andreas schmid  wrote:
> @brad: can you show me some sample code for this?

the code that I have is all very specific to  where I work.  I'd have
to clean it up a bit to try to make it useful to you.

There's also several other people who have posted snippets for
backends based on LDAP or Active Directory:
http://www.djangosnippets.org/tags/ldap/

A few of these are very similar to what I've done. I'd suggest taking
it look.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



1.1.2

2010-03-10 Thread brad
Hi all

When can we expect a release of 1.1.2? Specifically I'm hoping to get
a test bug fixed - http://code.djangoproject.com/ticket/12720


Thanks
Brad

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 1.1.2

2010-03-10 Thread brad
Thanks both. We'll use the 1.1 branch head then



On Mar 11, 4:22 pm, James Bennett  wrote:
> On Wed, Mar 10, 2010 at 9:16 PM, brad  wrote:
> > When can we expect a release of 1.1.2? Specifically I'm hoping to get
> > a test bug fixed -http://code.djangoproject.com/ticket/12720
>
> Barring unforeseen circumstances, a 1.1.2 release will probably
> accompany the release of Django 1.2.
>
> In the meantime, it's quite possible -- and at my day job we do this
> with no ill effects -- to simply run off the head of the 1.1.X release
> branch, periodically updating as needed. Since the release branches
> *only* receive bugfixes and security updates, this is usually an easy
> way to get fixes without waiting for point releases to be issued out
> of it.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



NewForms Question..

2007-04-10 Thread brad

Hello, I am using NewForms with my current Django project, but I am
stumped on one error message. Here's the error message: Cannot resolve
keyword 'organization' into field. I am assuming that there is
something wrong in my forms.py file in the application folder. Here's
what I have in forms.py, and thank you for taking the time to read
this post:

from django.contrib.auth.models import User
from models import Organization, UserProfile, Game
from django import newforms as forms
from django.newforms import widgets

class Register(forms.Form):
username = forms.CharField(max_length=40)
email = forms.EmailField()
password1 = forms.CharField(max_length=40)
password2 = forms.CharField(max_length=40)
organization = forms.CharField(max_length=40)


def clean_username(self):
"""
Validates that the username is not already in use.

"""
try:
user =
User.objects.get(username__exact=self.clean_data['username'])
except User.DoesNotExist:
return self.clean_data['username']
raise forms.ValidationError(u'The username "%s" is already
taken. Please pick a different
  username.' %
self.clean_data['username'])



def clean_email(self):
"""
Validates that the email is not already in use.

"""
try:
email =
User.objects.get(email__exact=self.clean_data['email'])
except User.DoesNotExist:
return self.clean_data['email']
raise forms.ValidationError(u'The email "%s" is already taken.
Please pick a different
  email.' %
self.clean_data['email'])


def clean_password2(self):
"""
Validates that the two password inputs match.

"""
if(self.clean_data.get('password1') !=
self.clean_data.get('password2')):
raise forms.ValidationError(u'The password does not match
above')
return self.clean_data['password2']


def clean_organization(self):
"""
Validates that the organization exists.

"""
try:
organization
=Organization.objects.get(organization__exact=
 
self.clean_data['organization'])
except Organization.DoesNotExist:
return self.clean_data['organization']
raise forms.ValidationError(u'The organization "%s" does not
exist. Please pick one that
 does exist.' %
self.clean_data['organization'])


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NewForms Question..

2007-04-11 Thread brad

You are exactly right. Thanks for your time and help.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Template For Loops

2006-09-25 Thread brad

Hello. I am having a little trouble retreiving data from my models so
that I can use the data in my templates to create a html select. The
template creates the html select, but the select is not populated with
any options, like I want it to. Thanks in advanced for any and all
ideas to get this template to work. Here's my model:

class Game(models.Model):
game_name = models.CharField(maxlength=200)

class Admin:
pass

def __str__(self):
return self.game_name


And here's part of my template:



{% for name in game_name %}
{{ name }}
 {% endfor %}




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Template For Loops

2006-09-25 Thread brad

Now I am getting an error of:

Exception Type: TypeError
Exception Value:'tuple' object is not callable
Exception Location: E:\dp1\mysite\..\mysite\urls.py in ?, line 10

And line ten of 'urls.py' is the following:

(r'^select/$', 'mysite.polls.views.select')


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



urls.py error

2006-09-25 Thread brad

Hello. I have recently received help on a related post that can be
found here:
http://groups.google.com/group/django-users/browse_thread/thread/272b01561e0eb43d

But, I am getting an error now when I try to access my templates.
Here's the error & thanks for all of the help that I may receive.
Thanks you. The error:

Exception Type: TypeError
Exception Value:'tuple' object is not callable
Exception Location: E:\dp1\mysite\..\mysite\urls.py in ?, line 10

And line ten of 'urls.py' is the following:

(r'^select/$', 'mysite.polls.views.select')


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: urls.py error

2006-09-25 Thread brad

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.apps.foo.urls.foo')),
(r'^polls/$', 'mysite.polls.views.select'),
(r'^polls/(?P\d+)/$', 'mysite.polls.views.detail'),
(r'^polls/(?P\d+)/results/$',
'mysite.polls.views.results'),
(r'^polls/(?P\d+)/vote/$', 'mysite.polls.views.vote'),
(r'^select/$', 'mysite.polls.views.select')

# Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')),
)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: urls.py error

2006-09-25 Thread brad

Opps. I posted before I treid all that I could try. I found my error
thanks to you help Don Arbow  and everybody's help on my last post.
Thanks you all.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: urls.py error

2006-09-25 Thread brad

Thanks Shaun Li. I just figured that out, but thank you because I very
well could have still been stumped until you posted.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Lost in the flow

2006-09-26 Thread brad

 Hello. I have been reading through as much of the AJAX  topics and
AJAX tutorials surround Django as I have had time for, but I am lost in
the flow of things. First some background information, I have three
dynamic & dependent selects (dropdown lists). The options for the
selects are populated from a database. The second select gets populated
once an option from the first select has been chosen, and the third
select gets populated once an option from the third select has been
chosen. Dynamic and dependent selects. I do not understand what happens
behind the scenes from the time a visitor selects an option from the
first dropdown list to the time the second drop down list gets
populated with its relevent options.
 Here's my idea or at least the little bit that I can put together
so far: The first select has an onclick="CALL_SOME_FUNCTION" that kicks
off the process of retreiving the second select's data and make the
changes using DOM manipulation. Now I get lost though. How does the
view.py come into place and everything else (models.py, urls.py, etc)?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



A view that looks up a model field

2006-10-01 Thread brad

Hello. I am trying to build a view to lookup a model field and return
an array based on the data sent to the view. The goal is to send the
contents of the "value" tag in an html select statement( i.e. in
OPTION to send the SOME_VALUE part)
to a Django view with a Dojo request call, have the Django view build
an array based on SOME_VALUE, and ultimately send the array back
through "return HttpResponse(array). So far I understand how to send
the contents of the "value" tag and how to send the array back through
the "return" statement. However, I do not know how to build the array.
Belowe I posted a segment of my "models.py", and in it you can see that
I will want to populate the array with valus from the model field
"name" in the class Game. I want to use SOME_VALUE to filter out the
rows in the field "name" that have name.id == SOME_VALUE. Any thoughts
on how I may accomplish this? Thank you in advanced for any help that I
may receive. Here's what I have so far:

#
select.html
#


 title 



dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Button");
dojo.require("dojo.json");

function helloPressed(x)
{
 dojo.io.bind({
   url: '1/',
   handler: helloCallback,
   method: 'post',
   content: x
   });
}

function helloCallback(type, data, evt)
{
  if (type == 'error')
alert('Error when retrieving data from the server!');
  else
alert(data);
}






 Pick One
{% for game in games %}
{{ game.name }}
{% endfor %}






#
models.py
#
class Game(models.Model):
name = models.CharField(maxlength=200)

class Admin:
pass

def __str__(self):
return self.name

###
views.py
###
def select(request):
data = "If statement not evaluated"

if request.POST:
data = "POST request received"

data = unicode( data, "utf-8")
json = simplejson.dumps(data)
return HttpResponse(json)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: A view that looks up a model field

2006-10-01 Thread brad

I think that I need to modify models.py to fit the scheme I thought
that I had. The following is a table representation of what I thought I
had with my current models.py:

Table: Game

id game
==   
0 0_Option1
1 1_Option1
1 1_Option2
1 1_Option3
2 2_Option1
2 2_Option2
3 3_Option1
4 4_Option1
4 4_Option2


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: A view that looks up a model field

2006-10-01 Thread brad

Alright I got my model problem corrected. I needed to use the
ForgeinKey() statement, so if there are any self-confusing newbies who
are having this problem refer to: The url Matthew Flanagan provided to
us in one of the replies above, and Tutorial 1 in the Django
documentation ((( http://www.djangoproject.com/documentation/tutorial1/
))). Thank you for your help Matthew Flanagan and Malcolm Tredinnick.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



QuerySet help

2006-10-24 Thread brad

Below is part of my models.py file and I am having trouble getting a
queryset that includes all of the information that I need it to
include. When I am in  "manage.py shell", I import the model Data and I
execute Data.objects.all(), what is returned to me are all of the
prices in the database table.  This won't work for me though becasue in
my view I will need to get the price,company, and url for any given
value for quantity. For example, if the user selects the quantity who's
id has a value of 25, then I want to search the database for every row
who's quantity field == 25 and return the rows, which should include a
price, a company, and a url. Any ideas as to how I can accomplish this?
Thanks in advanced for any and all help that I may receive. Thank you.


class Quantity(models.Model):
name = models.CharField(maxlength=200)
server = models.ForeignKey(Server)

class Admin:
pass

def __str__(self):
return self.name

class Data(models.Model):
price = models.CharField(maxlength=50)
company = models.CharField(maxlength=200)
url = models.CharField(maxlength=500)
quantity = models.ForeignKey(Quantity)

class Admin:
pass

def __str__(self):
return self.price


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: QuerySet help

2006-10-24 Thread brad

Great! Thank you both for taking the time to reply and giving acurate
advice. I appreciate it.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Is Django the right tool?

2006-08-31 Thread brad

Hello. I am wondering right now whether Django will help speed up my
project and help me  or whether Django isn't the best tool in this
situation. My project involves a web application that grabs thousands
of prices, quantities and product names from a handful of predefined
sites. The application runs hourly, therefore the database is updated
hourly. Now the webpage that users can access the database from is
composed of four Ajax drop down menus and one Ajax table--the table
contains the prices, links, product name, etc. I am very knew to
Django, so I am not sure whether it will be an asset for my project, or
will installing Django mean that I am installing a lot of dead weight
into my project. For example, I know that Django is very good when it
comes to news web sites or for sites that depend on its users' input.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Is Django the right tool?

2006-08-31 Thread brad

Thanks for the input Bryan and Adrian. I have to agree and say that
Django could be an asset to this project. Bryan or anyone else could
you name a few useful packages that will help me scrape the prices from
the list of websites that I have? Thanks in advanced for any future
help I get. Thank you.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Creating a project

2006-09-10 Thread brad

On Django's documentation website there is an article titled "Writing
your first Django app, part 1", which has the URL of
http://www.djangoproject.com/documentation/tutorial1/, there is a
paragraph that says to start a new project we should run the command
"django-admin.py startproject mysite" from the command prompt--I run
windows, so I go to start-->run-->cmd.However, when I try to run the
command "django-admin.py startproject mysite" on the windows command
prompt I get the following error:

 'django-admin.py' is not recognized as an internal or external
command, operable
  program or batch file.

Should I instead use the Python (command line)? If I use the python
command line then how do I "cd" into different dirrectories? Thanks in
advanced for any and all help that I receive. Thank you.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Creating a project

2006-09-10 Thread brad

Great thanks. When I put the full path of the location of
django-admin.py, then the command works. However, when I don't put the
full path in and just type the command "python django-admin.py
startproject mysite" then I get the error:

 'python' is not recognized as an internal or external command,
operable
 program or batch file.

Is there anyway to fix this and make is so that the command "python
django-admin.py startproject mystie" or any other command that begins
with "python" works? The documentation on Django's website suggests
that this command should work. Maybe I have forgotten to install
something, or maybe I have messed up Python's installation? Thanks
again for all help. Thank you.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Creating a project

2006-09-10 Thread brad

Well I finally stumbled upon a very useful documentation page on
Python.org. Thanks again for all of the input that everybody gave
becasue that input led me to find the right documentation. So...if
anybody is having trouble with running python commands in Windows
command prompt or having trouble with the command line then go to the
following URL:
http://www.python.org/infogami-faq/windows/how-do-i-run-a-python-program-under-windows/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: No module named models again

2013-02-06 Thread Brad
On Wed, 2013-02-06 at 10:31 -0800, frocco wrote:
> Exception Location:C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw
> \checkout\views.py in , line 5

Django gives you the line in the file where the error occurs so you
don't need to track it down ;-)
It's probably failing when you try to import something in views.py.

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: No module named models again

2013-02-06 Thread Brad
On Wed, 2013-02-06 at 11:49 -0800, frocco wrote:
> Line 22 does not make any sense to me as to why it is failing.
> If I remove receipt, it runs fine

It can be surprising sometimes what code can cause other code to get
imported and run. My guess is, in trying to find your url route there,
Django looks through ntw.urls. When it sees 'receipts' it imports
ntw.checkout.views to see if that view is there. Suffice it to say,
Django is trying to run the code in ntw\checkout\views.py and it would
be a good idea to make it work.

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How do I get the integer of a decimal string?

2013-02-09 Thread Brad
Convert it to float first:
int(float("14.00"))

On Sat, 2013-02-09 at 09:27 -0800, frocco wrote:
> Hello,
> 
> 
> I am reading a cdv file and one col has the value of "14.00"
> I want to get the integer value if 14
> I tried int("14.00")
> 
> 
> Thanks in advance
> 
> -- 
> 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, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Why i can't get the debug informations (in case of error) when i run LiveServerTestCase tests?

2013-02-09 Thread Brad
I admit it is vexing that Django overrides what you have specified in
the settings file in this case, but it doesn't seem to be hard to
override. I simply added "settings.DEBUG = True" to the beginning of the
"setUp" function for the test class and that seems to do the trick.
Btw, I see tracebacks in the console when a page has errors while
running tests, don't you? Maybe that's a feature of django-nose, which I
am using, I don't know.

On Tuesday, January 29, 2013 2:39:58 AM UTC-6, Alessandro Pelliciari
wrote:
> When i run my selenium tests (LiveServerTestCase type) and i have some
> error in my code (not in the test, i mean in the code executed, like
> the homepage view i reach with selenium) i get the 500 public template
> (that usually i get when i have DEBUG = False) even if i have:
> 
> DEBUG = True 
> INTERNAL_IPS = ('127.0.0.1',)
> 
> 
> I'm stuck with that and i can't see why my test failed (because in the
> public 500 ofc i don't show the exceptions).
> 


-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Collectstatic not working

2013-02-10 Thread Brad
The problem is that you have your STATIC_ROOT as one of the
STATICFILES_DIRS. The STATIC_ROOT directory should be empty, that is
where all the static files from different places will be gathered when
you run collectstatic. You should probably create a static directory
under the myapp directory and move all your static files there. Leave
the STATIC_ROOT setting as you have it now, and don't specify
STATICFILES_DIRS. By default django looks in static directories under
all apps in INSTALLED_APPS.

On Mon, 2013-02-11 at 01:50 +0530, Satinderpal Singh wrote:
> On running ./manage.py  collectstatic in the terminal, gives
> following message.
> 
> 
> 
> "The STATICFILES_DIRS setting should "
> django.core.exceptions.ImproperlyConfigured: The STATICFILES_DIRS
> setting should not contain the STATIC_ROOT setting


-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How do I get the current user in a model?

2013-02-11 Thread Brad
Sounds like you are maybe calling a user method from a template? You
will probably want to create a custom tag or filter:
https://docs.djangoproject.com/en/1.4/howto/custom-template-tags/

A filter would look like this:
{{ my_model_item|price:request.user }}

And the filter itself something like this:

def price(my_model_item, user):
"""Returns the price for the user"""
# Logic to evaluate the price could be here on in a
# model method, but if it's in the model method you
# will need to pass the user as a parameter to that
# method.
return evaluated_price

On Mon, 2013-02-11 at 07:05 -0800, frocco wrote:
> What I am trying to do, is I have four price fields in my model and
> need to return just one based on current user logged in.
> 
> 
> price_a
> price_b
> price_c
> price_d
> 
> 
> I want to always return a field named price, based on one of those
> fields.
> 
> On Monday, February 11, 2013 9:51:47 AM UTC-5, frocco wrote:
> Ok, but is request available in models.py?
> 
> 
> On Monday, February 11, 2013 9:49:47 AM UTC-5, sandy wrote:
> On Mon, Feb 11, 2013 at 7:42 PM, frocco
>  wrote: 
> > Hello, 
> > 
> > I have some logic I want to put in a model, but it
> requires know the current 
> > user logged in. 
> > Is there a way to get this? 
> > 
> This gets the current logged in user : 
> 
> current_user = request.user 
> 
> -- 
> Sandeep Kaur 
> E-Mail: mkaur...@gmail.com 
> Blog: sandymadaan.wordpress.com 
> 
> -- 
> 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, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to abstract model methods to a separate class?

2013-02-26 Thread Brad
On Tue, 2013-02-26 at 07:53 -0800, Richard Brockie wrote:
> class myLinksClass:
> basepath = 'testing/'
> 
> def self(self):
> return "%s" % (self.basepath, )
> 
> def view1(self):
> return "%s%s" % (self.basepath, 'view1', )
> 
> def view2(self):
> return "%s%s" % (self.basepath, 'view2', )
> 
> class MyModel(models.Model):
> 
> date = models.DateField()
> slug = models.SlugField()
> 
> def links(self):
> thelinks = myLinksClass
> return thelinks

If this is the actual syntax you used, then my best guess is that the
problem is that you are passing a class rather than an instanciated
object and those aren't class methods. Either instanciate an object or
remove the "self" arguments to make those class methods and it should
work.

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread brad
This may be related to Oracle's shared libraries not being in the path 
recognized by your web server. I created hard links to the Oracle shared 
libraries in /user/local/lib to get cx_oracle working.

I have a blog post that outlines what I did, here:
http://bradmontgomery.net/blog/gahhh-django-virtualenv-and-cx_oracle/

The comment by Graham Dumpleton is worth reading, as he mentions a few other 
techniques to make this work.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [ask for help] how to solve this issue: "DatabaseError at /admin/myapp, no such column: myapp.myvar"

2011-05-21 Thread brad
It sounds like you may have created your Models, run "mange.py syncdb", then 
added another field to your Model.

Remember, syncdb doesn't add new columns in your table when you add a new 
field to an existing model.  If this app is still in development, you can 
drop the whole table corresponding to that model and run syncdb again.

You should also consider looking at south (http://south.aeracode.org/). It 
provides migration tools that let you add columns to existing models via a 
managment command.

- Brad

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ManyToManyField to self with Intermediary

2008-09-01 Thread Brad Jasper

Did anything ever happen with this? I'm in the same position.

I understand the reasoning behind the restriction but I think it would
be useful to create custom intermediary tables.

- Brad

On Aug 17, 3:04 am, squeakypants <[EMAIL PROTECTED]> wrote:
> Really? Still though, with the intermediary I don't see why it can't
> be symmetrical. Unless I don't understand the idea of an
> "intermediary", it's not actually adding extra fields to that M2M
> table, but rather creating another table that references each
> connection's id. If that's the case, wouldn't it be possible to have a
> single intermediary entry reference both A->B and B->A?
>
> Like I said, the intermediary is just a PositiveIntegerField. If it
> does simply add extra fields and I'm just misunderstanding it, is
> there a "connection id" that I can reference myself? If it's as I
> explained above, I'm surprised this functionality isn't built in (and
> maybe I should post a ticket about it). I just want to do this
> correctly the first time to avoid any major model change in my site.
>
> Thanks,
> squeakypants
>
> On Aug 16, 11:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Since that's exactly how symmetrical works, it looks like you're
> > engaging in premature optimisation by ruling that out in the second
> > case.
>
> > Regards,
> > Malcolm

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ManyToManyField to self with Intermediary

2008-09-04 Thread Brad Jasper

For now I've commented out that error in django/core/management/
validation.py on line 121 and 122.

#if from_model == to_model and f.rel.symmetrical:
#e.add(opts, "Many-to-many fields with
intermediate tables cannot be symmetrical.")

I'm sure there was a good reason why you guys disallowed this but I'm
willing to give it a shot anyway.

I'll report back if I run into any problems.

Cheers,
Brad

On Sep 1, 11:10 pm, Brad Jasper <[EMAIL PROTECTED]> wrote:
> Did anything ever happen with this? I'm in the same position.
>
> I understand the reasoning behind the restriction but I think it would
> be useful to create custom intermediary tables.
>
> - Brad
>
> On Aug 17, 3:04 am, squeakypants <[EMAIL PROTECTED]> wrote:
>
> > Really? Still though, with the intermediary I don't see why it can't
> > be symmetrical. Unless I don't understand the idea of an
> > "intermediary", it's not actually adding extra fields to that M2M
> > table, but rather creating another table that references each
> > connection's id. If that's the case, wouldn't it be possible to have a
> > single intermediary entry reference both A->B and B->A?
>
> > Like I said, the intermediary is just a PositiveIntegerField. If it
> > does simply add extra fields and I'm just misunderstanding it, is
> > there a "connection id" that I can reference myself? If it's as I
> > explained above, I'm surprised this functionality isn't built in (and
> > maybe I should post a ticket about it). I just want to do this
> > correctly the first time to avoid any major model change in my site.
>
> > Thanks,
> > squeakypants
>
> > On Aug 16, 11:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
>
> > > Since that's exactly how symmetrical works, it looks like you're
> > > engaging in premature optimisation by ruling that out in the second
> > > case.
>
> > > Regards,
> > > Malcolm
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Best practice for serving restricted or premium media

2010-04-20 Thread Brad Buran
I'm currently researching Django as a potential framework for a web
application I am building.  We plan to make a variety of media (images
and videos) free on our website; however, we want to have some premium
media available only when certain criteria are met (e.g. the logged-in
user is of a certain group or has the appropriate permissions).

What is considered the best way to implement this?  I suppose we could
get Django to serve the media directly, but this would place undue
load on the server.  Can anyone recommend any tips or tricks?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Best practice for serving restricted or premium media

2010-04-21 Thread Brad Buran
Thanks for the great suggestions.  I believe that we will start out with
shared hosting the migrate to a VPS (e.g. SliceHost) if scaling becomes an
issue.  We're not really expecting to become a high-traffic website (our
target audience is small).

I'm not familiar with any of these approaches, but I can now use Google to
find and review some tutorials regarding each of these.  Will they all work
on shared hosting?

Brad

On Tue, Apr 20, 2010 at 10:50 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
> On Apr 21, 12:09 pm, Brad Buran  wrote:
> > I'm currently researching Django as a potential framework for a web
> > application I am building.  We plan to make a variety of media (images
> > and videos) free on our website; however, we want to have some premium
> > media available only when certain criteria are met (e.g. the logged-in
> > user is of a certain group or has the appropriate permissions).
> >
> > What is considered the best way to implement this?  I suppose we could
> > get Django to serve the media directly, but this would place undue
> > load on the server.  Can anyone recommend any tips or tricks?
>
> Groups and permissions are obviously things that can be handled by
> Django. For the actual serving up of the media files, there are
> various ways of doing it depending on how you are hosting Django.
>
> So, how are you intending to host it?
>
> Options for serving static media where Django handles request and
> handler deals with groups or permissions are:
>
> 1. Use X-Sendfile response header to have server send raw file.
> Supported by Apache, lighttpd and nginx, although possibly require
> option server module, eg mod_xsendfile.
>
> 2. Have nginx as front end with fastcgi backend, or with Apache/
> mod_wsgi as backend and use X-Accel-Redirect response header to map to
> private static files hosted by nginx.
>
> 3. Under Apache/mod_wsgi, use wsgi.file_wrapper extension of WSGI to
> return file. This may be hard as not really well supported by Django
> natively at this point.
>
> 4. Under Apache/mod_wsgi daemon mode, use Location response header
> with 200 reponse to map to static file served by Apache. This is like
> X-Accel-Redirect under nginx, but you need a mod_rewrite rule to
> restrict access to static media sub request as created by Location
> directive redirect.
>
> 5. Use perlbal as front end to backend HTTP server host Django in some
> way and use X-Reproxy-URL response header. Like Other variants above
> but perlbal sends static file identified by that header.
>
> Other load balancers may support other similar headers for having them
> send static files.
>
> There are other ways as well provided you were happy with standard
> HTTP Basic/Digest authentication being done by Apache and not form/
> session based logins.
>
> There is a Django ticket, which I believe still hasn't been
> integrated, to try and make various of these available under a simple
> usable interface. As such, right now, may have to integrate it
> explicitly.
>
> So, lots to choose from.
>
> Graham
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Setting list_display for InlineModelAdmin

2010-04-21 Thread Brad Pitcher
Hi guys,
This is driving me a little crazy, so I hope someone can offer good
advice.  I've specified an inline class in my admin.py file, and in it
I have specified a subset of the classes attributes with
list_display.  However, what I set in list_display has no effect on
what is rendered for the inline.  I don't understand, the
documentation says that TabularInline and StackInline both inherit
from ModelAdmin, so they should also use list_display.
What am I missing?

I'm using Django-1.1.1
Thanks,
Brad

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Setting list_display for InlineModelAdmin

2010-04-21 Thread Brad Pitcher
Thank you for setting me straight.  What a dumb mistake.  :)

On Apr 21, 11:03 am, Daniel Roseman  wrote:
> On Apr 21, 3:20 pm, Brad  Pitcher  wrote:
>
> > Hi guys,
> > This is driving me a little crazy, so I hope someone can offer good
> > advice.  I've specified an inline class in my admin.py file, and in it
> > I have specified a subset of the classes attributes with
> > list_display.  However, what I set in list_display has no effect on
> > what is rendered for the inline.  I don't understand, the
> > documentation says that TabularInline and StackInline both inherit
> > from ModelAdmin, so they should also use list_display.
> > What am I missing?
>
> > I'm using Django-1.1.1
> > Thanks,
> > Brad
>
> What makes you think that? 'list_display' controls the elements that
> are displayed on the changelist page for a model, not in the edit
> form. As with the main admin class, if you want to determine what
> fields are available on the form, use 'fields' or 'exclude'.
> --
> DR.
>
> --
> 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.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



auto generate "dummy" content (e.g. Lorem ipsum generator for Django)

2010-04-23 Thread Brad Buran
Is there any easy way of generating dummy content for models in Django?  As
I'm learning how to use Django, I often find myself deleting the sqlite
database and running syncdb each time (rather than dealing with the issues
of manual schema migration each time I make a change to my models).  As part
of this, I'd like to regenerate some dummy content so I can test the various
views and templates quickly.  It seems pretty straightforward: the
model.*Fields can give the necessary clues as to the content that can be
generated.  Before I start writing this, I thought I'd check to see if
anyone has done something similar.  I tried searching for a similar app, but
couldn't find anything.

Brad

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-02 Thread Brad Pitcher
Since I just spent much longer than it should have taken figuring this
out, I will try and help you out.  I followed the instructions at the
provided link and it sort of worked.  Not quite as well as I liked.  I
used Apache for the progress reporting, which the author doesn't
mention in the article but it is discussed here:
http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
(it involves compiling and installing an apache module).
The author also doesn't mention changes needed in settings.py:
from django.conf import global_settings

FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
\<-- change path here
global_settings.FILE_UPLOAD_HANDLERS

If you are using nginx or apache for the server side instead of
django, you will need to modify progressUrl to point to whatever url
you set up for accessing progress reports.

If you are looking for a demo, there is one linked in the article
creecode posted.
-Brad

On May 30, 12:23 pm, Venkatraman S  wrote:
> HI creecode,
>
> Can you share the project please? I can probably work on it and see what is
> happening.
> Till now, i havent even been able to get this working.
>
> -V
>
> On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> > Hello V,
>
> > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> > > I have been trying to build a simple file upload with progress bar.
>
> > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> > > will point you in the right direction.
>
> > I've experimented with a solution based tthe above but I wasn't
> > entirely satisfied with my implementation.  I'm having a problem with
> > the progress bar not reaching 100% many times and some problems with
> > the percentage complete number.
>
> > I've put my project on the back burner for now but if anyone has any
> > examples they'd like to share I'd be interested in seeing them.
>
> > Toodle-looo...
> > creecode
>
> > --
> > 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
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-02 Thread Brad Pitcher
Sort of, that's what the default is in the demo, but now I've noticed I have
the same problem with apache progress reporting as I did using django
progress reporting.  It's behaving like it's not multi-threaded or
something.  It seems like I don't get any progress reports until the file
has finished uploading.  It's actually driving me a bit crazy so I'm going
to have to move on to something else for a while.

On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:

> Does this work with the Django development server?
>
>
> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
>> Since I just spent much longer than it should have taken figuring this
>> out, I will try and help you out.  I followed the instructions at the
>> provided link and it sort of worked.  Not quite as well as I liked.  I
>> used Apache for the progress reporting, which the author doesn't
>> mention in the article but it is discussed here:
>>
>> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
>> (it involves compiling and installing an apache module).
>> The author also doesn't mention changes needed in settings.py:
>> from django.conf import global_settings
>>
>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
>> \<-- change path here
>>global_settings.FILE_UPLOAD_HANDLERS
>>
>> If you are using nginx or apache for the server side instead of
>> django, you will need to modify progressUrl to point to whatever url
>> you set up for accessing progress reports.
>>
>> If you are looking for a demo, there is one linked in the article
>> creecode posted.
>> -Brad
>>
>> On May 30, 12:23 pm, Venkatraman S  wrote:
>> > HI creecode,
>> >
>> > Can you share the project please? I can probably work on it and see what
>> is
>> > happening.
>> > Till now, i havent even been able to get this working.
>> >
>> > -V
>> >
>> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
>> > > Hello V,
>> >
>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>> >
>> > > > I have been trying to build a simple file upload with progress bar.
>> >
>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>> >
>> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
>> ..
>> > > > will point you in the right direction.
>> >
>> > > I've experimented with a solution based tthe above but I wasn't
>> > > entirely satisfied with my implementation.  I'm having a problem with
>> > > the progress bar not reaching 100% many times and some problems with
>> > > the percentage complete number.
>> >
>> > > I've put my project on the back burner for now but if anyone has any
>> > > examples they'd like to share I'd be interested in seeing them.
>> >
>> > > Toodle-looo...
>> > > creecode
>> >
>> > > --
>> > > 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
>> 
>> >
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> 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
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
Whoops!  Just read that the django dev server is not multithreaded so
it will not work.  But you should be able to use any web server along
with an upload_progress view as long as your web server streams the
upload in progress to django.  I think my troubles may be because the
web server isn't streaming the file upload to django, I'm currently
investigating that.

On Jun 2, 9:24 pm, Brad Pitcher  wrote:
> Sort of, that's what the default is in the demo, but now I've noticed I have
> the same problem with apache progress reporting as I did using django
> progress reporting.  It's behaving like it's not multi-threaded or
> something.  It seems like I don't get any progress reports until the file
> has finished uploading.  It's actually driving me a bit crazy so I'm going
> to have to move on to something else for a while.
>
> On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:
> > Does this work with the Django development server?
>
> > On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
> >> Since I just spent much longer than it should have taken figuring this
> >> out, I will try and help you out.  I followed the instructions at the
> >> provided link and it sort of worked.  Not quite as well as I liked.  I
> >> used Apache for the progress reporting, which the author doesn't
> >> mention in the article but it is discussed here:
>
> >>http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> >> (it involves compiling and installing an apache module).
> >> The author also doesn't mention changes needed in settings.py:
> >> from django.conf import global_settings
>
> >> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> >> \    <-- change path here
> >>    global_settings.FILE_UPLOAD_HANDLERS
>
> >> If you are using nginx or apache for the server side instead of
> >> django, you will need to modify progressUrl to point to whatever url
> >> you set up for accessing progress reports.
>
> >> If you are looking for a demo, there is one linked in the article
> >> creecode posted.
> >> -Brad
>
> >> On May 30, 12:23 pm, Venkatraman S  wrote:
> >> > HI creecode,
>
> >> > Can you share the project please? I can probably work on it and see what
> >> is
> >> > happening.
> >> > Till now, i havent even been able to get this working.
>
> >> > -V
>
> >> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> >> > > Hello V,
>
> >> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> >> > > > I have been trying to build a simple file upload with progress bar.
>
> >> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
> >> ..
> >> > > > will point you in the right direction.
>
> >> > > I've experimented with a solution based tthe above but I wasn't
> >> > > entirely satisfied with my implementation.  I'm having a problem with
> >> > > the progress bar not reaching 100% many times and some problems with
> >> > > the percentage complete number.
>
> >> > > I've put my project on the back burner for now but if anyone has any
> >> > > examples they'd like to share I'd be interested in seeing them.
>
> >> > > Toodle-looo...
> >> > > creecode
>
> >> > > --
> >> > > 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
> >> 
>
> >> > > .
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/django-users?hl=en.
>
> >> --
> >> 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
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> >  --
> > 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
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
Some versions of flash have a bug that causes the entire browser to
freeze while uploading.  I am afflicted by the bug, running Flash 10.0
r45 on Ubuntu 10.04.  It seems that there is no good solution at the
moment.  My host is Webfaction and I just discovered that they have a
non-configurable nginx server in front of everything that caches
uploads before sending them on to apache/django making it impossible
to do upload progress bars at the moment.  They are aware of the
problem, but who knows when it will be fixed.

On Jun 3, 8:31 am, Venkatraman S  wrote:
> Oh yes! I was referring to a stand alone app. I heard someone complain
> #django that filebrowser aint working right after uploadify was introduced.
> Is that True?
>
> On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:
> >http://code.google.com/p/django-filebrowser/
>
> > cheers,
> > patrick
>
> > On 3 Jun., 16:10, Venkatraman S  wrote:
> > > Hi Patrick,
>
> > > Can you share a simple django app which uses Uploadify?  Did you use
> > vanilla
> > > Uploadify or 
> > > django-uploadify(github.com/tstone/django-uploadify*)*<http://github.com/tstone/django-uploadify*%29*>
> > ?
> > > I have been simply unable to make it run.  I also tried a
> > django-uploadify,
> > > but no results! Frustrating it is.
>
> > > If you can share the code, i would rather use it along with some other
> > > experiments that I have been doing and publish it in the public domain.
>
> > > Regards.
>
> > > On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > > > you could use uploadify, seehttp://www.uploadify.com/.
>
> > > > of course, it´s not an ideal solution since its flash-based.
> > > > we´ve been using uploadify with django and the filebrowser for about a
> > > > year now and it works quite well.
>
> > > > regards,
> > > > patrick
>
> > > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > > Tell me about it! Its quite insane that there is no single-standard
> > > > solution
> > > > > for this.
> > > > > I have been hanging around in #django for sometime and there is still
> > > > > opposition to flash based solution. Also, i have not been to get it
> > > > working
> > > > > inspite of it being not an ideal solution.
> > > > > I hear that there are some issues with filebrowser since it uses
> > > > Uploadify.
> > > > > Also, i dont see any solution which works in both dev server and also
> > in
> > > > the
> > > > > production using httpd/apache.
>
> > > > > Going insane! Let me know if you get anything working.
>
> > > > > PS: As i said, html5 is cool and works, but the client does not want
> > to
> > > > use
> > > > > it!
>
> > > > > -V-http://twitter.com/venkasub
>
> > > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > > > wrote:
> > > > > > Sort of, that's what the default is in the demo, but now I've
> > noticed I
> > > > > > have the same problem with apache progress reporting as I did using
> > > > django
> > > > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > > > something.  It seems like I don't get any progress reports until
> > the
> > > > file
> > > > > > has finished uploading.  It's actually driving me a bit crazy so
> > I'm
> > > > going
> > > > > > to have to move on to something else for a while.
>
> > > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > > > wrote:
>
> > > > > >> Does this work with the Django development server?
>
> > > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> > bradpitc...@gmail.com
> > > > >wrote:
>
> > > > > >>> Since I just spent much longer than it should have taken figuring
> > > > this
> > > > > >>> out, I will try and help you out.  I followed the instructions at
> > the
> > > > > >>> provided link and it sort of worked.  Not quite as well as I
> > liked.
> > > >  I
> > > > > >>> used Apache for the progress reporting, which the author doesn't
> > > > > >>> mention in the article but it is discussed here:
>
> > > >http://piotrsarnacki.com/2008/06/18/upload-

best practice for widget that edits multiple model fields

2010-07-20 Thread Brad Buran
I have a group of fields (date_start, date_end, all_day) that I would like
to reuse in several models.  I've defined a MultiWidget that displays two
split datetime fields plus a checkbox (for the all_day toggle).  However,
I'm not sure how to get the MultiWidget to set the value of these three
fields in the model.  If I understand correctly, a MultiWidget can only set
the value of a single model field.  Hence, I would need to create some sort
of field (e.g. "combined_date_info") that MultiWidget saves the serialized
data from these three form fields.  Once I have done this, then I would use
model.save() to deserialize the data in the combined_date_info field and
save it to the appropriate model fields.

This solution seems a bit hackish and not very DRY.  Are there better
approaches?

Brad

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: best practice for widget that edits multiple model fields

2010-07-21 Thread Brad Buran
Hi Scott:

Thank you for the suggestion.  I reviewed the docs, and it appears like it
could work but would restrict the functionality.  For example, I would have
to somehow serialize two datetime types plus a boolean type into a single
database column.  This would take away a lot of advantages (such as being
able to filter based on only one of the datetimes).

One other option I am exploring is simply doing:

class DateRange(Model):
start = DateTimeField()
end = DateTimeField()



On Wed, Jul 21, 2010 at 8:03 AM, Scott Gould  wrote:

> My immediate thought upon reading your post was that you should build
> an accompanying custom model field. Having said that, I haven't had
> cause to do one that involved (only extend -- simply -- the stock
> fields) so can't provide any specifics.
>
>
> http://docs.djangoproject.com/en/1.2/howto/custom-model-fields/#howto-custom-model-fields
>
> On Jul 20, 10:00 pm, Brad Buran  wrote:
> > I have a group of fields (date_start, date_end, all_day) that I would
> like
> > to reuse in several models.  I've defined a MultiWidget that displays two
> > split datetime fields plus a checkbox (for the all_day toggle).  However,
> > I'm not sure how to get the MultiWidget to set the value of these three
> > fields in the model.  If I understand correctly, a MultiWidget can only
> set
> > the value of a single model field.  Hence, I would need to create some
> sort
> > of field (e.g. "combined_date_info") that MultiWidget saves the
> serialized
> > data from these three form fields.  Once I have done this, then I would
> use
> > model.save() to deserialize the data in the combined_date_info field and
> > save it to the appropriate model fields.
> >
> > This solution seems a bit hackish and not very DRY.  Are there better
> > approaches?
> >
> > Brad
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: best practice for widget that edits multiple model fields

2010-07-21 Thread Brad Buran
<>

Hi Scott:

Thank you for the suggestion.  I reviewed the docs, and it appears like it
could work but would restrict the functionality.  For example, I would have
to somehow serialize two datetime types plus a boolean type into a single
database column.  This would take away a lot of advantages (such as being
able to filter based on only one of the datetimes).

One other option I am exploring is simply doing:

class DateRange(Model):
start = DateTimeField()
end = DateTimeField()
all_day = BooleanField()

# subclass DateRange so we can reuse it in various models
class EventDateRange(DateRange):
date = ForeignKey(Event)

class Event(Model):
#various other fields required for event

Does this seem like it would make more sense?

Thanks,
Brad


On Wed, Jul 21, 2010 at 8:03 AM, Scott Gould  wrote:

> My immediate thought upon reading your post was that you should build
> an accompanying custom model field. Having said that, I haven't had
> cause to do one that involved (only extend -- simply -- the stock
> fields) so can't provide any specifics.
>
>
> http://docs.djangoproject.com/en/1.2/howto/custom-model-fields/#howto-custom-model-fields
>
> On Jul 20, 10:00 pm, Brad Buran  wrote:
> > I have a group of fields (date_start, date_end, all_day) that I would
> like
> > to reuse in several models.  I've defined a MultiWidget that displays two
> > split datetime fields plus a checkbox (for the all_day toggle).  However,
> > I'm not sure how to get the MultiWidget to set the value of these three
> > fields in the model.  If I understand correctly, a MultiWidget can only
> set
> > the value of a single model field.  Hence, I would need to create some
> sort
> > of field (e.g. "combined_date_info") that MultiWidget saves the
> serialized
> > data from these three form fields.  Once I have done this, then I would
> use
> > model.save() to deserialize the data in the combined_date_info field and
> > save it to the appropriate model fields.
> >
> > This solution seems a bit hackish and not very DRY.  Are there better
> > approaches?
> >
> > Brad
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Sorting related model

2010-09-11 Thread Brad Buran
Given the following two models forming the base of a wiki-style app:

class Page(models.Model):
current_revision = models.IntegerField()

class PageContent(models.Model):
page = models.ForeignKey(Page)
revision = models.IntegerField()
created = models.DateTimeField()

Here, we have a canonical Page object with a current_revision that always
points to the most current revision, stored in PageContent.  How can I
construct a Page queryset, ordered by the Pages that have the most
recently-created PageContent?

Currently, what I am doing is:

qs =
PageContent.objects.filter(revision=F('page__current_revision')).order_by('created').select_related()
pages = [content.page for content in qs]

This works fine, but is there a more straightforward way to do this?

Thanks,
Brad

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem reversing namespaced URL (application instance not recognized?)

2010-10-17 Thread Brad Buran
I'm trying to reuse a wiki app twice in my project; however, whenever I call
the reverse function, it returns the URL of the first instance defined in my
urls.conf.  I have attempted specifying the view name as
app_instance:view_name, app_name:view_name as well as using the current_app
keyword of the reverse function.  I have not had any luck so far and was
hoping for suggestions on what I'm doing wrong.  I've only posted the
relevant parts of the code.

Per the Django documentation on namespacing, I have set up my top-level URLs
conf as:

...
(r'help/', include('test.wiki.urls', 'wiki', 'help'), {'wiki': 'help'}),
(r'learn/wiki/', include('test.wiki.urls', 'wiki', 'learn'), {'wiki':
'learn'}),
...

In my wiki app, the urls.conf has

url(r'^(?P[-\w]+)/$', 'test.wiki.views.display',
name='wiki_page_detail'),
url(r'^(?P[-\w]+)/404$', direct_to_template, {'template':
'wiki/page_404.html'}, name='wiki_page_404')

Finally, in my display view function (note that this uses the wiki keyword
defined in the top-level urls.conf to know which :

def display(request, wiki, slug):
try:
wiki = models.Wiki.objects.get_or_create(wiki)
page = models.Page.objects.get(wiki=wiki, slug=slug)
except models.Page.DoesNotExist:
url = reverse('%s:wiki_page_404' % wiki.title, kwargs={'slug':
slug}, current_app=wiki.title)
return HttpResponseRedirect(url)


Thanks,
Brad

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problem reversing namespaced URL (application instance not recognized?)

2010-10-17 Thread Brad Buran
Problem solved.  I misunderstood the Django docs on URL namespacing and was
trying to take a shortcut by passing a 3-tuple rather than explicitly naming
the arguments to include.  Instead of include('test.wiki.urls', 'wiki',
'help') I should have been doing include('test.wiki.urls', app_name='wiki',
namespace='help').

Sorry for the trouble,
Brad

On Sun, Oct 17, 2010 at 6:14 PM, Brad Buran  wrote:

> I'm trying to reuse a wiki app twice in my project; however, whenever I
> call the reverse function, it returns the URL of the first instance defined
> in my urls.conf.  I have attempted specifying the view name as
> app_instance:view_name, app_name:view_name as well as using the current_app
> keyword of the reverse function.  I have not had any luck so far and was
> hoping for suggestions on what I'm doing wrong.  I've only posted the
> relevant parts of the code.
>
> Per the Django documentation on namespacing, I have set up my top-level
> URLs conf as:
>
> ...
> (r'help/', include('test.wiki.urls', 'wiki', 'help'), {'wiki': 'help'}),
> (r'learn/wiki/', include('test.wiki.urls', 'wiki', 'learn'), {'wiki':
> 'learn'}),
> ...
>
> In my wiki app, the urls.conf has
>
> url(r'^(?P[-\w]+)/$', 'test.wiki.views.display',
> name='wiki_page_detail'),
> url(r'^(?P[-\w]+)/404$', direct_to_template, {'template':
> 'wiki/page_404.html'}, name='wiki_page_404')
>
> Finally, in my display view function (note that this uses the wiki keyword
> defined in the top-level urls.conf to know which :
>
> def display(request, wiki, slug):
> try:
> wiki = models.Wiki.objects.get_or_create(wiki)
> page = models.Page.objects.get(wiki=wiki, slug=slug)
> except models.Page.DoesNotExist:
> url = reverse('%s:wiki_page_404' % wiki.title, kwargs={'slug':
> slug}, current_app=wiki.title)
> return HttpResponseRedirect(url)
>
>
> Thanks,
> Brad
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Match from list in URLconf

2007-07-30 Thread Brad Siegfreid
If all you have is a list of users to look through the suggestions work just
fine. Otherwise, it's easier to set a common root for that particular
lookup, such as mysite.com/user/matt. This avoids the problem of mixing in a
variable URL value with other parts of your site. It also maps nicely to a
Django app as well.

On 7/29/07, Matt <[EMAIL PROTECTED]> wrote:
>
>
> Hello list,
>
> I was wondering if the following is possible with the URLconf:
>
> I'd like the URL regex to match part of a URL if it exists within a
> specific list of values. For example, if you wanted to direct users to
> their area of your site, you might have something like this:
>
> www.mysite.com/matt --> go to my area
> www.mysite.com/jess --> go to Jess' area
> www.mysite.com/mark --> go to Mark's area
>
> In this situation you'd want a URL match for every user on your site,
> which is obviously database driven. I'd like to be able to pull a list
> of all the users out of the database and use a single line in my
> URLconf to acheive the above.
>
> This could all be acheived using another view to determine whether the
> given name was a valid user, and if so direct you to the appropriate
> view, but wouldn't that prevent you using Django's generic views?
>
> Thanks,
> Matt.
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Match from list in URLconf

2007-07-30 Thread Brad Siegfreid
I feel like I'm spending as much time designing URLs for this same problem
as I do handling other aspects of software architecture.
The simplest solution for this case would be a user/matt for mapping to
specific users and users/premium for retrieving a collection of users in a
category. Subtle but clear and attractive. Easy to map to different
handlers.

I've been using singular for specific resources and plural for collections
and it maps well.

On 7/30/07, Matt <[EMAIL PROTECTED]> wrote:
>
>
> Hi everyone,
>
> Thanks for the suggestions. The problem is a little more subtle than
> my example suggested.
>
> For instance, if you also had categories of users and wanted to be
> able to list the users in each category,  a 'human-friendly' url
> scheme might look like this:
>
> www.mysite.com/users/matt --> go to my area
> www.mysite.com/users/jess --> go to Jess' area
> www.mysite.com/users/mark --> go to Mark's area
> www.mysite.com/users/premium --> list all premium members
> www.mysite.com/users/economy --> list all economy members
>
> It's a contrived example, but if the categories were also numerous and
> data-driven, you'd need a different solution to those mentioned. I
> could always use "www.mysite.com/users/categories/premium", but it
> doesn't have quite the same feel.
>
>
>
> On Jul 30, 3:56 pm, "Brad Siegfreid" <[EMAIL PROTECTED]> wrote:
> > If all you have is a list of users to look through the suggestions work
> just
> > fine. Otherwise, it's easier to set a common root for that particular
> > lookup, such as mysite.com/user/matt. This avoids the problem of mixing
> in a
> > variable URL value with other parts of your site. It also maps nicely to
> a
> > Django app as well.
> >
> > On 7/29/07, Matt <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hello list,
> >
> > > I was wondering if the following is possible with the URLconf:
> >
> > > I'd like the URL regex to match part of a URL if it exists within a
> > > specific list of values. For example, if you wanted to direct users to
> > > their area of your site, you might have something like this:
> >
> > >www.mysite.com/matt--> go to my area
> > >www.mysite.com/jess--> go to Jess' area
> > >www.mysite.com/mark--> go to Mark's area
> >
> > > In this situation you'd want a URL match for every user on your site,
> > > which is obviously database driven. I'd like to be able to pull a list
> > > of all the users out of the database and use a single line in my
> > > URLconf to acheive the above.
> >
> > > This could all be acheived using another view to determine whether the
> > > given name was a valid user, and if so direct you to the appropriate
> > > view, but wouldn't that prevent you using Django's generic views?
> >
> > > Thanks,
> > > Matt.
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Considering Django for web-application. Your thoughts please.

2007-07-30 Thread Brad Siegfreid
There's some big questions in there. Maybe you should stick to one for now
and then get follow up on the details if you decide on Django: Python and
Django vs Java and some enterprise framework.
I use Java for my main project and also looked at Seam and JBPM. My day
project is limited to Java for a variety of reasons but I've been using
Django for smaller projects for myself and friends. If I could move work
over to Python and Django I'd do it in a heartbeat. I feel like each new
Java framework attempts to hide complexity but ends up hiding capability and
introducing new compatibility issues. I've taken a new approach at work by
striping away as many frameworks as I can and slowly adding only what is
needed.


With Python and Django I feel closer to the code and have as much capability
as I need. There is also a lot less code to deal with.

Also, don't forget Java's compile and deploy cycle compared to Django much
faster turnaround. This become especially noticeable if you start using Ajax
techniques. I could probably rewrite my project in Django in the spare time
I have waiting for

On 7/30/07, Snirp <[EMAIL PROTECTED]> wrote:
>
>
> I am considering Django to develop a business-to-business service. It
> should handle invoices (accounts payable) for my customers. It more or
> less comes down to:
>
> 1. enter invoices [we | various XML formats go into the
> database]
> 2. complete invoices   [automated | interface with customers
> accounting system]
> 3. validate invoices [customer ]
> 4. make booking[automated | interface with customers
> accounting system]
>
> The actual story is much more complex, as it deals with invoices on a
> line-item level. These must be able to be distributed / discussed /
> divided among users who act as budget-keepers of distinct
> departments.
>
> I have had a little playtime with django, and I found it pleasing to
> work with. It seems to be up to the task. I also compared it to Seam
> (RedHat Java-framework). Some questions came up:
>
> - The Java application stack boasts excellent scalability, will this
> ever be a problem for python / django (database-transactions etc.)?
>
> - Integration with Jbpm (workflow engine) is a strong-point with Seam;
> designing pageflow directly from process management. Is there anything
> like it for Django?
>
> - The default django user-interface uses permissions and users. Is
> this easily expanded with roles? Or is there a reason why there is no
> definition of roles?
>
> - On what level should I seperate different customers? Different
> websites / different databases / same database? Is there a smart
> choice, or a really stupid one here?
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Considering Django for web-application. Your thoughts please.

2007-07-30 Thread Brad Siegfreid
On 7/30/07, Snirp <[EMAIL PROTECTED]> wrote:
>
>
>
> Was BPM not a issue in these smaller projects, or did you have a way
> of dealing with this? I am much less experienced a developer and want
> to avoid using the wrong tool and hammering a screw in. On the other
> hand, however much I was impressed with JBPM, I am not 100 % certain
> that I need it for workflow.


At least for our project I found BPM to be overkill. To me it was another
framework that distanced the developers from the code and had to be learned.
Our newest release is focusing on REST which emphasizes stateless
interaction anyway. The few processes that require page to page flow will
either be Ajax or hand built with little effort.

> I feel like each new
> > Java framework attempts to hide complexity but ends up hiding capability
> and
> > introducing new compatibility issues. I've taken a new approach at work
> by
> > striping away as many frameworks as I can and slowly adding only what is
> > needed.
>
> Glad you say so, since I was overwhelmed by the application stack,
> level of abstraction and sheer size of Seam.


I really liked Seam for what it did and we probably spent more time
prototyping with it than other solutions. But in the end I didn't like to be
shut out of the basic HTTP process. Seam is a fairly elegant solution for
covering complexity but by removing other frameworks from the stack we were
able to simplify the whole stack and we didn't need it anymore.

Start simple and build from there.

Remember that a web app is built for HTTP. The more you do to change it from
that the more work you make for yourself. But, that's a different group to
follow...

> Also, don't forget Java's compile and deploy cycle compared to Django much
> > faster turnaround. This become especially noticeable if you start using
> Ajax
> > techniques.
>
> How do you mean this? I will rely on Ajax techniques, but i tend to
> see them as somewhat loosly coupled to the framework. As far as I can
> judge, Django agrees and does not provide Ajax integration. You can
> choose for this approach in any other framework (right?), and go for
> the specific ajax framework / techniques you like best.


We deploy our project as an EAR file to JBoss. Web-app, javascript and
everything gets deployed and managed by the container. We're also Java
developers first that are learning Javascript so we try, fail and try again
with our scripts. Unless we hijack the deployment process we have to
redeploy our ear file to test changes to javascript. That's on my todo list
but our dependencies makes changing our build and deploy test cycle rather
difficult to change.

With Django I can tweak both Python and Javascript without having to
redeploy. Apache or Django's test server doesn't care what I'm up to. You
change something and at most wait for Django to quickly recycle. If you are
just changing Javascript you don't even have to do that. Just refresh the
browser page. Much faster development.

I'm talking about about 9 minutes between change and test compared to maybe
a few seconds.

I this way ajax will never be a factor in a comparison of high-level
> frameworks, or am i wrong on this?


If the Ajax app is external to your EAR file or you are able to directly
edit the deployed files without fear of them being overwritten because of
changes in an ear file then you are OK.

>
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Considering Django for web-application. Your thoughts please.

2007-07-30 Thread Brad Siegfreid
>
> The concerns are few:


> - lack of big corporate backing (like Seam) and guaranteed sound
> documentation


Lack of big corporate backing is seen as an advantage to some. They need to
make money somehow and support contracts can be very lucrative. Small teams
can do amazing work. Just look at what the Django people have accomplished.

- much smaller user-base than RoR


I hadn't noticed. Django is certainly smaller than Java EE. Python appears
to have a lot more choices for web frameworks than Ruby. RoR does have
mind-share right now and is probably a viable alternative to Python and
Django but I like the Python language better.

- possible future extension of the project with a procurement system
> and resulting demand on resources


The immediate thing I would look at is if the procurement system only
provides an EJB interface or some other Big Vendor lock-in. Sometimes that
barrier can be crossed but it could be painful.

The last is not an immediate concern and the scale is not yet clear.
> The speed of development is much more of a concern.


Speed of development definitely points to a dynamic language.

Good luck on your project. Take time to play with several options before you
settle and see what works for you. This is a Django joint so I'd gently push
you in that direction. Then again, you won't find me hanging out with my
Java brethren if that means anything to you. In the end its your choice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to I unsubscribe from this group

2007-08-15 Thread Brad Cathey
No offense, but we¹ve decided to head in another direction and now I can¹t
get off the list. clicking the unsubscribe link is not working (I get a
confirmation that I am not part of this group), but the emails flow.

Thanks


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB Models best practice

2008-06-13 Thread Brad Wright

On Jun 12, 11:44 pm, "Bartek Gniado" <[EMAIL PROTECTED]> wrote:
> Instead of over complicating it like this. Why not just use memcached or
> django's own cache?

He's referring to:

http://www.djangoproject.com/documentation/cache/

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using newforms to show a single form for multiple models

2007-05-13 Thread Brad Fults

I'm in a situation where I have a List model class and a ListItem
model class. The ListItem class has a ForeignKey to the List class
with `edit_inline=models.STACKED, num_in_admin=10`. In the admin
interface for adding a new List, this is represented perfectly: it
shows the fields for the List object and 10 sets of fields for the
ListItem objects.

How would I replicate this same form setup (1 List, 10 ListIems) using
newforms in my app? I looked at the admin code on the newforms-admin
branch, but it's very genericised and dense. I'm thinking there's a
simple way to accomplish this, but it's not jumping out at me after
reading the docs.

I'd appreciate some pointers in the right direction.

Thanks in advance.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Great Free Surprise

2007-01-19 Thread Nancy Brad

*Media Mall Toolbar : Advanced 1-click System to the Following Items :*

*- 200 Live TV Channels
   - FM Radio With alot of Radio Stations and You Can Add More.
   - Live WebCams around The World
   - Tools and Essentials as : Online Spyware Scanners,Online Virus
Scanners and Online Firewall Services
   - Website Translator to any Language
   - Free Web Design Tools
   - MediaMall Toolbar is a free comparison shopping assistance tool
provides you with best available online prices . It uses a state-of-the-art
and is simple and intuitive to use. MediaMall presents the following
features: automatically compares prices on electronic devices such as PDAs,
MP3 players, DVD, computer accessories, printer accessories, PCs, Macs,and
monitors; automatically compares prices on new books; dynamic toolbar which
is displayed only when truly needed to spare unnecessary waste of screen
area
   - Fun Section for Online Games , Comedy Flashes , Cartoons & more 
   - Email Notifier for all Your Accounts
   - PopUp Blocker & Net Tracking Remover
   - Weather after providing your zip code to get your local weather.*

*You Can Download That Toolbar Free  from :*
**
*
http://www.download.com/Media-Mall-Toolbar/3000-12777_4-10624080.html*


*The Media Mall Toolbar Has Certified The "SoftPedia 100% Clean" Award:*
**
* http://www.softpedia.com/progClean/Media-Mall-Toolbar-Clean-62625.html
*
**
**
*Best Wishes ,*

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Watch Online Movies for Free

2007-01-21 Thread Nancy Brad
 Now You Can See Live TV Channels and Live Exciting Movies and Even
Download DVD Movies if You Want for Free at :

 http://clipurl.com/?GYU620

With My Best Wishes To Enjoy





-- 
See Our Magic , You Will Be Surprised

  http://www.mediamall.tk

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: I can't install django on my mac. I'm not sure why. Details inside.

2012-09-09 Thread Brad Pitcher
The question is, is django inside one of those directories? It should
probably be installed to C:\Python27\lib\site-packages so there would be a
C:\Python27\lib\site-packages\django directory. Is it there?

On Sun, Sep 9, 2012 at 3:41 PM, Shayan Afridi wrote:

> Interesting. I'm doing it on my PC now, and still getting the same problem.
>
> Then I saw your email:
>
> Here's what I get when I print sys.path. (django's not there)
>
> >>> print sys.path
> ['', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs',
> 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C
> :\\Python27\\lib\\lib-tk', 'C:\\Python27',
> 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages']
>
> the ln line doesn't work for me
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: I can't install django on my mac. I'm not sure why. Details inside.

2012-09-09 Thread Brad Pitcher
I can't speak authoritatively on this, since that's not how it installs in
Linux, but in my understanding the contents of the django.pth file should
be the directory django has been installed to. Check the contents of that
file to see if everything is in order.
An alternative to this is to update PYTHONPATH to point to the folder
django is installed to. A quick test on Mac OSX would look like:
PYTHONPATH=/location/of/django python -c "import django;
print(django.get_version())"
and you could make it more permanent by adding
PYTHONPATH=/location/of/django to your ~/.profile
In windows, you may need to look at your environment variable settings.

On Sun, Sep 9, 2012 at 3:53 PM, Shayan Afridi wrote:

> There is a django.pth there and a README
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: I can't install django on my mac. I'm not sure why. Details inside.

2012-09-09 Thread Brad Pitcher
Glad to here you got it working, and please let us know if you have any
other questions.


On Sun, Sep 9, 2012 at 5:52 PM, Shayan Afridi wrote:

> It works! Thank you all so much. It feels great to know that there is a
> very responsive and helpful support system for django users. Thanks again!
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Possible spam from mailing list? ("China Mobile")

2012-09-10 Thread Brad Pitcher
Yes, I received a similar email about the post "Re: I can't install django
on my mac. I'm not sure wh..." which I recently responded to. Not sure what
to make of it.

On Mon, Sep 10, 2012 at 12:27 PM, Kurtis  wrote:

> I just received a very unusual e-mail that included a recent post's
> subject. The post in question was: "Re: form doesn't validate when trying
> to upload file". It was sent directly to my email address; by-passing the
> User Group.
>
> Google roughly translated this email as coming from "China Mobile" and
> included the domain "139.com". Has anyone else seen this sort of thing?
> Unfortunately, I am unable to read the language and the Google Translation
> isn't very clear; but it's definitely displayed using a very clean and
> fancy template. I'm not sure if it's spam or something else.
>
> Just figured I'd see if anyone else has gotten an email similar to this.
> Thanks.
>
> --
> 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/-/cs6UrXOcBOkJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: static files

2012-10-11 Thread Brad Pitcher
I believe the best way of doing this is to have your image(s) in
static/images and your css in static/css.  Then you can use a relative URL
to set the background image like so:

background-image : url("../images/PAE.jpg")

It's better not to have any CSS mixed in with your HTML anyway.
On Oct 11, 2012 7:49 AM, "luca72"  wrote:

> hello my project is lacated here:
>
> /home/
>   /luca72
> /Scrivania
>   /Quintas_Disegno_definitivo
> /quintas/ here i have the file manage.py ,
>
> than i have the file settings,py here:
> /home
>/luca72
>   /Scrivania
>  /Quintas_Disegno_definitivo
> /quintas
>/quintas, here i have add a folder "static" with and image
> called PAE.jpg.
>
> How i have to configure the file setting.py in a way that in my template
> when i write via CSS background-image : url("PAE.jpg") the image is load
>
> I have try a lot of thing but i get that the image is not found.
>
> I use apache in localhost.
>
> Thaks
>
> Luca
>
> --
> 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/-/VXS19g9Ie7MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Best way to detect if a user has changed password

2012-10-24 Thread Brad Pitcher
You could use a "pre_save" signal. kwargs['instance'] will contain the
updated record and you can get the old record with "User.objects.get(id=
user.id) if user.pk else None". I've done this in the past to check for a
changed email address.

On Wed, Oct 24, 2012 at 2:23 PM, Roarster  wrote:

> I'm running a Django 1.4 site and I have some operations I want to perform
> if a user changes their password.  I'm using the standard contrib.auth user
> accounts with the normal password_change view and I'm not sure if I should
> somehow hook into this view or if I should use a signal on post_save for
> the user.  If I do use the signal, is it possible to tell when the password
> has been changed?  I do feel that if I can use a signal this might be the
> best approach since it would handle any other password change mechanisms
> that I might add later without any extra work.
>
> Does anyone have any ideas on the best way to do this?
>
> --
> 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/-/yrhcGbYf0f4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to reference model instance fields dynamically

2012-10-26 Thread Brad Pitcher
You can use python's setattr function to do this:

for k,v in fields.iteritems():
setattr(inst, k, v)

On Fri, Oct 26, 2012 at 8:37 AM, Chris Pagnutti wrote:

> Say I have a model like
> class MyModel(models.Model)
>name = models.CharField(max_length=100)
>number = models.IntegerField()
>
> In a script, I want to have something like
> fields = {"name":"Joe", "number":5}
>
> And I want to update a MyModel instance using the fields dictionary,
> something like this
> inst = MyModel.objects.get(pk=2)
> for k,v in fields.iteritems():
>inst.k = v   # I tried with inst.F(k) = v and inst.eval(k) = v but
> python doesn't like that either
>
> I hope I'm being clear in what I'm trying to do.  The reason I have to do
> it this way is that I don't know which model, and therefore fields, I'm
> dealing with until run-time.
> Please ask questions if this isn't clear.
>
> --
> 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/-/4ZtEPAjlksQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to reference model instance fields dynamically

2012-10-26 Thread Brad Pitcher
Use setattr's counterpart, getattr :-)

getattr(inst, k).add(relatedObject)

On Fri, Oct 26, 2012 at 5:16 PM, Chris Pagnutti wrote:

> Awesome.  Thanks Brad.  Now the question is, what if the attribute is a
> ManyToManyField.
>
> e.g.
> inst.k.add(relatedObject)
>
> How to reference k properly if k is a string containing the name of a
> ManyToManyField of inst?
>
>
> On Friday, October 26, 2012 11:37:36 AM UTC-4, Chris Pagnutti wrote:
>>
>> Say I have a model like
>> class MyModel(models.Model)
>>name = models.CharField(max_length=**100)
>>number = models.IntegerField()
>>
>> In a script, I want to have something like
>> fields = {"name":"Joe", "number":5}
>>
>> And I want to update a MyModel instance using the fields dictionary,
>> something like this
>> inst = MyModel.objects.get(pk=2)
>> for k,v in fields.iteritems():
>>inst.k = v   # I tried with inst.F(k) = v and inst.eval(k) = v but
>> python doesn't like that either
>>
>> I hope I'm being clear in what I'm trying to do.  The reason I have to do
>> it this way is that I don't know which model, and therefore fields, I'm
>> dealing with until run-time.
>> Please ask questions if this isn't clear.
>>
>  --
> 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/-/Rvpb5l-sbaQJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: selenium test for fallback page loaded from app cache when server is unavailable

2012-11-03 Thread Brad Pitcher
Are you having the selenium test go to online.html first like in your
manual test?
Maybe you need to have selenium hit offline.html first and cache that page?
On Nov 3, 2012 6:14 AM, "Joao Coelho"  wrote:

> Hi. I haven't been able to figure this one out. Trying to write an
> automated test that uses selenium.webdriver.firefox.webdriver
>
> The manifest file has
> FALLBACK:
> /online.html /offline.html
>
> So that at /online.html the browser displays the cached copy of
> /offline.html when the server is offline
>
> Also, to simulate server unavailable for testing
> /online.html returns a 200 response
> /online.html?offline=1 returns 503
>
> This all works fine when I browse manually
> /online.html displays "I am online"
> /online.html?offline=1 displays "I am a cached page"
>
> I want the selenium test to get /online.html?offline=1 and see "I am a
> cached page" /offline.html
> But it's only showing a blank page
> I think it's stopping at the 503 and not loading from the app cache
>
> def test_offline(self):
> """Simulate site being offline"""
> self.selenium.get('%s%s' % (self.live_server_url,
> '/online.html?offline=1'))
> self.assertIn('cached page', self.selenium.page_source)
>
> How can I make it test this? Thanks.
>
> --
> 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/-/YrAnOOsSaKAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: bar charts

2011-11-07 Thread Brad Montgomery
+1 for Google Charts.


For small stuff (1 chart), I just render JavaScript in the  of my 
html templates. For more complex stuff, you could write a view that *just* 
renders JavaScript and include it via a script tag. Just make sure to serve 
it with MIME type "application/javascript"


Here's more info on generating Non-HTML content:
http://djangobook.com/en/2.0/chapter13/

-- 
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/-/M_rJLephha4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Email notifications app

2012-11-23 Thread Brad Pitcher
Checkout django drip:
https://github.com/zapier/django-drip
On Nov 23, 2012 7:22 AM, "Arnaud BRETON"  wrote:

> Hi everybody,
>
> I'm looking for a powerful third-app for Django to manage time-driven
> email notifications.
>
> I found django-notifications (
> https://github.com/jtauber/django-notification) but it seems not
> maintained anymore..
>
> Thanks !
>
> --
> 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/-/UeHxWh5cp4kJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: newbie needs to copy a record in admin to a new record

2013-01-11 Thread Brad Pitcher
I think what should work well for your use case is an admin action:

https://docs.djangoproject.com/en/1.4/ref/contrib/admin/actions/

You can write code for a copy action in admin.py. This will add a "copy"
item to the dropdown in the list view, so you can select any number of list
items and copy them.

-
Brad Pitcher
Software Developer
(702)723-8255


On Fri, Jan 11, 2013 at 7:06 AM, frocco  wrote:

> Hello,
>
> I am just learning django and want to allow a user in admin to copy a
> record from the list to create a new record and make changes.
> This will prevent having to type similar data.
>
> How do I add a link to the admin list?
> where do I put code to dup the record?
>
> Thank you
>
> --
> 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/-/odBD_lyCqmsJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help - No module named models

2013-02-04 Thread Brad Pitcher
On Sun, 2013-02-03 at 10:04 -0800, frocco wrote:
> from catalog.models import Category

It is probably this line. Maybe there is no __init__.py file in the
catalog directory?

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Why i can't get the debug informations (in case of error) when i run LiveServerTestCase tests?

2013-02-09 Thread Brad Pitcher
Have you tried adding a:
import pdb; pdb.set_trace()
in the view to debug that way?
On Jan 30, 2013 12:31 AM, "Alessandro Pelliciari" 
wrote:

> Thanks for the answer!
>
> Because i'm developing and integrating some flow (social registration etc)
> through tests.
>
> So, instead of creating every time a new user, creating a new social
> association, and then after every try delete them from the database, the
> test does it from me.
>
> So, its like a kind of dirty TDD with functional (selenium because i have
> facebook login for example) testing.
>
>
> Anyway i think i can resolve with the 500 response logging the error to
> the console, but it's my first project in Django (and python) so i can't
> understand completely the way to logging at this moment.
>
>
> Alessandro
>
>
> Il giorno mercoledì 30 gennaio 2013 03:18:46 UTC+1, Ramiro Morales ha
> scritto:
>>
>> Ramiro Morales
>> On Jan 29, 2013 12:33 PM, "Alessandro Pelliciari" 
>> wrote:
>> >
>> > thanks for the link!
>> >
>> > So Isn't there a way to set DEBUG=True in tests?
>>
>> No. There isn't (at least with the built-in testing toolbox).
>>
>> Now, I'm trying to understand why do you rely in the debugging 500
>> response contents on your tests. Do you screen scrap it to extract
>> information about the origin of the failure?
>>
>  --
> 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, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Upgrade to django 1.5

2013-03-04 Thread Brad Pitcher
It should be safe, just test things out. Also, if you have DEBUG=False you
must also include an ALLOWED_HOSTS array, which became required in Django
1.4.4:
https://www.djangoproject.com/weblog/2013/feb/19/security/#s-issue-host-header-poisoning

It should contain a list of domains used to access the site.

On Sun, Mar 3, 2013 at 6:29 PM, Randa Hisham  wrote:

> Iam now working in aproject using django 1.4.2 could I upgrade to django
> 1.5?
>
> --
> 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, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Suggestion for using distinct on django 1.4+ in your unit tests?

2013-03-06 Thread Brad Pitcher
I believe sqlite supports "distinct" just not "distinct on". I have always
managed to find workarounds using "distinct" anywhere I formerly used
"distinct on".
On Mar 6, 2013 7:01 AM, "Toran Billups"  wrote:

> I recently upgraded to django 1.4 and found that my "distinct" queries
> don't work anymore in my test code because sqlite doesn't support it -how
> is everyone using this for integration testing?
>
> Thank you in advance
>
> --
> 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, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can't store valid JSON in JSONField because of SubfieldBase/to_python issues

2013-03-21 Thread Brad Jasper
I ended up moving this to the Django bug tracker thinking it was an issue 
with Django itself: https://code.djangoproject.com/ticket/20090

Someone over there pointed me in the right direction: You need to subclass 
SubfieldBase and call your own method instead of to_python. You can pass 
the custom ModelField along with the value and check the state that way. 
This seems to have solved my problem pretty well.

For an example, check out what we used on 
django-jsonfield: 
https://github.com/bradjasper/django-jsonfield/blob/master/jsonfield/subclassing.py

On Thursday, March 14, 2013 11:23:21 AM UTC-4, Brad Jasper wrote:
>
> I maintain django-jsonfield, a project that allows you to store arbitrary 
> JSON objects in the database.
>
> It's having a problem with the way to_python is called while 
> using SubfieldBase. A full explanation of the problem is here (
> https://github.com/bradjasper/django-jsonfield/issues/33), but here's my 
> best attempt at a summary:
>
> - We're unable to tell whether the value passed in to_python is already 
> encoded JSON
> - Because of this we can't store certain types of JSON values that should 
> be valid
> - The issues seems to be with the fact that Django uses to_python for both 
> the serialized and original value
>
> This might be an issue that needs to be fixed with Django itself, but I 
> wanted to reach out here first and see if anyone had any suggestions on how 
> to solve this.
>
> Any help is appreciated.
>
> Thanks,
> Brad
>

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Implementing query with Django ORM - left join with length() and replace() functions

2013-04-05 Thread Brad Buran
 I'm trying to replicate a query using Django's ORM; however, I'm having a 
bit of difficulty figuring out how to accomplish it.  The model that I'm 
querying is defined as:

class Word(models.Model):

objects = WordManager()
spelling = models.CharField(max_length=128)
ipa = models.CharField(max_length=128)

The query I'm trying to accomplish:

SELECT 
a.id, a.spelling, a.ipa
b.spelling as b_spelling, b.ipa as b_ipa
FROM 
dictionary_word as a, dictionary_word as b 
WHERE
a.ipa != b.ipa
and length(a.ipa) = length(b.ipa)
and a.ipa = replace(b.ipa, '%s', '%s')

The idea of this query is to find all pairs of words that differ by one 
phoneme (e.g. "mat" and "bat" differ by only one sound).  Is this query 
possible to accomplish with the ORM, or do I need to use a raw query?

Thanks,
Brad

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-15 Thread Brad Pitcher
In my experience, that particular error always means that the database
doesn't match what you have in your models. Try a syncdb and/or check your
south migrations to make sure your database is up to date.

-
Brad Pitcher
Software Developer
(702)723-8255


On Sun, Apr 14, 2013 at 11:01 PM, Jeff Hsu  wrote:

> Hi, I just pip installed django-social-auth from omab today on
> github(beginner here).  I think I can almost get it to work with facebook
> login, but I always have this "InternalError: Exception Value: current
> transaction is aborted, commands ignored until end of transaction block",
> after I log in with my facebook account and before I redirect to the
> profile page.  The request url shows
>
> http://127.0.0.1:8000/complete/facebook/?redirect_state=xxx&code=xxx&state=xxx.
>  I'm using Django 1.5.  Can anybody give me some directions to debug this?
>
> Thank you tons,
> Jeff
>
>
>  --
> 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, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




  1   2   >