Re: Syncdb is producing different databases on different machines.

2012-09-13 Thread Brian McKeever
I appreciate your help. Thank you. On Wednesday, September 12, 2012 11:28:44 AM UTC-6, Brian McKeever wrote: > > I actually figured it out. > > I created a new virtualenv on my development machine and installed the > requirements to it, and from that virtualenv, syncdb f

Re: Syncdb is producing different databases on different machines.

2012-09-12 Thread Brian McKeever
> Did you try running "manage.py sql" on the production server to see if the > SQL is printed out for the missing table? > > Cal > > On Wed, Sep 12, 2012 at 6:14 PM, Brian McKeever <kee...@gmail.com > > wrote: > >> I am not using any databa

Re: Syncdb is producing different databases on different machines.

2012-09-12 Thread Brian McKeever
' } } On Wednesday, September 12, 2012 11:02:10 AM UTC-6, Cal Leeming [Simplicity Media Ltd] wrote: > > Are you using any sort of custom db router? (look for DATABASE_ROUTERS in > settings). > > On Wed, Sep 12, 2012 at 5:05 PM, Brian McKeever <kee...@gmail.com > > wrote

Syncdb is producing different databases on different machines.

2012-09-12 Thread Brian McKeever
On my development machine, upon freshly creating my postgresql database, when I run syncdb, it creates two invitation tables - invitation_invitationkey and invitation_invitationuser. On my production server, upon freshly creating my postgresql database, when I run syncdb, it only creates

Re: Adding errors to form after successful validation

2011-07-11 Thread Brian McKeever
feel your pain, validating forms can be a PITA... Try reading through this > last bit of the form validation docs: > > https://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-... > > Cheers, > André Terra > > > > > > > > On Mon, Jul 11, 2011 at 6:02

Adding errors to form after successful validation

2011-07-11 Thread Brian McKeever
I have a search form that is used by a view to search for results and then redirect to display them one at a time. If my search doesn't find any objects matching the criteria, I'd like to display a message saying so. It seems natural to add this error to the search form and redisplay it since it

How do you handle broken tests from plug-ins?

2010-05-28 Thread Brian McKeever
I'm using Django-registration and Django-invitation. They both work on my website, but they both come with tests that fail. I don't think the tests are failing because the plug-ins don't work. I think they're failing due to different testing environments. Django- registration in particular gives

Re: Baffled by self.client.login(...) not working in unit tests

