EmailMessage hangs in windows

2012-04-24 Thread CrabbyPete
I have the following code: msg = EmailMessage ( subject = subject, body = body, from_email = sender, to = receivers,

EmailMessage hangs in Windows

2012-04-23 Thread CrabbyPete
I am using from django.core.mail import EmailMessage and I have the following code msg = EmailMessage ( subject = subject, body = body, from_email = sender, to

Show deactived radio button on a form

2011-12-30 Thread CrabbyPete
I have the following form: DEAL_CHOICES = [ ('Standard','Standard'), ('Sponsored','Sponsored'), ('Trial' ,'Trial') ] class ApplyForm(forms.Form): deal_type= forms.ChoiceField( required = True,

Iterable check boxes

2011-12-15 Thread CrabbyPete
According to the documentation I can iterate radio buttons {% for radio in myform.beatles %} {{ radio }} {% endfor %} I want to do the same for checkboxes, but get TemplateSyntaxError Exception Value: Caught TypeError while rendering: 'BoundField' object is not iterable My field is class

Re: Django E-Commerce Framework

2011-12-07 Thread CrabbyPete
net? > I can't find a django-authorize. > > Thanks, > Dennis > > On Dec 6, 9:04 am, CrabbyPete wrote: > > > > > > > > > Roll your own and use packages like django-authorize and django-paypal > > they are easy to use and don't bring along

Re: One from from multiple models using ModelForm

2011-12-06 Thread CrabbyPete
_name') class ProfileForm ( UserForm ): class Meta(UserForm.Meta): document = Profile On Dec 4, 11:56 am, akaariai wrote: > On Dec 4, 6:05 pm,CrabbyPete wrote: > > > > > > > > > > > I wanted to combine two models into one form so I c

Re: Django E-Commerce Framework

2011-12-06 Thread CrabbyPete
Roll your own and use packages like django-authorize and django-paypal they are easy to use and don't bring along lots of baggage. On Dec 6, 8:19 am, Andre Terra wrote: > I haven't worked with either one of them, but satchmo[1] is also often > mentioned. > > Django packages also has a list of e-c

One from from multiple models using ModelForm

2011-12-04 Thread CrabbyPete
I wanted to combine two models into one form so I created the following class UserForm( ModelForm ): class Meta: model = User fields = ('email','first_name','last_name') class ProfileForm( ModelForm ): class Meta: model = Profile class UserProfile ( UserForm, Prof

Re: how django forms.ChoiceField with queryset ?

2011-11-21 Thread CrabbyPete
Do want to initialize a choice field? You can do this with forms class SomeForm(forms.Form): interest = forms.ChoiceField( choices=(), widget=forms.Select(attrs={}) ) def __init__(self, *args, **kwargs): super(SomeForm, self).__i

Radio Choices and Generic Views

2011-11-20 Thread CrabbyPete
I use the following code that I got from a django snippet, which works great if you want to have radio buttons with different types of fields associated with them from django import forms from django.utils.encoding import for

Re: Automatically direct unauthenticated users to homepage

2011-11-15 Thread CrabbyPete
? You are probably doing something against the > DRY principle. > > bye > Ivo > > On Nov 15, 2011, at 17:16 , CrabbyPete wrote: > > > > > > > > > I have a site with lots of views. When someone comes to my site and is > > not logged in I direct them t

Automatically direct unauthenticated users to homepage

2011-11-15 Thread CrabbyPete
I have a site with lots of views. When someone comes to my site and is not logged in I direct them to the homepage to login. However a user could type in a whole url for a view and it will go there and cause an error because the view expects the user to be logged in. I could put logic in every view

Automatically direct unauthenticated users to homepage

2011-11-15 Thread CrabbyPete
I have a site with lots of views. When someone comes to my site and is not logged in I direct them to the homepage to login. However a user could type in a whole url for a view and it will go there and cause an error because the view expects the user to be logged in. I could put logic in every view

Re: Which Linux distro to use on EC2?

2011-11-14 Thread CrabbyPete
I've used Ubuntu 11.0 on an EC2 micro, using nginx and uwsgi and its great. There is also a google group for ubuntu on ec2, with loads of support. If you use uwsgi you have to compile it on the server. I had a tough time using Amazons version, I don't remember why, but had no problem using Ubuntu.

Re: Class Views Questions

2011-10-09 Thread CrabbyPete
opics/http/urls/#what-the-urlc... > > Just for the record, there's a generic class view, called DeleteView, that > you should use, but as a different view. > > Hope that helps. ;) > > []'s > > On Sat, Oct 8, 2011 at 11:12 AM, CrabbyPete wrote: > > I am fo

Class Views Questions

2011-10-08 Thread CrabbyPete
I am fooling around with django generic class views, and I was wondering if its possible to actually build class views per item for example I have the following class view. class TeamView( View, TemplateResponseMixin ): template_name = 'team.html' def get(self, request): if 'team

Class Views

2011-10-06 Thread CrabbyPete
I have the following class defined class TeamView(TemplateResponseMixin, View): template_name = 'team.html' def get(self, request): if 'team' in request.GET: team = Team.objects.get(id = request.GET['team']) form = TeamForm( ) else: tea

Re: Error was: No module named io

2011-08-29 Thread CrabbyPete
This is what I suspected. Even though Django 1.3 is supposed to support python 2.5 On Aug 29, 3:53 am, Łukasz Rekucki wrote: > It's not a path problem. It's a python version problem: > > http://docs.python.org/library/io.html > > "New in version 2.6." > > It's not a problem with Django as 1.3 run

Re: Error was: No module named io

2011-08-28 Thread CrabbyPete
Type: ViewDoesNotExist at / Exception Value: Could not import base.views. Error was: No module named io On Aug 27, 10:06 pm, sreekanth wrote: > Hi, > > Please check the path , as you changed to a new server and also check the > permissions. > > > > > > > > On S

Error was: No module named io

2011-08-27 Thread CrabbyPete
I developed my code with python 2.6 and django 1.3. Now that I am deploying it on a dreamhost server the python is version 2.5 and I get the error above. Is there a work around. Do I need to upgrade python? -- You received this message because you are subscribed to the Google Groups "Django user

Model Inheritance and methods

2011-08-20 Thread CrabbyPete
I have the following models: class Deal(models.Model): """ Deal is a deal for Interest. There should only be one deal for each Interest pair """ interest = models.ForeignKey( Interest ) max_sell = models.IntegerField(default = 1) def terms(self): retur

Re: template newlines

2011-08-14 Thread CrabbyPete
otice the - after the % sign. This tells jinja2 to remove the > > previousnewlinecharacter. You can also add them at the closing % to > > remove the followingnewlinecharacter. > > > It is pretty easy to use with Django (and many people do), and you can > > just use it for

template newlines

2011-08-13 Thread CrabbyPete
I'm using the django template system for format a text email. I send it a dictionary and it formats the output. The problem is that it inserts lots of newlines Here is the template, and reports is a dictionary that contains an event and a dictionary of interests Weekly Contact List For {{date}} {

South

2011-08-11 Thread CrabbyPete
I've used South and I love it, but when I ran it for my latest database I got this C:\> manage.py migrate base Running migrations for base: - Migrating forwards to 0001_initial. > base:0001_initial ! Error found during real run of migration! Aborting. ! Since you have a database that does n

Re: Django, Apache, MySQL on Windows in Production

2011-07-26 Thread CrabbyPete
PS, I used mod_wsgi and make sure you have the latest pywin32 On Jul 26, 2:03 pm, CrabbyPete wrote: > I've run django on Windows Server with apache and it was easy to > deploy.  Forget IIS. I've deployed Nginx and uWSGI on linux and that > was even easier. > I've never

Re: Django, Apache, MySQL on Windows in Production

2011-07-26 Thread CrabbyPete
I've run django on Windows Server with apache and it was easy to deploy. Forget IIS. I've deployed Nginx and uWSGI on linux and that was even easier. I've never done Nginx on windows, but I don't think it would be a big deal. On Jul 26, 1:25 pm, Dimitry Zolotaryov wrote: > So if I run into perfo

Re: django & py2exe

2011-07-24 Thread CrabbyPete
I've been doing this with no problem here is the top of my routine that runs on its own. After this just write what code you want to run import os, sys from os.pathimport abspath, dirname, join,split from site import addsitedir # Set up the environment

Re: Static Files on IIS7

2011-07-23 Thread CrabbyPete
Have you got django to run on II7 at all. I tried it and was not able to get it to work. If you did I'd love to try it and see what comes up with it. On Jul 22, 7:46 am, The Ape wrote: > Hi, > > I am running Django (1.3) with PyISAPIe (Python 2.6.6) on IIS7. > I am using the Django tutorial pages

Re: django form radio input layout

2011-07-16 Thread CrabbyPete
[ ('a','Until Cancel', forms.RadioSelect), ('b','Until Date', forms.DateInput), ('c','Until Count', forms.TextInput) ] ) On Jul 16, 10:08 am, CrabbyPete wrote

Re: django form radio input layout

2011-07-16 Thread CrabbyPete
Here is the closest snippet I found that works well for using 1 other field. I have 2 other fields and I guess I'll try to modify it. If you have any other snippets or suggestions please let me know. http://djangosnippets.org/snippets/863/ On Jul 14, 3:56 pm, Bill Freeman wrote: > Unless thing

Re: django form radio input layout

2011-07-14 Thread CrabbyPete
I am trying to do the same thing. Did you ever get a response? On Jun 16, 11:55 am, NateB wrote: > Hello all, > > I posted this to stackoverflow a couple weeks ago, but I have yet to get any > takers.  I was able to backburner this for a little bit, but I'd like to see > it wrapped up. > > In my

Re: Djungo on Microsoft IIS

2011-06-15 Thread CrabbyPete
Yaroslav, I tried and tried to get Django to work with IIS on my Windows Server, but could not get it to work. I would love to know how you did it. I finally gave up and installed Apache on Windows. Will this work with an existing Django project? Pete On Jun 15, 2:52 am, Yaroslav Govorunov wrot

save and restore session

2011-05-24 Thread CrabbyPete
I'm trying to access LinkedIn using Oauth. I don't want to log in with it, just get user info from it. I'm using a call back which creates an anonymous session on the callback. I want to save the session of the user who initiated the callback. Is there a way to save a session and then restore it ba

django-linkedin & oauth2

2011-05-21 Thread CrabbyPete
I took the code below from django-linked in which is code from oauth2. It works but does not do the callback. How do you set the call back from oauth2 # from settings.py consumer = oauth.Consumer(settings.LINKEDIN_TOKEN, settings.LINKEDIN_SECRET) client = oauth.Client(consumer) request_token_url

Update a user profile after LInkedin Oauth

2011-05-20 Thread CrabbyPete
I am trying to update a user profile of an existing user with a LinkedIn profile. My problem is I need an email address, but LinkedIn does not give you that information. So I have a user create an account with their email address and ask if they want to link their profile to their LinkedIn profile.

Re: django uwsgi

2011-04-30 Thread CrabbyPete
Thanks Shawn, That is exactly what it is. I could have added one path up. I just changed my ROOT_URLCONF = 'urls' instead of ROOT_URLCONF = 'project.urls' in my settings and it works fine. On Apr 30, 1:42 pm, Shawn Milochik wrote: > It sounds like your project directory is not on your PYTHONPATH,

django uwsgi

2011-04-30 Thread CrabbyPete
I am trying to deploy a django project with nginx and uwsgi. I think I have it all set up right but when I hit the site I get the following error: No module named project.urls I know everything else is working because I still have debug on and can see that settings.py is being read. I know I'm fo

Re: Django real world website samples (with django source codes)

2011-04-08 Thread CrabbyPete
pinax is great project to learn from http://pinaxproject.com/ On Apr 8, 4:08 am, mengu wrote: > go tohttp://github.comandhttp://bitbucket.organd search for > django. > > On Apr 8, 5:21 am, djangodjango django wrote: > > > thanks. > > > On Thu, Apr 7, 2011 at 4:38 PM, Nikos K wrote: > > > Here i

window.location.reload( true );

2011-04-07 Thread CrabbyPete
If I do this in my html javascript window.location.reload( true ); I get the following error. Can anyone tell me why? Traceback (most recent call last): File "C:\Python26\lib\site-packages\django\core\servers \basehttp.py", line 281, in run self.finish_response() File "C:\Python26\l

Force an ajax window to close

2011-03-30 Thread CrabbyPete
I have a ajax form using smoothbox and mootools to show a form. Smoothbox has a button to close the box, but I want to force it closed once the submit button is pressed and the form validated. Is there a way django can close a browser window? -- You received this message because you are subscribe

Re: how to create message box in Django?

2011-03-29 Thread CrabbyPete
A message box is not a django thing. Its html. Look into creating a modal window in html. I do it a lot using javascript and ajax, but there are a lot simpler ways. On Mar 29, 5:10 am, djangodjango django wrote: > Hi all, > > Could someone please tell me how to create a Message Box using Django?

Re: mod_wsgi - two sites on apache

2011-03-26 Thread CrabbyPete
f you > have set NameVirtualHosts directive properly. > > Graham > > On Saturday, March 26, 2011 5:54:48 AM UTC+11, CrabbyPete wrote: > > > I am trying to run two sites on one server with apache. I created > > virtual hosts for each in my hpttd.conf file > > When I

mod_wsgi - two sites on apache

2011-03-25 Thread CrabbyPete
I am trying to run two sites on one server with apache. I created virtual hosts for each in my hpttd.conf file When I hit the first site everthing is fine. When I hit the second one I get an error. If I reload and switch the order in which I access the sites. The first one is fine the second one di

Re: How can I run my django project with django-social-auth?

2011-03-21 Thread CrabbyPete
Its an app that that gets installed into your project. What helped me understand how this works the best is to look at the pinax project. I didn't use the code but looking at it is a great way to learn. http://pinaxproject.com/ On Mar 21, 3:09 am, Su Yi Kyaing wrote: > Dear All! > > I want to c

static list in __init__

2011-02-26 Thread CrabbyPete
I have an application that initializes a larges static array in its __init__ I want to be able to access it from my views.py functions. What is the best way to do this? I know I can put it in memcache, or a database but it seems like an unnecessary over head. eg. __init__.py biglist = initialize

Re: Python/Django AMQP?

2011-02-25 Thread CrabbyPete
I just started looking at 0MQ it looks interesting http://zguide.zeromq.org/ On Feb 24, 11:58 am, Brian Bouterse wrote: > +1 for Celery and django-celery.  I use them also. > > On Thu, Feb 24, 2011 at 9:07 AM, Shawn Milochik wrote: > > +1 on Celery and django-celery. I use them both. > > > -- >

Re: How to reinstall Python Interpreters?

2011-02-19 Thread CrabbyPete
Ramirez suggested that I look at the site packages (in my case > > > dist-packages) in my python lib dir. > > > I did not see anything in there that references dajaxice.  I may need > > > to manually edit the PYTHONPATH once I figure out how and where. > > > >

Re: How to reinstall Python Interpreters?

2011-02-18 Thread CrabbyPete
I wouldn't reinstall python because of an unresolved import error. What's unresolved and what type of system are you on PC/Linux? On Feb 17, 7:48 pm, LJ wrote: > I installed the latest version of dajaxice, but I am still getting > Unresolved import errors. > My guess is that I need to remove and

forms and models

2011-02-04 Thread CrabbyPete
I have the following code: def sites(request): if 'url' in request.GET: url = request.GET['url'] website = WebSite.objects.get( url = url ) form = WebSiteForm(instance = website) return submit_web_form( request, form ) else: form = WebSiteForm(reque

Re: Facebook session problems.

2011-01-31 Thread CrabbyPete
Mon, Jan 31, 2011 at 2:59 PM, CrabbyPete wrote: > > I am loosing the django session. > > try setting the P3P on response: > response['P3P:CP'] = "IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi > HIS OUR IND CNT" > it probably wont help but it fixes th

Re: Facebook session problems.

2011-01-31 Thread CrabbyPete
I am loosing the django session. On Jan 31, 8:44 am, "christian.posta" wrote: > Which session are you losing? > The django authenticated session, or the facebook session? > > On Jan 29, 10:30 pm, CrabbyPete wrote: > > > > > > > > > I managed to l

Re: Facebook session problems.

2011-01-30 Thread CrabbyPete
Thanks, but no. I'm running it on Firefox now. On Jan 30, 3:43 pm, Aljoša Mohorović wrote: > On Sun, Jan 30, 2011 at 6:30 AM, CrabbyPete wrote: > > I log in and all is good except I loose the session if I go to another > > web site and come back. > > if this is facebo

Facebook session problems.

2011-01-29 Thread CrabbyPete
I managed to log into facebook using the graph api, I store the FB id and tie it to a User, like this class FacebookUser(models.Model): user= models.ForeignKey(User) fb_uid = models.CharField( max_length=100, blank = True, unique = True ) access_token= models.C

Re: django facebook authentication

2011-01-27 Thread CrabbyPete
Thanks I figured it out. I should just use request.path I used request.get_full_path() which returns the whole request including the ? code=xxx which messed me up. On Jan 26, 12:07 am, Matias Aguirre wrote: > Hi, > > Is your request.get_host() the same defined in Facebook app settings? (Web > s

Re: looking cheap Python/Django/mySQL hosting

2011-01-26 Thread CrabbyPete
http://www.asmallorange.com/ On Jan 26, 12:36 am, GSV wrote: > for small project. > > 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,

django facebook authentication

2011-01-25 Thread CrabbyPete
I am going nuts this should be simple but I keep getting a verification error every time in my response in the following code. I double checked my APP_ID and SECRET I try the following code. I'm using python2.5. Any help appreciated. def login( request ): parms = { 'client_id': settings.FACE

Pydev, decorators, and breakpoints

2011-01-03 Thread CrabbyPete
I use pydev to debug my python apps, but I can not break on a decorated function. Anyone know why and how to fix 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-us...@googlegroups.com. To unsubscri

Re: New to Django, sheet music organization site

2011-01-03 Thread CrabbyPete
Good Luck. Just start banging it out. You'll see as you go how much more there is. On Jan 1, 11:24 pm, Kyle wrote: > I am wanting to create an app that helps me organize sheet music. I > want to be able to sort by the artist. Every piece of sheet music I > have I want to be scanned in and uploade

Re: django and eclipse

2010-12-30 Thread CrabbyPete
You have to set up the run environment. Make sure on run manage.py and the parameters are runserver x.x.x.x:000 where x.x.x.x is the server and :000 is the port you want to run from. After that it should not ask anything and run off your settings. On Dec 29, 7:38 pm, Emmanuel Mayssat wrote: > I

Re: Fwd: Django in production on Windows

2010-12-03 Thread CrabbyPete
Windows is a great platform to work on. There are loads of tools and support for Windows. The issue is not Windows vs Linux the issue is Apache ( which works great on Windows ) v IIS. If your admin is wants to use Windows by all means stick with it, and just install Apache. I developed on Windows a

Re: Django in production on Windows

2010-12-02 Thread CrabbyPete
Does this mean that we shouldn't even try to run it on IIS7 in > production? > > On Dec 1, 4:27 pm, CrabbyPete wrote: > > > I developed Djano on a windows server and everything went smoothly > > except getting it to work with IIS. I loaded apache on windows and

Re: Django in production on Windows

2010-12-01 Thread CrabbyPete
I developed Djano on a windows server and everything went smoothly except getting it to work with IIS. I loaded apache on windows and it works great. On Dec 1, 6:43 am, ashdesigner wrote: > Hello, > > I am absolutely new to Python/Django. Being responsible for a large > corporate startup project

Re: JavaScript with Dango

2010-09-26 Thread CrabbyPete
Yes. On Sep 26, 7:48 am, aug dawg wrote: > Does Django work with JavaScript? If so, how can I use JavaScript in my > Django projects? -- 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...@googlegroup

Re: fixtures and dates

2010-09-25 Thread CrabbyPete
Thanks Shawn. I looked back in my model and found I left off something in my unicode. On Sep 24, 1:44 pm, Shawn Milochik wrote: > We need more information. Preferably the full traceback. > > In short, something is trying to add a date object to a unicode text > object. Possibly the date as a da

fixtures and dates

2010-09-24 Thread CrabbyPete
I have a spreadsheet of football games that I wanted to get into an sqlite3 database. I converted it to json, but when i loaded it I was required to put the date in -MM-DD format. So I changed it. The problem is now when I run the admin and look at the game I get this error TemplateSyntaxError

Re: Python/Django hosting

2010-07-29 Thread CrabbyPete
www.webfaction.com On Jul 29, 12:02 pm, kostia wrote: > We are PROJECTOR team. We have a web site, developed on Django / > Python. > > The site is temporarily launched with test data herehttp://kostia.pythonic.nl/ > > We are working with github herehttp://github.com/vaxXxa/projector > > The web s

Re: Dajax or Jquery

2010-07-12 Thread CrabbyPete
I never saw Dajax, but after reading I see it supports Jquery. I use mootools and Jquery and both are great. Dajax just seem to integrate them into django a little easier. On Jul 12, 6:36 am, Imad Elharoussi wrote: > Hi, > > I want to know what's the best plugin of Ajax to use with django Dajax

Re: insert html in html

2010-05-19 Thread CrabbyPete
Brian, Thanks. The safe filter worked for me. I was writing it to a file and then doing an {% include calendar %}, but your solution worked out. On May 18, 7:00 pm, Brian Neal wrote: > On May 18, 2:00 pm,CrabbyPete wrote: > > > I want to insert a html calendar into an existing web p

insert html in html

2010-05-18 Thread CrabbyPete
I want to insert a html calendar into an existing web page. What is the best way to insert html into a template that I have for the web page? -- 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...@googl

Re: Updating profiles

2010-05-11 Thread CrabbyPete
should be AUTH_PROFILE_MODULE = 'app_name.Profile' On May 11, 10:15 am, Bill Freeman wrote: > Is AUTH_PROFILE_MODULE set correctly in settings.py? > > > > On Tue, May 11, 2010 at 6:43 AM, django_jedi wrote: > > OK, I'm baffled.  I must be missing something right in front of my > > face... > > >

Re: Close window after download

2010-05-11 Thread CrabbyPete
Does anyone know how to track if a download completed? On May 6, 9:52 pm, CrabbyPete wrote: > I have code that generates a file for download. I want to close the > window after the user selects the download or even redirect them. > > Here is my code: > > response = HttpResp

Close window after download

2010-05-06 Thread CrabbyPete
I have code that generates a file for download. I want to close the window after the user selects the download or even redirect them. Here is my code: response = HttpResponse(cal.as_string(), mimetype='text/calendar') response['Content-Disposition'] = 'attachment; filename=schedule.ics' return re

Re: Email Field

2010-04-22 Thread CrabbyPete
Thanks. That helps. At least I know someone else is facing the same thing. On Apr 21, 2:20 pm, Tom Evans wrote: > On Wed, Apr 21, 2010 at 6:22 PM, CrabbyPete wrote: > > Yes, but my problem is its defined in contrib.auth.User with no > > length, which I assume defaults to 60.

Re: Email Field

2010-04-21 Thread CrabbyPete
; > On Apr 20, 5:00 pm,CrabbyPete wrote: > > > Where in the django.contrib is the models.EmailField defined? I have > > email address that are longer than 60 characters and I want to see if > > I can override it. > > > -- > > You received this message becau

Re: Running django on IIS

2010-04-21 Thread CrabbyPete
I tried for a while, and finally switched to Apache on Windows. It works great and easy to set up. On Apr 21, 6:29 am, Nick wrote: > Hiya > > I have exactly the same problem as described here. > > Did you (or anyone) find a fix or workaround for this? > > Cheers! > Nick. > > On Apr 14, 12:24 pm,

Email Field

2010-04-20 Thread CrabbyPete
Where in the django.contrib is the models.EmailField defined? I have email address that are longer than 60 characters and I want to see if I can override it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

facebook email

2010-04-08 Thread CrabbyPete
I am fooling around with the facebook api. Facebook gives you a proxy email address that is to big for the current User email field. Is there a way to extend this field, or should I use another field completely. -- You received this message because you are subscribed to the Google Groups "Django

decorators

2010-04-04 Thread CrabbyPete
I am using pyfacebook and when I run the debug server I get the following: C:\Python26\lib\site-packages\facebook\djangofb\__init__.py:185: DeprecationWarning: Calling the deprecated function 'new_wrapper' Downgrade to decorator 2.3 if you want to use this functionality return decorator.new_wrap

Re: auto authenticate

2010-03-26 Thread CrabbyPete
backend = backend >            if hasattr(user, 'backend'): >                  login(request, user) > > On 25 Mar, 18:27, CrabbyPete wrote:> I am connecting > facebook to an app I have running. In order not to > > change a load of code I created a dummy acco

auto authenticate

2010-03-25 Thread CrabbyPete
I am connecting facebook to an app I have running. In order not to change a load of code I created a dummy account when someone logs in through facebook. My only problem is I want to authenticate with this account when they log Is there a way to login in a user using the encrypted password. I am u

Re: Upload image file, resize using PIL, then save into ImageField - what to save to ImageField?

2010-03-19 Thread CrabbyPete
The Imagefile is just a pointer to file. Here is what I do to upload and resize an image. I hope it helps. file_to_open = settings.MEDIA_ROOT+'//profiles//'+ user.username+'-'+file.name fd = open(file_to_open, 'wb+') if file.multiple_chunks(): for chunk in file

Facebook Connect

2010-03-15 Thread CrabbyPete
I am trying to integrate pyfacebook into a existing project, and its driving me nuts. I just want users to be able to sign in with facebook. Anyone else try this and any recommendations. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: Subclassing Comments model

2010-02-25 Thread CrabbyPete
Sorry I did not finish. How do I get the subclass PictureComment, not Comment. On Feb 25, 4:13 pm, CrabbyPete wrote: > I subclassed the django comment app model, because I wanted to add > photos. > > class PictureComment( Comment ): >     photos          = models.ManyToM

Subclassing Comments model

2010-02-25 Thread CrabbyPete
I subclassed the django comment app model, because I wanted to add photos. class PictureComment( Comment ): photos = models.ManyToManyField(Photos) In my template I use {% get_comment_list for message as comment_list %} {% for comment in comment_list %} {% endfor %} and the lis

Authentication issue

2010-02-24 Thread CrabbyPete
I have code that allows an anonymous user to look at some elses page, but I want to limit what they can do so I have the following code def show(request): u = request.GET['friend'] user = User.objects.get(pk=u) visit = user.is_authenticated() visit should be false, but it keeps com

Custom button for imagefield form

2010-02-22 Thread CrabbyPete
I have form with where users can upload an image. All works well but I want a graphic instead of the default browse button that shows up. Can I change it and if so how do you change it in the form field or template? class ProfileForm(SignUpForm): mugshot = forms.ImageField (requ

Re: Javascript Modal Window

2010-02-10 Thread CrabbyPete
Thanks, but I was not clear in my question. If I use jQuery or any other javascript framework, to do a modal window from a link I have to load some html code that is the form Here is an example using thickbox in a template login In a view I load an html template with get_template() Do I do

Javascript Modal Window

2010-02-08 Thread CrabbyPete
I want to use greybox to show a login form. My question is what is the best way to do this? Here is the line I am using in m template Login Should I directly link to the form, or use {% url xxx %}, or is there something else I should do? Also can I send it back up if I get errors? Any advice much

Re: Complex query in model manager

2009-08-23 Thread CrabbyPete
or another words can I use a Q object in a model manager? On Aug 23, 12:05 am, CrabbyPete wrote: > I have the following code in model manager > > class SpotMessageManager(models.Manager): > >       def for_user(self, user, start = 0, end = None, friends ): >             mess

Complex query in model manager

2009-08-22 Thread CrabbyPete
I have the following code in model manager class SpotMessageManager(models.Manager): def for_user(self, user, start = 0, end = None, friends ): messages = self.filter(user = user).order_by ('date_added').reverse() ... friends is a list of users, and I want the quer

Adding errors

2009-08-04 Thread CrabbyPete
I want to return an error that a user was not found. I wanted to add the error and have it formatted using errorlist as happens with a required field. So I did the following lform._errors['username'] = ErrorList("User does not exist or wrong password") The result in lform.errors is ErrorDict:

Re: Template Question

2009-07-13 Thread CrabbyPete
n Jun 17, 1:53 pm, Ben Davis wrote: > > > > > Nope, you'll need to set a variable in your view.  You can also try creating > > your own filter such that {% if friend|is_in_group %}  would work (it's > > pretty easy to do, just check out the docs for custom template filters) &g

Template Question

2009-06-16 Thread CrabbyPete
Is there a way do something like this with the template system {% if friend in group.members.all %} or simply {% friend in group.members.all %} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Desperate Help needed. manage.py runserver no longer works.

2009-06-04 Thread CrabbyPete
I am new to django and I am running it on a Windows server. I installed mod_wsgi with Apache and go it to work, but now when I run python manage.py runserver. I get the error Error: Could not import settings 'spot.settings' (Is it on sys.path? Does it have syntax errors?): No module named setting

mod_wsgi manage.py

2009-06-03 Thread CrabbyPete
I wanted to see if I could deploy my project on Apache on a windows server using mod_wsgi. I got it working. The only problem is now I can not run the development environment using manage.py I am using Pyscripter and I now get this message every time I run manage.py Command Line : runserver --no

adding errors to forms

2009-05-22 Thread CrabbyPete
If I have a form and if form.is_valid is False The code code in the template {{ form.name.errors}} formats the error like this. This field is required. How do you add an error so it gets formatted with the surrounding html. If a user name already exists I want to add the error message 'User na

Python noob tuples question

2009-05-22 Thread CrabbyPete
I am trying to make a selector in a forms based on information in the database. The selector uses a tuple like this: PEOPLE = (('john','adams'),('sam','smith'),('john','doe'), ...) if I start a tuple with ( ('john","adams")) if I start with PEOPLE = (('john','adams')) how do I add the subs

Re: query reverse

2009-05-21 Thread CrabbyPete
Never mind I figured it out. On May 21, 10:42 am, CrabbyPete wrote: > I want to create a list of items from the most recently added to the > oldest. I tried this > message = Message.objects.reverse('date_added') > > It still returned the oldest items first. What is the

query reverse

2009-05-21 Thread CrabbyPete
I want to create a list of items from the most recently added to the oldest. I tried this message = Message.objects.reverse('date_added') It still returned the oldest items first. What is the best way to return the newest item first? --~--~-~--~~~---~--~~ You rece

Re: class for form fields

2009-05-11 Thread CrabbyPete
Thanks On May 11, 12:06 pm, David Zhou wrote: > On Mon, May 11, 2009 at 12:04 PM, CrabbyPete wrote: > > > I just started using forms and I have the following html > > Zip Code: > size="15" maxlength="15"> > > > How do you specify

  1   2   >