2010-04-19 Thread Brian McKeever
I fixed it by uninstalling Python 2.6.5 and installing 2.6.4 instead. On Apr 19, 8:44 pm, Brian McKeever <kee...@gmail.com> wrote: > I'm having the same problem. None of my tests are able to log in on > this computer. > > Here's an example: > >     def test_bug(s

Re: Baffled by self.client.login(...) not working in unit tests

2010-04-19 Thread Brian McKeever
I'm having the same problem. None of my tests are able to log in on this computer. Here's an example: def test_bug(self): response = self.client.get(reverse('home')) self.assertRedirects(response, 'accounts/login/?next=/home/', 302, 200) bob = User(

Re: Humble-structure sites on Django // Suggestion needed

2009-12-20 Thread Brian McKeever
lly sure how to write models for such a small yet > compound structure. > > How do I make, say, the first and second pages (about and contacs) > with some different fields? I will reproduce the method for all other > pages and repost here or question it again. > > On Dec 19,

Re: Humble-structure sites on Django // Suggestion needed

2009-12-19 Thread Brian McKeever
I'm not sure I'm entirely understanding your question, but yes, that does look easy to implement with django. What part is troubling you? You seem to have a good idea of what you want. On Dec 17, 6:42 am, tezro wrote: > Hello everyone. Making well-structured websites on

Re: HTML text editing

2009-12-11 Thread Brian McKeever
I wrote a html whitelist filter that only allows predefined tags, and runs however many filters you want to specify on it. I'd be curious what you guys thought about it. http://sourceforge.net/projects/htmlfilterfacto/ On Dec 11, 2:51 pm, Shawn Milochik wrote: > Look at

Re: Pydev + Django + Ubuntu 9.10

2009-12-07 Thread Brian McKeever
7, 8:17 am, turkan <kai.schl...@googlemail.com> wrote: > Hello Brian. > > Strange, I am also using Eclipse downloaded from eclipse.org. Did you > add any special folders to the PYTHONPATH? Are you using django from > the Ubuntu repositories? > > On Dec 7, 6:06 am, Br

Re: Pydev + Django + Ubuntu 9.10

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

Re: Django website stats

2009-11-19 Thread Brian McKeever
I haven't had a chance to play with this yet: http://code.google.com/p/django-tracking/ but it might do what you want. On Nov 19, 11:35 am, Fabio Natali wrote: > Martin Lundberg wrote: > > I am very new to Django but can't this be handled by middleware > > instead?

Re: GenericForeignKey with content_type in a related model ???

2009-11-05 Thread Brian McKeever
Why do you want to split it across two models? On Nov 5, 9:25 am, bruno desthuilliers wrote: > Hi all > > I have this pattern: > > class ModelOne(models): >     content_type = models.ForeignKey(ContentType) > > class ModelTwo(models): >     model_one =

Re: generic views 404 error

2009-10-27 Thread Brian McKeever
More info is needed. Could you post your urls? On Oct 25, 8:39 pm, Ross wrote: > I just neared the end of the poll application and converted everything > to generic views according to the tutorial. Once I started up the > server though, I could only find my admin page. I

Re: How to lay out multiple apps sharing the same model? (newcomer)

2009-10-27 Thread Brian McKeever
Generally, I'd create a different app for different functionality. IE one for authentication related stuff, another for the forum, another specific to the website. It's really a matter of style though. You can put the model definitions most anywhere. You might want to check out the sites

Does anyone know what happened to djangopluggables.com?

2009-10-21 Thread Brian McKeever
It's been giving me a "502 Bad Gateway nginx" for at least a couple weeks now. Are there any other good sources of django plugins? I know of the official python packages: http://pypi.python.org/pypi?%3Aaction=browse and django snippets: http://www.djangosnippets.org/

Re: Check Constrains in Django

2009-10-13 Thread Brian McKeever
Are you asking about the technical details of how it's done, or just how to do it? If the latter, django uses field and form level validation. http://docs.djangoproject.com/en/dev/ref/models/fields/#field-options http://docs.djangoproject.com/en/dev/ref/forms/fields/#ref-forms-fields On Oct

Re: showing user data in a view

2009-10-12 Thread Brian McKeever
ot;Ed Kawas" <ed.ka...@gmail.com> wrote: > Ah, so there is no way to use 'create_object' when doing this, right? > > Thank you, > > Eddie > > -Original Message- > From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] > > On Behalf Of

Re: showing user data in a view

2009-10-12 Thread Brian McKeever
users@googlegroups.com [mailto:django-us...@googlegroups.com] > > On Behalf Of Brian McKeever > Sent: October-12-09 11:52 AM > To: Django users > Subject: Re: showing user data in a view > > The easy way is to just check that the owner of X is the user logged > in. > I

Re: showing user data in a view

2009-10-12 Thread Brian McKeever
The easy way is to just check that the owner of X is the user logged in. I don't know that you can pass an argument to the decorator, but you could certainly just use an if statement. http://docs.djangoproject.com/en/dev/topics/auth/#limiting-access-to-logged-in-users-that-pass-a-test On Oct

Re: Automatic user association, and confirmation page

2009-10-11 Thread Brian McKeever
Is there a reason why you're storing an email address instead of just selecting the user or creating a new one? On Oct 10, 12:41 am, Andrew Pendleton wrote: > I'm trying to figure out the best way to add an email address form > field to the edit page for a model in the Django

Re: required fields during object instantiation

2009-10-11 Thread Brian McKeever
It may make debugging a little harder, but it gives you a lot more flexibility in constructing objects. Here's a factoryish method I wrote for testing: def create_teacher(textbook = None, user = None, start_state = None,

Re: best way to build a form for m2m-related models (via intermediary table)?

2009-10-11 Thread Brian McKeever
"Does it make sense to include the fields of both models into the same form?" Models represent how a computer stores your data in a database. Forms allow humans to input data into your database. Ideally, the two would be the same. Realistically, humans and computers think quite differently and

Re: redirect to enter page

2009-09-26 Thread Brian McKeever
This should do what you want: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.decorators.permission_required On Sep 25, 2:35 pm, Dan Cox wrote: > Django Users, > > I'm pretty new to django so please excuse my ignorance. > > I'd like to redirect users

Re: Error Message regarding len()

2009-09-25 Thread Brian McKeever
t; \S3.py" in encode >   84.     b64_hmac = base64.encodestring(hmac.new > (aws_secret_access_key, str, sha).digest()).strip() > File "C:\Python25\lib\hmac.py" in new >   121.     return HMAC(key, msg, digestmod) > File "C:\Python25\lib\hmac.py" in __init__ >  

Re: Error Message regarding len()

2009-09-25 Thread Brian McKeever
A stack trace would be more useful. On Sep 25, 12:07 pm, Nick wrote: > I'm using the django-storages backends from David Larlet to upload > images to s3 from inside the admin.  When i try to run everything I > get an error: > > object of type 'NoneType' has no len() > > Here

Re: are django applications portable?

2009-09-25 Thread Brian McKeever
I'm not familiar with the plugin, but I would guess that it's trying to add itself to the python path. That way it's easily available for any django project without having to include it in an individual project. I would bet that it'd work just fine included manually in your project without

Re: is this a sane way to show total number of objects in pagination?

2009-09-25 Thread Brian McKeever
;I would probably...", so he may have been > implying that there was a technical reason but most likely he was just > stating his preference. > > On Sep 25, 5:03 am, Chris Withers <ch...@simplistix.co.uk> wrote: > > > Jani Tiainen wrote: > > > Chris With

Re: is this a sane way to show total number of objects in pagination?

2009-09-25 Thread Brian McKeever
Withers <ch...@simplistix.co.uk> wrote: > Brian McKeever wrote: > > .count is definitely the way to go. Although, I would probably pass it > > to your template instead of determining it there. > > What difference does it make? > > Chris > > -- > Simplistix - Con

Re: How to update a ManyToManyField in a model's custom save method

2009-09-24 Thread Brian McKeever
The presave signal passes the instance of the updated object to the signal automatically, so your code should work with minimal modifications. Try this: from django.db.models.signals import post_save def member_check(sender, **kwargs): if Project.objects.filter(id__exact=self.id).count():

Re: Design question

2009-09-24 Thread Brian McKeever
> On Sep 23, 11:05 pm, Brian McKeever <kee...@gmail.com> wrote: > > > I remember a quote from either headfirst java or design patterns that > > said something like: > > "The key to inheritance is to abstract functionality." > > > I realize we're

Re: TemplateSyntaxError: VariableDoesNotExist

2009-09-24 Thread Brian McKeever
I would write a custom tag that wraps ugettext but checks for None. http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters http://docs.djangoproject.com/en/dev/topics/i18n/#standard-translation On Sep 24, 10:14 am, Florian Schweikert

Re: django template tag truncatewords_html, detect whether it truncated or not

2009-09-24 Thread Brian McKeever
I think you'll have to write a custom template tag: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag-and-saving-contents On Sep 24, 10:56 am, J wrote: > Hello, > > How can I detect whether the template tag truncatewords_html

Re: is this a sane way to show total number of objects in pagination?

2009-09-24 Thread Brian McKeever
.count is definitely the way to go. Although, I would probably pass it to your template instead of determining it there. On Sep 24, 10:32 am, Chris Withers wrote: > Chris Withers wrote: > >      objects = model.objects.all() > >      paginator = Paginator(objects,10) > >

Re: Retrieving the request URI inside the view function?

2009-09-24 Thread Brian McKeever
I imagine request.path would do what you want: http://docs.djangoproject.com/en/dev/ref/request-response/#attributes On Sep 24, 10:37 am, Christophe Pettus wrote: > My apologies, because I am certain that this is documented somewhere,   > but I cannot seem to find it. > >

Re: Limiting queryset on ModelAdmin based on date field

2009-09-23 Thread Brian McKeever
I'm not too familiar with customizing the admin, but you want to use the range field lookup. http://docs.djangoproject.com/en/dev/ref/models/querysets/#range On Sep 23, 11:07 pm, Alvaro Mouriño wrote: > Hi list. > > I'm developing a news application that handles

Re: FormWizard and form data

2009-09-23 Thread Brian McKeever
I would try creating a view that uses a form factory to define some dynamic forms. This post explains how to create a dynamic form factory: http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/ and then I'd return the Wizard that has the new forms as arguments. I bet it would work, but I

Re: limiting the scope of a ForeignKey relation to within a model?

2009-09-23 Thread Brian McKeever
The docs say that it's possible although unrecommended to use choices dynamically. http://docs.djangoproject.com/en/dev/ref/models/fields/#choices However, you could easily do it at the form level or with a custom setter method. On Sep 20, 4:57 pm, Doug wrote: > Lets say for

Re: Windows compatible?

2009-09-23 Thread Brian McKeever
Python is inherently cross-platform, so you just need the same version as everyone else. On Sep 23, 9:32 pm, Tim wrote: > Is there a Windows version of Django? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Django + QT4

2009-09-23 Thread Brian McKeever
That's a little different. If you want your desktop apps to all directly connect to your server database, I'm not sure what security issues you'd be exposing yourself to. I figured you wanted a local database where it wouldn't matter if the user messed it up. I mean, I'm not saying it can't be

Re: What JavaScript framework do you use and why?

2009-09-23 Thread Brian McKeever
Dojango seems really helpful. Thanks. On Sep 23, 8:40 pm, Ovnicraft <ovnicr...@gmail.com> wrote: > 2009/9/23 Brian McKeever <kee...@gmail.com> > > > > > I just decided to learn to use dojo yesterday. > > I chose it because it has a huge library of

Re: Design question

2009-09-23 Thread Brian McKeever
I remember a quote from either headfirst java or design patterns that said something like: "The key to inheritance is to abstract functionality." I realize we're not talking about inheritance, but I think it still applies. It may make logical sense that a user object has a blog that has

Re: Finding unique ForeignKey enties.

2009-09-23 Thread Brian McKeever
To only get one image, you use a limit. like movie.images_set.all()[:1] On Sep 22, 2:37 pm, Joshua Russo wrote: > On Tue, Sep 22, 2009 at 7:23 PM, MV wrote: > > > I have a Movie model > > and I have a Image model > > the Image model has a

Re: What JavaScript framework do you use and why?

2009-09-23 Thread Brian McKeever
I just decided to learn to use dojo yesterday. I chose it because it has a huge library of GUI widgets that are all suppose to be accessible to people with disabilities. I found this: http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks quite helpful. What I didn't know until

Re: Django + QT4

2009-09-23 Thread Brian McKeever
I imagine you're talking about using django models for database management? There's nothing stopping you really. Django is just a python program. All you need to do is: Create a django project (as per the tutorial). Set up the database like normal in your settings file. Create your app with

Re: How to update a ManyToManyField in a model's custom save method

2009-09-23 Thread Brian McKeever
Try using a postsave signal. It'll automatically trigger your method upon saving a Project. http://docs.djangoproject.com/en/dev/topics/signals/#receiver-functions Basically, all you'd need is: from django.db.models.signals import post_save def member_check(sender, **kwargs): #your code

Re: django-trackback usage?

2009-09-23 Thread Brian McKeever
I would put all signal code in the models. I'm afraid I'm not familiar with trackback, but I would imagine that all you'd need to do is: from django.db.models.signals import post_save def your_trackback_function(sender, **kwargs): #whatever goes here

Re: Sqlite3

2009-09-23 Thread Brian McKeever
What does your DATABASE_NAME setting set to in your settings.py file? I know django gives that error if the path is set incorrectly. It needs to say something like: '/home/user_name/django_project/ your_database.db' if you're using sqlite On Sep 23, 4:47 pm, RcCypher wrote:

Re: Could Django handle this particular setup?

2009-09-23 Thread Brian McKeever
Here's the documentation for the sites framework which does everything you need: http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites On Sep 23, 3:13 pm, Jean-Nicolas wrote: > I would like to use Django for my next project, however, the setup is

How do you keep a django project encapsulated?

2009-09-17 Thread Brian McKeever
Particularly, how do you write the project in such a way that database queries don't constantly have to reach across 5 classes? For example, this query needs to know the innards of the Definition, UserDefinition, and UserData classes: basic_query = Definition.objects.filter(concept =

Re: Editors of choice

2009-09-08 Thread Brian McKeever
I recently learned vim, and I'm a ginormous fan of it for editing. Although, I use pydev for difficult debugging. On Sep 8, 5:37 am, Mike Ramirez wrote: > On Tuesday 08 September 2009 04:11:38 ThinRhino wrote: > > > Mike, > > > Does Eric4 support mercurial? I tried google,

I'm having some trouble with signals.

2009-04-30 Thread Brian McKeever
I'm sure I made some dumb mistake, but I just can't see it. Basically, I'm having difficulty connecting to the signal with my model. #my test def test_set_trigger_bug(self): self.assertEqual(len(game_reset.receivers), 0) def trigger(): pass

Re: I'm having some trouble with GenericForeignKey

2009-03-20 Thread Brian McKeever
Thank you. I appreciate the quick response. --~--~-~--~~~---~--~~ 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,

I'm having some trouble with GenericForeignKey

2009-03-20 Thread Brian McKeever
What am I doing wrong? Is there any other way to do what I want? I'm basically trying to implement the GOF's strategy design pattern (the real code is more complicated than this example). ## my models class Donkey(models.Model): name = models.CharField(max_length=11) class Barn(