Django sessions not configuration issues for Heroku/Redis

2018-10-10 Thread jesse
Hello, I'm having issues with Django sessions on Heroku/Redis.

I expect to be able to login and stay logged in. Instead, user will 
continually be logged out and sessions do not persist.

I posted more details on Stack Overflow 
here: 
https://stackoverflow.com/questions/52535488/django-sessions-not-working-on-heroku-redis

I've seen others experiencing this same issue.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/427ef46d-7af8-49e0-ae82-0eca25dd8483%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django sessions configuration issues in production with Heroku/Redis

2018-10-10 Thread jesse
Hello, I'm having trouble configuring Django sessions to be persistent.

I expect a user to be able to log in on first try and then stay logged in. 
Currently, it takes multiple tries to login and then the user is logged 
out. Sessions are clearly not persisting.

I posted a bounty for this on Stack Overflow: 
https://stackoverflow.com/questions/52535488/django-sessions-not-working-on-heroku-redis

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0872b074-9451-49a4-ab1c-6081593c3eec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


extremely slow django migrations

2014-09-09 Thread Jesse Collier
Hi all,

First post here. I'm currently trying to transition to django migrations 
which seems pretty bad ass. We currently do not use south, and keep track 
of migrations manually (yuk). However, initializing a new database is 
pretty straight forward; syncdb. It's quick, and efficient. Once we created 
all our initial migration files, we are noticing extremely slow wall time 
initializing a database. I've tried profiling and tried various ways of 
cascading migration files and have fallen short of anything speedy. Has 
anyone else experienced this? Are there any caveats regarding speed?

Thanks in advance!
-Jesse

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba520c35-b7e1-4f14-b7da-f06bbacc39c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CSRF Token Help

2014-06-15 Thread Jesse Warden
How does the cookie get set initially? If you just make one login request, 
is it the first OPTIONS pre-flight that sets the cookie or is it ok to be 
null until you successfully login?

On Sunday, June 15, 2014 3:14:21 PM UTC-4, Andréas Kühne wrote:
>
> Hi Jesse,
>
> I can't remember where I saw it, but I found that the csrf token is added 
> as a cookie to the response, so it is always present on each response. In 
> my code I have an event handler (I'm using jquery to post) that looks like 
> the following:
>
> $(document).ajaxSend(function (event, jqxhr, settings) {
> jqxhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'));
> });
>
> So I just get the value of the cookie 'csrftoken' and add it to the 
> request header.
>
> You should be able to do the same (however I don't know dart).
>
> I don't think you should get the crsf token from another request, because 
> that should change (if I understand this correctly). Try getting the the 
> cookie, and ONLY adding it to the request header of your request, and not 
> to the form.
>
> Regards,
>
> Andréas
>
>
> 2014-06-15 20:57 GMT+02:00 Jesse Warden <jesse@gmail.com 
> >:
>
>> Yes, I've added the token in the cookie. Yes, I've added the cookie in 
>> the form post variable. Yes, I've added as a GET post variable. Yes, I've 
>> tried adding as a POST variable. Yes, I've set it to what the server sends 
>> back. Yes, I've set it to what the server-side sends back as a Cookie.
>>
>> ... none of it works.
>>
>> On Sunday, June 15, 2014 1:03:06 PM UTC-4, Renato Oliveira wrote:
>>>
>>> Since you've been trying for so long, may be a obvious answer, but have 
>>> you tried with this?
>>>
>>> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>>>
>>>  Renato Oliveira
>>> @_renatooliveira <http://twitter.com/_renatooliveira>
>>> Labcodes - www.labcodes.com.br
>>>
>>>  
>>>
>>> On Sun, Jun 15, 2014 at 11:38 AM, Jesse Warden <jesse@gmail.com> 
>>> wrote:
>>>
>>>> I've read the stack overflow posts, blog articles on how CSRF works, 
>>>> etc, but still failing to get this to work in both JavaScript and Dart. No 
>>>> matter what I try, I keep getting a 403 for my login method. I've 
>>>> attempted 
>>>> various Apache/Virtual Host programs for Mac to run a local domain in 
>>>> hopes 
>>>> it was just a localhost or browser security problem, all to no avail. I 
>>>> used to be able to disable web security on Chrome, but that doesn't seem 
>>>> to 
>>>> work anymore.
>>>>
>>>> Client Code:
>>>> https://github.com/JesterXL/workoutlogger/blob/master/client/
>>>> WorkoutLoggerDartAngular2/web/com/jessewarden/workoutlogger/
>>>> login/GetTokenService.dart
>>>>
>>>> https://github.com/JesterXL/workoutlogger/blob/master/client/
>>>> WorkoutLoggerDartAngular2/web/com/jessewarden/workoutlogger/
>>>> login/LoginService.dart
>>>>
>>>> Server Code:
>>>> https://github.com/JesterXL/workoutlogger/blob/master/
>>>> server/workoutlogger/workoutapi/views.py
>>>>
>>>> HTTP Responses:
>>>> https://gist.github.com/JesterXL/b7fb18f30e80e0156c98
>>>> https://gist.github.com/JesterXL/9c148016911622dfee66
>>>> https://gist.github.com/JesterXL/8cfd28edf6aebfe1afd4
>>>>
>>>> Thanks if you can help! 
>>>>
>>>> -- 
>>>> 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...@googlegroups.com.
>>>> To post to this group, send email to django...@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/django-users/8aa70895-afc4-41f7-865b-46fba033fff1%
>>>> 40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/django-users/8aa70895-afc4-41f7-865b-46fba033fff1%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
&

Re: CSRF Token Help

2014-06-15 Thread Jesse Warden
Yes, I've added the token in the cookie. Yes, I've added the cookie in the 
form post variable. Yes, I've added as a GET post variable. Yes, I've tried 
adding as a POST variable. Yes, I've set it to what the server sends back. 
Yes, I've set it to what the server-side sends back as a Cookie.

... none of it works.

On Sunday, June 15, 2014 1:03:06 PM UTC-4, Renato Oliveira wrote:
>
> Since you've been trying for so long, may be a obvious answer, but have 
> you tried with this?
>
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>
> Renato Oliveira
> @_renatooliveira <http://twitter.com/_renatooliveira>
> Labcodes - www.labcodes.com.br
>
>  
>
> On Sun, Jun 15, 2014 at 11:38 AM, Jesse Warden <jesse@gmail.com 
> > wrote:
>
>> I've read the stack overflow posts, blog articles on how CSRF works, etc, 
>> but still failing to get this to work in both JavaScript and Dart. No 
>> matter what I try, I keep getting a 403 for my login method. I've attempted 
>> various Apache/Virtual Host programs for Mac to run a local domain in hopes 
>> it was just a localhost or browser security problem, all to no avail. I 
>> used to be able to disable web security on Chrome, but that doesn't seem to 
>> work anymore.
>>
>> Client Code:
>>
>> https://github.com/JesterXL/workoutlogger/blob/master/client/WorkoutLoggerDartAngular2/web/com/jessewarden/workoutlogger/login/GetTokenService.dart
>>
>>
>> https://github.com/JesterXL/workoutlogger/blob/master/client/WorkoutLoggerDartAngular2/web/com/jessewarden/workoutlogger/login/LoginService.dart
>>
>> Server Code:
>>
>> https://github.com/JesterXL/workoutlogger/blob/master/server/workoutlogger/workoutapi/views.py
>>
>> HTTP Responses:
>> https://gist.github.com/JesterXL/b7fb18f30e80e0156c98
>> https://gist.github.com/JesterXL/9c148016911622dfee66
>> https://gist.github.com/JesterXL/8cfd28edf6aebfe1afd4
>>
>> Thanks if you can help! 
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/8aa70895-afc4-41f7-865b-46fba033fff1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/8aa70895-afc4-41f7-865b-46fba033fff1%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cad2f35a-3010-4843-be5a-0b0b07a91a03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


CSRF Token Help

2014-06-15 Thread Jesse Warden
I've read the stack overflow posts, blog articles on how CSRF works, etc, 
but still failing to get this to work in both JavaScript and Dart. No 
matter what I try, I keep getting a 403 for my login method. I've attempted 
various Apache/Virtual Host programs for Mac to run a local domain in hopes 
it was just a localhost or browser security problem, all to no avail. I 
used to be able to disable web security on Chrome, but that doesn't seem to 
work anymore.

Client Code:
https://github.com/JesterXL/workoutlogger/blob/master/client/WorkoutLoggerDartAngular2/web/com/jessewarden/workoutlogger/login/GetTokenService.dart

https://github.com/JesterXL/workoutlogger/blob/master/client/WorkoutLoggerDartAngular2/web/com/jessewarden/workoutlogger/login/LoginService.dart

Server Code:
https://github.com/JesterXL/workoutlogger/blob/master/server/workoutlogger/workoutapi/views.py

HTTP Responses:
https://gist.github.com/JesterXL/b7fb18f30e80e0156c98
https://gist.github.com/JesterXL/9c148016911622dfee66
https://gist.github.com/JesterXL/8cfd28edf6aebfe1afd4

Thanks if you can help! 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8aa70895-afc4-41f7-865b-46fba033fff1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem at activating the admin site (Django tutorial part 2)

2012-12-27 Thread Jesse Lopez
I have the same problem with the tutorial.  I went through the first part 
twice to ensure that I hadn't erred along the way.  I did nothing more than 
follow the tutorial https://docs.djangoproject.com/en/1.4/intro/tutorial01/ 
unlike the ticket posted above.

For context:
django-1.4.3
python-2.7.3
osx-10.7.5 

I've found other similar problems related to a lack of a Site object, but 
in my case I have:
In [5]: Site.objects.get(id=1)
Out[5]: 

Any potential solutions would be appreciated.

On Thursday, December 13, 2012 6:45:06 PM UTC-8, Karen Tracey wrote:
>
> Have you followed the tutorial exactly? I was unable to recreate this 
> problem when someone opened a trac ticket describing it:
>
> https://code.djangoproject.com/ticket/18308
>
> Another Django dev noted it was a duplicate of another ticket:
>
> https://code.djangoproject.com/ticket/18226
>
> where the problem seemed to be due to adding south as an app in the 
> tutorial rather than following the tutorial exactly.
>
> Karen
> -- 
> http://tracey.org/kmt/
>
>

-- 
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/-/mobA95Te-EsJ.
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: Billing and invoicing app?

2012-10-24 Thread Jesse Ramirez
Thanks! I really appreciate the help guys!

-- 
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: Billing and invoicing app?

2012-10-23 Thread Jesse Ramirez
Thanks Mike!

I tried djangopackages and didn't find anything.  I was wondering if anyone
had a package that they found useful that might be of some help in this
area.

On Tue, Oct 23, 2012 at 9:18 PM, Mike Dewhirst wrote:

> On 24/10/2012 1:08pm, Jesramz wrote:
>
>> Quick question, is there a good billing and invoicing app, that anyone
>> can point me to?
>>
>
> http://www.djangopackages.com/
>
>
>
>> Thanks all!
>>
>> --
>> 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/-/**cg8sQsl98K0J
>> .
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@**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+unsubscribe@**
> 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.



manage.py 'need more than 1 value to unpack' in is_library_missing

2012-06-16 Thread Jesse Crawford
Hello,
I'm new to Django. I'm setting up an existing app for development on 
Windows. In the past I've run in to an issue with this application refusing 
to run under Django 1.4 on Windows (it's primarily developed under 1.3 on 
Ubuntu), but I hacked a 1.4-type manage.py file (manage14.py) and added the 
application to the pythonpath and everything went fine. Now, on another 
machine, I can't get Manage14.py to run at all. I'm not sure what's going 
on here, I've included the output below. Thanks for any ideas!

Usage: manage14.py subcommand [options] [args]

Options:
  -v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, 
the
DJANGO_SETTINGS_MODULE environment variable will be
used.
  --pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
  --traceback   Print traceback on exception
  --version show program's version number and exit
  -h, --helpshow this help message and exit
Traceback (most recent call last):
  File ".\manage14.py", line 10, in 
execute_from_command_line(sys.argv)
  File "D:\Program 
Files\python27\lib\site-packages\django\core\management\__init__.py", line 
443, in execute_from_comma
nd_line
utility.execute()
  File "D:\Program 
Files\python27\lib\site-packages\django\core\management\__init__.py", line 
366, in execute
sys.stdout.write(self.main_help_text() + '\n')
  File "D:\Program 
Files\python27\lib\site-packages\django\core\management\__init__.py", line 
231, in main_help_text
for name, app in get_commands().iteritems():
  File "D:\Program 
Files\python27\lib\site-packages\django\core\management\__init__.py", line 
101, in get_commands
apps = settings.INSTALLED_APPS
  File "D:\Program 
Files\python27\lib\site-packages\django\utils\functional.py", line 184, in 
inner
self._setup()
  File "D:\Program 
Files\python27\lib\site-packages\django\conf\__init__.py", line 42, in 
_setup
self._wrapped = Settings(settings_module)
  File "D:\Program 
Files\python27\lib\site-packages\django\conf\__init__.py", line 93, in 
__init__
mod = importlib.import_module(self.SETTINGS_MODULE)
  File "D:\Program 
Files\python27\lib\site-packages\django\utils\importlib.py", line 35, in 
import_module
__import__(name)
  File "D:\epscor\teacherspet\settings.py", line 146, in 
if not import_library('apps.course.templatetags.course_url') in 
builtins:
  File "D:\Program 
Files\python27\lib\site-packages\django\template\base.py", line 1245, in 
import_library
if is_library_missing(taglib_module):
  File "D:\Program 
Files\python27\lib\site-packages\django\template\base.py", line 1229, in 
is_library_missing
return is_library_missing(path)
  File "D:\Program 
Files\python27\lib\site-packages\django\template\base.py", line 1229, in 
is_library_missing
return is_library_missing(path)
  File "D:\Program 
Files\python27\lib\site-packages\django\template\base.py", line 1229, in 
is_library_missing
return is_library_missing(path)
  File "D:\Program 
Files\python27\lib\site-packages\django\template\base.py", line 1224, in 
is_library_missing
path, module = name.rsplit('.', 1)
ValueError: need more than 1 value to unpack

-- 
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/-/Rjsioc9JQUMJ.
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 tutorial versions

2011-11-21 Thread Jesse Aldridge
Ah, yes, thanks.  Somehow I didn't notice the "dev" in the url.  FYI,
the dev version of the tutorial is the first link that comes up when
you google "django tutorial".

On Nov 21, 12:21 pm, Anoop Thomas Mathew <atm...@gmail.com> wrote:
> Hi,
> The tutorial you where following was dev version and the version you have
> installed is 1.3.1https://docs.djangoproject.com/en/1.3/intro/tutorial01/
> This would be helpful I guess.
>
> Thanks,
> Anoop
> atm
> ___
> Life is short, Live it hard.
>
> On 21 November 2011 23:28, Jesse Aldridge <jessealdri...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Looking at  https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> > When I run `django-admin.py startproject mysite`  I get a flat layout
> > rather than the nested layout the tutorial says I should see.
>
> > There's a note that says,
>
> > 'The default project layout recently changed. If you're seeing a
> > "flat" layout (with no inner mysite/ directory), you're probably using
> > a version of Django that doesn't match this tutorial version. You'll
> > want to either switch to the older tutorial or the newer Django
> > version.'
>
> > but it doesn't say which version of django is used in the tutorial I'm
> > reading or where to find tutorials for other versions of django.
> > These facts would be helpful.  I'm using django 1.3.1.
>
> > --
> > 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.



django tutorial versions

2011-11-21 Thread Jesse Aldridge
Looking at  https://docs.djangoproject.com/en/dev/intro/tutorial01/

When I run `django-admin.py startproject mysite`  I get a flat layout
rather than the nested layout the tutorial says I should see.

There's a note that says,

'The default project layout recently changed. If you're seeing a
"flat" layout (with no inner mysite/ directory), you're probably using
a version of Django that doesn't match this tutorial version. You'll
want to either switch to the older tutorial or the newer Django
version.'

but it doesn't say which version of django is used in the tutorial I'm
reading or where to find tutorials for other versions of django.
These facts would be helpful.  I'm using django 1.3.1.

-- 
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: AJAX + CSRF only works on Chrome, but not on Firefox and Safari.

2011-11-20 Thread Jesse Heitler
When I was debugging a similar problem the most helpful test I ran was
to isolate the problem to either the client or the browser by
configuring the server logs to show if the cookies we actually sent. I
did this by reconfiguring my Apache logs (I think), but I'm not sure
how to do that with the runserver. Maybe try testing on a more full-
featured server.

> I'm just running the website locally (localhost:8000) using
> "runserver" command.
> I set the Firefox preference to allow 127.0.0.1 cookies, but it still
> gives an 403 error.

And, an untested guess... perhaps Firefox does not consider 127.0.0.1
and localhost to be the same for the permission you set.

Good luck.

-Jesse

On Nov 17, 6:09 pm, Kyu <kyus...@berkeley.edu> wrote:
> @Jesse Heitler:
> I don't use an underscore in my domain name.
>
> @Tom Evans:
> I'm just running the website locally (localhost:8000) using
> "runserver" command.
> I set the Firefox preference to allow 127.0.0.1 cookies, but it still
> gives an 403 error.
>
> Thanks,
> Kyu
>
> On  Nov 17, 6:10 am, Tom Evans <tevans...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > On Thu, Nov 17, 2011 at 9:40 AM, Kyu <kyus...@berkeley.edu> wrote:
> > > Hi, I'm doing very basic AJAX operation using Django 1.3.1.
>
> > > 1) First of all, I copied the AJAX + CSRF snippet (https://
> > > docs.djangoproject.com/en/1.3/ref/contrib/csrf/#ajax) to my *.js file
> > > loded by the every HTML page.
>
> > > 2) HTML defines the subject, email, and message fields, but there's no
> > > form.
>
> > > 3) When the user clicks the submit button, jQuery.post(...) is
> > > triggered.
>
> > > 4) My ajax-view.py that receives the request from AJAX checks whether
> > > three inputs are valid and just sends {'success' : 'True'} json.
>
> > > At this point, 403 error occurs in Safari and Firefox for some reason
> > > while it works fine in Chrome.
> > > What's the problem with my approach? Thanks.
>
> > > Here's my views
>
> > > def sent_mail_view(request):
> > >    form = ContactForm(request.POST) # ContactForm extends forms.Model
> > > and Contact is Model.
> > >    if form.is_valid():
> > >        form.save();
> > >        response = simplejson.dumps({'success':'True'})
> > >    else:
> > >        response = simplejson.dumps({'success':'False'})
>
> > >    return HttpResponse(response,
> > >                        content_type='application/javascript;
> > > charset=utf-8')
>
> > > and Ajax post call:
> > > jQuery.post("/stores/sendmail/", emailinfo,
> > >                function(response) {
> > >                        if (response.success == "True") { ... }
> > >                }, "json");
>
> > The JS snippet only works if your browser accepts the cookies it is
> > sent. Are you serving the site from a different/illegal domain name
> > than your cookies are being set with?
>
> > Cheers
>
> > Tom

-- 
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: AJAX + CSRF only works on Chrome, but not on Firefox and Safari.

2011-11-17 Thread Jesse Heitler
This is a long shot, but do you happen to have an underscore in your
domain name? Some browsers choke on that character and refuse to
return cookies.

-Jesse

On Nov 17, 9:40 am, Kyu <kyus...@berkeley.edu> wrote:
> Hi, I'm doing very basic AJAX operation using Django 1.3.1.
>
> 1) First of all, I copied the AJAX + CSRF snippet (https://
> docs.djangoproject.com/en/1.3/ref/contrib/csrf/#ajax) to my *.js file
> loded by the every HTML page.
>
> 2) HTML defines the subject, email, and message fields, but there's no
> form.
>
> 3) When the user clicks the submit button, jQuery.post(...) is
> triggered.
>
> 4) My ajax-view.py that receives the request from AJAX checks whether
> three inputs are valid and just sends {'success' : 'True'} json.
>
> At this point, 403 error occurs in Safari and Firefox for some reason
> while it works fine in Chrome.
> What's the problem with my approach? Thanks.
>
> Here's my views
>
> def sent_mail_view(request):
>     form = ContactForm(request.POST) # ContactForm extends forms.Model
> and Contact is Model.
>     if form.is_valid():
>         form.save();
>         response = simplejson.dumps({'success':'True'})
>     else:
>         response = simplejson.dumps({'success':'False'})
>
>     return HttpResponse(response,
>                         content_type='application/javascript;
> charset=utf-8')
>
> and Ajax post call:
> jQuery.post("/stores/sendmail/", emailinfo,
>                 function(response) {
>                         if (response.success == "True") { ... }
>                 }, "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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: POST requests that don't send any data - Django development version 1.4.0 Alpha

2011-07-18 Thread Jesse Tane
Aha! I knew i was crazy :)  Thanks!

On Mon, Jul 18, 2011 at 7:49 PM, Venkatraman S  wrote:

> Are you missing to 'return' HttpResponse?
>
> -V
>
> --
> 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.



POST requests that don't send any data - Django development version 1.4.0 Alpha

2011-07-18 Thread Jesse
I'm not sure if this is a bug (though it probably is) and wanted to
review here before submitting a report. Consider the following
handler:


def test(req):
if req.method == "POST":
HttpResponse("the request was a POST")
else:
HttpResponse("the request was not a POST")


This works as long as the client doesn't send any data. However, if
any data is included in the request payload, the HttpResponse call
mysteriously fails and redirects to [origin]/internal_error.html which
in turn ends up as a 404 if you don't have such a page in your public
directory or a catch all handler.

Trying to catch this exception is impossible because the handler has
to call HttpResponse at some point. Since there is no way to control
whether the client decides to send data, (even if they shouldn't) this
appears to result in an un-handleable circumstance. Is this the
intended behavior, a bug or am I crazy for some other reason?

*An additional point of interest - changing the handler to access
req.POST anywhere before HttpResponse is called, even if the actual
data isn't processed or examined directly, seems to solve this problem.

-- 
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: Running tests automatically as you work.

2011-05-18 Thread Jesse Heitler
Another alternative automated test runner is nosyd. It provides a
similar service with notifications through Growl, etc and the ability
to monitor any number of projects simultaneously.

I've just started to maintain my fork at https://github.com/jesseh/nosyd

This original code is from https://github.com/lacostej who does not
seem to be maintaining it anymore.

-Jesse

On Apr 27, 10:58 pm, Shawn Milochik <sh...@milochik.com> wrote:
> http://dpaste.com/hold/536487/
>
> I cobbled this little script together that monitors my project folder
> and runs tests every time a .py file is saved. I'm sharing it in case
> anyone is interested. Feedback is welcome, of course.
>
> Interesting bits:
>
>      pyinotify: This module plugs into kernel notifications so you don't
> have to do something horrible like put os.walk in a loop.
>
>      call_command: Kenny Meyer pointed this out to me. It lets you run
> 'manage.py' commands from a Python 
> script.http://docs.djangoproject.com/en/dev/ref/django-admin/#running-manage...
>
>      SystemExit: When sys.exit() is called, you can't catch it with
> "except Exception," because it has a different base class.
>          Thanks to Alex Gaynor for helping me with this one.

-- 
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.



windows xp, python 2.6, mod_wsgi, apache 8.4, MySQL 5.1 - CSS not loading.

2010-09-11 Thread Jesse
Hello,
I've successfully implemented mod_wsgi with Apache on Windows XP using
MySQL 5.1.  Everything but the CSS/html for the index page is
working.  Even the admin pages are working with style sheets.  The
following is my code.  I cannot seem to find the error that is not
loading the CSS style sheets for the html pages.

http.conf file
< -- code start
Include "c:/django/apache/apache_django_wsgi.conf"


Order allow,deny
Allow from all


< -- code end

apache_django.wsgi file:

< -- code start
Alias /media/ "C:/Python26/Lib/site-packages/django/contrib/admin/
media/"

Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing



Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing



Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing



WSGIScriptAlias / "C:/django/apache/django.wsgi"

Alias /site_media/ "C:/django/mysite/site_media/"


Allow from all


< -- code end

django.wsgi:

< -- code start
import os, sys
sys.path.append("c:/django")
sys.path.append("c:/django/mysite")
# may be required :)
#sys.path.append('/path/to/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

< -- code end


settings file
< -- code start
MEDIA_ROOT = 'c:/django/mysite/site_media'
MEDIA_URL = 'http://www.myproject.org/mysite/site_media/'
ADMIN_MEDIA_PREFIX = 'http://www.myproject.org/media/'
TEMPLATE_DIRS = (
'C:/django/mysite/templates',
< -- code end

-- 
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: mod_wsgi, apache, windows XP

2010-09-02 Thread Jesse
I have django and postgres working on the local django server.  I had
to install psycopg2-2.2.2.win32-py2.7 in order for that to work.  I
don't believe I have access to an earlier version of psycopg.  Are you
using postgres?
Jesse

On Sep 2, 5:41 pm, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> On 3/09/2010 7:46am, Jesse wrote:
>
> > Hello Graham,
>
> > I have the c:/public/apache/apache_django_wsgi.conf working now, at
> > least apache restarts.  Do you know if mod_wsgi has a problem with
> > these versions:
> > python 2.7 and apache 2.2, and postgres 8.4, psycopg 2.2.2
>
> > My server error is:
>
> > TemplateSyntaxError: Caught ImproperlyConfigured while rendering:
> > 'django.db.backends.postgresql_psycopg2' isn't an available database
> > backend.
>
> I don't think it is a wsgi problem. This looks like you may not have
> installed psycopg2 on your server.
>
>
>
> > [Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] Try using
> > django.db.backends.XXX, where XXX is one of:
> > [Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1]     'dummy',
> > 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
> > [Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] Error was:
> > cannot import name utils
>
> > Thank you!
>
> > On Sep 2, 9:10 am, Jesse<adles...@gmail.com>  wrote:
> >> Thanks!  I did see the hello using the corrected localhost/myapp, so I
> >> at least know that I have the right version of mod_wsgi.  Now I'm back
> >> to my original problem.  The apache server will not restart when I add
> >> the following line to the http.conf file:
>
> >> Include "c:/public/apache/apache_django_wsgi.conf"
>
> >> which I place before the here:
> >> Include "c:/public/apache/apache_django_wsgi.conf"
> >> #WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"
>
> >> 
> >> Order allow,deny
> >> Allow from all
> >> 
>
> >> The apache_django_wsgi.conf file has the following:
> >> //start code
> >> Alias /media/ "c:/public/media/"
>
> >> 
> >> Order allow, deny
> >> Option Indexes
> >> Allow from all
> >> IndexOptions FancyIndexing
> >> 
>
> >> WSGIScriptAlias / "c:/public/apache/django.wsgi"
>
> >>  >> Order deny,allow
> >> Allow from all
> >> 
>
> >> //end code
>
> >> The error is Request operation failed.
>
> >> Thx for your help!!
>
> >> Jesse
> >> On Sep 1, 8:53 pm, Graham Dumpleton<graham.dumple...@gmail.com>
> >> wrote:
>
> >>> On Sep 2, 1:13 pm, Jesse<adles...@gmail.com>  wrote:
>
> >>>> I'm using Python 2.7, Apache 2.2 and grabbed the mod_wsgi that
> >>>> supposedly works.  I changed the name of the file to mod_wsgi and
> >>>> placed into Apache modules library.  I changed the folders, so the
> >>>> apache folder by itself and created the following in the apache
> >>>> http.conf file:
> >>>> WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"
>
> >>>> 
> >>>> Order allow,deny
> >>>> Allow from all
> >>>> 
>
> >>>> The myapp.wsgi is:
> >>>> def application(environ, start_response):
> >>>>      status = '200 OK'
> >>>>      output = 'Hello World!'
>
> >>>>      response_headers = [('Content-type', 'text/plain'),
> >>>>                          ('Content-Length', str(len(output)))]
> >>>>      start_response(status, response_headers)
>
> >>>>      return [output]
>
> >>>> Apache starts fine, no errors, but the localhost is still the original
> >>>> apache page and not hello world.
>
> >>> What URL are you using? Sounds like you are using:
>
> >>>  http://localhost
>
> >>> and not:
>
> >>>  http://localhost/myapp
>
> >>> Your WSGIScriptAlias has it mounted at sub URL not root of site which
> >>> is where standard Apache 'It Works' page would be found.
>
> >>> Graham
>
> >>>> On Sep 1, 4:25 pm, Graham Dumpleton<graham.dumple...@gmail.com>
> >>>> wrote:
>
> >>>>> On Sep 2, 4:46 am, Jesse<adles...@gmail.com>  wrote:
>
> >>>>>> created project using startproject testproject
>
> >>>>>> Problems with apache_django_wsgi.co

Re: mod_wsgi, apache, windows XP

2010-09-02 Thread Jesse
Hello Graham,

I have the c:/public/apache/apache_django_wsgi.conf working now, at
least apache restarts.  Do you know if mod_wsgi has a problem with
these versions:
python 2.7 and apache 2.2, and postgres 8.4, psycopg 2.2.2

My server error is:

TemplateSyntaxError: Caught ImproperlyConfigured while rendering:
'django.db.backends.postgresql_psycopg2' isn't an available database
backend.
[Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] Try using
django.db.backends.XXX, where XXX is one of:
[Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] 'dummy',
'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] Error was:
cannot import name utils

Thank you!

On Sep 2, 9:10 am, Jesse <adles...@gmail.com> wrote:
> Thanks!  I did see the hello using the corrected localhost/myapp, so I
> at least know that I have the right version of mod_wsgi.  Now I'm back
> to my original problem.  The apache server will not restart when I add
> the following line to the http.conf file:
>
> Include "c:/public/apache/apache_django_wsgi.conf"
>
> which I place before the here:
> Include "c:/public/apache/apache_django_wsgi.conf"
> #WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"
>
> 
> Order allow,deny
> Allow from all
> 
>
> The apache_django_wsgi.conf file has the following:
> //start code
> Alias /media/ "c:/public/media/"
>
> 
> Order allow, deny
> Option Indexes
> Allow from all
> IndexOptions FancyIndexing
> 
>
> WSGIScriptAlias / "c:/public/apache/django.wsgi"
>
>  Order deny,allow
> Allow from all
> 
>
> //end code
>
> The error is Request operation failed.
>
> Thx for your help!!
>
> Jesse
> On Sep 1, 8:53 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> wrote:
>
>
>
> > On Sep 2, 1:13 pm, Jesse <adles...@gmail.com> wrote:
>
> > > I'm using Python 2.7, Apache 2.2 and grabbed the mod_wsgi that
> > > supposedly works.  I changed the name of the file to mod_wsgi and
> > > placed into Apache modules library.  I changed the folders, so the
> > > apache folder by itself and created the following in the apache
> > > http.conf file:
> > > WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"
>
> > > 
> > > Order allow,deny
> > > Allow from all
> > > 
>
> > > The myapp.wsgi is:
> > > def application(environ, start_response):
> > >     status = '200 OK'
> > >     output = 'Hello World!'
>
> > >     response_headers = [('Content-type', 'text/plain'),
> > >                         ('Content-Length', str(len(output)))]
> > >     start_response(status, response_headers)
>
> > >     return [output]
>
> > > Apache starts fine, no errors, but the localhost is still the original
> > > apache page and not hello world.
>
> > What URL are you using? Sounds like you are using:
>
> >  http://localhost
>
> > and not:
>
> >  http://localhost/myapp
>
> > Your WSGIScriptAlias has it mounted at sub URL not root of site which
> > is where standard Apache 'It Works' page would be found.
>
> > Graham
>
> > > On Sep 1, 4:25 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> > > wrote:
>
> > > > On Sep 2, 4:46 am, Jesse <adles...@gmail.com> wrote:
>
> > > > > created project using startproject testproject
>
> > > > > Problems with apache_django_wsgi.conf
> > > > > 1.  Added following line toApache:
> > > > > LoadModule wsgi_module modules/mod_wsgi.so
>
> > > > > 2. Created folder c:/django/testproject/apache
>
> > > > > 3.  Created file c:/django/testproject/apache/django.wsgi
> > > > > // code starts
> > > > > import os, sys
> > > > > sys.path.append("/c:/django")
>
> > > > All your paths where you have '/c:' instead of just 'c:' are wrong to
> > > > start with.
>
> > > > > os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
>
> > > > > import django.core.handlers.wsgi
>
> > > > > application = django.core.handlers.wsgi.WSGIHandler()
> > > > > // code ends
>
> > > > > 4.  Apachestarts and restarts. local host is originalapache"It
> > > > > works"
>
> > > > > 5.  Created file c:/django/testproject/apache_django_wsgi.conf
> > > > > //code starts
> > > > > Alias /media/ /c:/django/testproject/media/
>
>

Re: mod_wsgi, apache, windows XP

2010-09-02 Thread Jesse
Thanks!  I did see the hello using the corrected localhost/myapp, so I
at least know that I have the right version of mod_wsgi.  Now I'm back
to my original problem.  The apache server will not restart when I add
the following line to the http.conf file:

Include "c:/public/apache/apache_django_wsgi.conf"

which I place before the here:
Include "c:/public/apache/apache_django_wsgi.conf"
#WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"


Order allow,deny
Allow from all


The apache_django_wsgi.conf file has the following:
//start code
Alias /media/ "c:/public/media/"


Order allow, deny
Option Indexes
Allow from all
IndexOptions FancyIndexing


WSGIScriptAlias / "c:/public/apache/django.wsgi"



//end code

The error is Request operation failed.

Thx for your help!!

Jesse
On Sep 1, 8:53 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Sep 2, 1:13 pm, Jesse <adles...@gmail.com> wrote:
>
>
>
>
>
> > I'm using Python 2.7, Apache 2.2 and grabbed the mod_wsgi that
> > supposedly works.  I changed the name of the file to mod_wsgi and
> > placed into Apache modules library.  I changed the folders, so the
> > apache folder by itself and created the following in the apache
> > http.conf file:
> > WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"
>
> > 
> > Order allow,deny
> > Allow from all
> > 
>
> > The myapp.wsgi is:
> > def application(environ, start_response):
> >     status = '200 OK'
> >     output = 'Hello World!'
>
> >     response_headers = [('Content-type', 'text/plain'),
> >                         ('Content-Length', str(len(output)))]
> >     start_response(status, response_headers)
>
> >     return [output]
>
> > Apache starts fine, no errors, but the localhost is still the original
> > apache page and not hello world.
>
> What URL are you using? Sounds like you are using:
>
>  http://localhost
>
> and not:
>
>  http://localhost/myapp
>
> Your WSGIScriptAlias has it mounted at sub URL not root of site which
> is where standard Apache 'It Works' page would be found.
>
> Graham
>
>
>
>
>
> > On Sep 1, 4:25 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> > wrote:
>
> > > On Sep 2, 4:46 am, Jesse <adles...@gmail.com> wrote:
>
> > > > created project using startproject testproject
>
> > > > Problems with apache_django_wsgi.conf
> > > > 1.  Added following line toApache:
> > > > LoadModule wsgi_module modules/mod_wsgi.so
>
> > > > 2. Created folder c:/django/testproject/apache
>
> > > > 3.  Created file c:/django/testproject/apache/django.wsgi
> > > > // code starts
> > > > import os, sys
> > > > sys.path.append("/c:/django")
>
> > > All your paths where you have '/c:' instead of just 'c:' are wrong to
> > > start with.
>
> > > > os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
>
> > > > import django.core.handlers.wsgi
>
> > > > application = django.core.handlers.wsgi.WSGIHandler()
> > > > // code ends
>
> > > > 4.  Apachestarts and restarts. local host is originalapache"It
> > > > works"
>
> > > > 5.  Created file c:/django/testproject/apache_django_wsgi.conf
> > > > //code starts
> > > > Alias /media/ /c:/django/testproject/media/
>
> > > > 
> > > > Order deny,allow
> > > > Allow from all
> > > > 
>
> > > > WSGIScriptAlias / /c:/django/testproject/apache/django.wsgi
>
> > > > 
> > > > Order deny,allow
> > > > Allow from all
> > > > 
> > > > //code ends
>
> > > > 6.  Added following line toApachehttp.conf
> > > > Include "c:/django/testproject/apache/apache_django_wsgi.conf"
>
> > > > 7.  Apacheerror, cannot restart.
>
> > > > Any help is much appreciated.
>
> > > Does theApacheerror log have anything in it?
>
> > > WhichApacheversion? Which Python version? Which mod_wsgi object did
> > > you grab, or did you compile from source code?
>
> > > Are you trying to run 64bitWindows?
>
> > > BTW, recommended to test first with a WSGI hello world program and not
> > > Django.
>
> > > See hello world example in:
>
> > >  http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
>
> > > 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.



Re: mod_wsgi, apache, windows XP

2010-09-01 Thread Jesse
I'm using Python 2.7, Apache 2.2 and grabbed the mod_wsgi that
supposedly works.  I changed the name of the file to mod_wsgi and
placed into Apache modules library.  I changed the folders, so the
apache folder by itself and created the following in the apache
http.conf file:
WSGIScriptAlias /myapp "c:/public/apache/myapp.wsgi"


Order allow,deny
Allow from all


The myapp.wsgi is:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'

response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)

return [output]

Apache starts fine, no errors, but the localhost is still the original
apache page and not hello world.
Jesse

On Sep 1, 4:25 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Sep 2, 4:46 am, Jesse <adles...@gmail.com> wrote:
>
> > created project using startproject testproject
>
> > Problems with apache_django_wsgi.conf
> > 1.  Added following line toApache:
> > LoadModule wsgi_module modules/mod_wsgi.so
>
> > 2. Created folder c:/django/testproject/apache
>
> > 3.  Created file c:/django/testproject/apache/django.wsgi
> > // code starts
> > import os, sys
> > sys.path.append("/c:/django")
>
> All your paths where you have '/c:' instead of just 'c:' are wrong to
> start with.
>
>
>
>
>
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
>
> > import django.core.handlers.wsgi
>
> > application = django.core.handlers.wsgi.WSGIHandler()
> > // code ends
>
> > 4.  Apachestarts and restarts. local host is originalapache"It
> > works"
>
> > 5.  Created file c:/django/testproject/apache_django_wsgi.conf
> > //code starts
> > Alias /media/ /c:/django/testproject/media/
>
> > 
> > Order deny,allow
> > Allow from all
> > 
>
> > WSGIScriptAlias / /c:/django/testproject/apache/django.wsgi
>
> > 
> > Order deny,allow
> > Allow from all
> > 
> > //code ends
>
> > 6.  Added following line toApachehttp.conf
> > Include "c:/django/testproject/apache/apache_django_wsgi.conf"
>
> > 7.  Apacheerror, cannot restart.
>
> > Any help is much appreciated.
>
> Does theApacheerror log have anything in it?
>
> WhichApacheversion? Which Python version? Which mod_wsgi object did
> you grab, or did you compile from source code?
>
> Are you trying to run 64bitWindows?
>
> BTW, recommended to test first with a WSGI hello world program and not
> Django.
>
> See hello world example in:
>
>  http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
>
> 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.



mod_wsgi, apache, windows XP

2010-09-01 Thread Jesse
created project using startproject testproject

Problems with apache_django_wsgi.conf
1.  Added following line to Apache:
LoadModule wsgi_module modules/mod_wsgi.so

2. Created folder c:/django/testproject/apache

3.  Created file c:/django/testproject/apache/django.wsgi
// code starts
import os, sys
sys.path.append("/c:/django")

os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()
// code ends

4.  Apache starts and restarts. local host is original apache "It
works"

5.  Created file c:/django/testproject/apache_django_wsgi.conf
//code starts
Alias /media/ /c:/django/testproject/media/


Order deny,allow
Allow from all


WSGIScriptAlias / /c:/django/testproject/apache/django.wsgi


Order deny,allow
Allow from all

//code ends

6.  Added following line to Apache http.conf
Include "c:/django/testproject/apache/apache_django_wsgi.conf"

7.  Apache error, cannot restart.

Any help is much appreciated.
Jesse

-- 
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.



What replaced mod_python

2010-08-27 Thread Jesse
I'm trying to load django/python 27/apache onto Windows XP.  I'm
following the instructions that recommends mod_python.  Mod_python is
no longer available.  What is it's replacement?  Will apache work
without it?
Jesse

-- 
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: mod_python, apache and django

2010-08-27 Thread Jesse
Do I not need it to run Apache on Windows with Django?  Or what is the
alternative?  This is the 5th server I've set up and I've always used
mod_python until now.  How do I get past this mod_python step?
Jesse

On Aug 27, 2:16 pm, Steve Holden <holden...@gmail.com> wrote:
> On 8/27/2010 3:21 PM, Jesse wrote:> I'm loading django onto Windows XP 
> professional with Apache.
> > Unfortunately, I need mod_python which only works with python 2.3.
> > Django needs python 2.4 and above.  Is there a way around this?
> > Thx
>
> Stop needing mod_python? It's obsolete now.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
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.



mod_python, apache and django

2010-08-27 Thread Jesse
I'm loading django onto Windows XP professional with Apache.
Unfortunately, I need mod_python which only works with python 2.3.
Django needs python 2.4 and above.  Is there a way around this?
Thx

-- 
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.



adding foreign key attributes to the admin editing screen

2010-04-26 Thread Jesse
Table LOINCCode has loinc_obr4 (a number) and a description field
(describing the number).

Model Statement:
Class StandardCode(models.Model):
  loinc_obr4 = models.ForeignKey(LOINCCode, null=True, default=1,
related_name='loinccodeobr4')

In the Admin:
fieldsets =[
   (None,  {'fields': [('loinc_obr4')]})
   ]

The admin template shows the loinc_obr4 field, but I need the
description to also appear with the loinc_obr4.  How do I expand the
foreign key in the admin to add more attributes in the drop down?
ACCESS has this capability when creating a combo box.

Thx,

Jesse

-- 
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: GenericForeignKey with content_type in a related model ???

2009-11-05 Thread Jesse Legg

You won't be able to use a GenericForeignKey in this situation, but
you could write a helper method and define a property to affect
something similar. For example:

class ModelTwo(models):
   model_one = models.ForeignKey(ModelOne)
   object_id = models.PositiveIntegerField()

   def get_content_object(self):
  return self.model_one.content_type.get_object_for_this_type
(id=self.object_id)
   content_object = property(get_content_object)

The difference between this and a GenericForeignKey is that you will
not be able to create ModelTwo objects and specify a content_object in
the constructor. Ie. none of this:

obj = ModelTwo(content_object=some_object)


On Nov 5, 11:25 am, bruno desthuilliers
 wrote:
> I have this pattern:
>
> class ModelOne(models):
>     content_type = models.ForeignKey(ContentType)
>
> class ModelTwo(models):
>     model_one = models.ForeignKey(ModelOne)
>     object_id = models.PositiveIntegerField()
>
> And I'd like to have a 'content_object' GenericForeignKey (or anything
> with a close enough behaviour) in ModelTwo. From a quick glance at the
> implementation of GenericForeignKey, it looks that 1/ it won't just
>
> So the question, obviously, is "did anyone here had the same use case,
> and if yes how did you solve it" ? FWIW, I googled for
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Releasing django-calais v0.2

2009-10-05 Thread Jesse Legg

I've finally posted a reusable django project I've been working on
called django-calais. It is a full interface to the Open Calais
semantic web API. It lets you pass any Django model to the Calais
service for semantic analysis and stores the results for future use
sorting, slicing, etc.

Here's the link to the Google Code project:
http://code.google.com/p/django-calais/

Would love to hear what you all think. Thanks!
- Jesse Legg

--~--~-~--~~~---~--~~
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: Creating Model with ManyToMany relationship from PyAMF & Flex

2009-07-14 Thread Jesse Warden
Nevermind, found this:
http://www.djangoproject.com/documentation/models/many_to_many/

And got it working.  woo WOOO!!!

On Tue, Jul 14, 2009 at 2:28 PM, Jesse Warden <jesse.war...@gmail.com>wrote:

> n00b here.  I'd like to create a complex Model from a Flex Object
> (basically decoded JSON).  I've created a Model successfully already, but am
> unsure how to do this with the multiple Models that have ManyToMany
> relationships with each other.
> This works:
>
> def create_power(request, powerObj):
> try:
> p = Power()
>  p.name = powerObj.name
> p.level = powerObj.level
>  p.save()
> ...
>
>
> However, I'd like to create the other models too.  Psuedo structure:
>
> class PowerSource(models.Model):
> label = models.CharField(max_length=200)
> power = models.ManyToManyField(Power)
>
> What would the code look like... maybe like this?
>
> ps = PowerSource()
> ps.label = powerObj.powerSource.label;
> ps.power = p;
> ps.save()
>
> Thanks if you can 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating Model with ManyToMany relationship from PyAMF & Flex

2009-07-14 Thread Jesse Warden
n00b here.  I'd like to create a complex Model from a Flex Object (basically
decoded JSON).  I've created a Model successfully already, but am unsure how
to do this with the multiple Models that have ManyToMany relationships with
each other.
This works:

def create_power(request, powerObj):
try:
p = Power()
p.name = powerObj.name
p.level = powerObj.level
p.save()
...


However, I'd like to create the other models too.  Psuedo structure:

class PowerSource(models.Model):
label = models.CharField(max_length=200)
power = models.ManyToManyField(Power)

What would the code look like... maybe like this?

ps = PowerSource()
ps.label = powerObj.powerSource.label;
ps.power = p;
ps.save()

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



select size box error

2009-05-30 Thread Jesse

I have three drop down select boxes, which I have to expand for web
visibility reasons with the size='' option.  If I select one from each
box I receive no errors, but if I leave one or more boxes without a
selection I receive an error.

 
{% for pathology in pathology_list %}
{{ pathology.pathology }}
{% endfor %}


 
{% for commodity in commodity_list %}
{{ commodity.commodity }}
{% endfor %}



{% for technology in technology_list %}
{{ technology.technology }}
{% endfor %}


ERROR:
MultiValueDictKeyError
Exception Value:

"Key 'pathology_id' not found in http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: filter date in view.py

2009-05-30 Thread Jesse

Hello Derek,

The grantstartdt field has a date format, the Year field (drop down)
is a list of years in  format, but the field is character.  I need
to parse the  from the date field to match the  of the Year
value.  When I changed the code as you suggested I received this
error:


date/time field value out of range: "30-01-01 00:00:00"
HINT:  Perhaps you need a different "datestyle" setting.


On May 29, 5:37 pm, Derek Willis <dwil...@gmail.com> wrote:
> When you use grantstartdt__year in your filter, it's looking for an
> integer, not an instance of your Year model, which is what you have in
> your view. So, assuming the pk attribute in Year is an integer, you'd
> change your line to something like this:
>
> projectyr=Researchproject.objects.exclude(activeyesno = 2).filter
> (grantstartdt__year=yr.pk)
>
> Which should do the trick. Alternately you could use year_id if you
> don't need your Year model for the template.
>
> Derek
>
> On May 29, 3:33 pm, Jesse <adles...@gmail.com> wrote:
>
> > Hello,
>
> > year_id (2004 etc) is a dropdown box on the template.  The users
> > selects a year and this is retrieved as year_id in the view.  I need
> > to select publications based on year from a field called grantstartdt
> > which is in the format 2008-01-01.  The error is:
>
> > int() argument must be a string or a number, not 'Year'
>
> >     year_id = request.GET['year_id']
> >     yr = get_object_or_404(Year, pk=year_id)
> >     projectyr=Researchproject.objects.exclude(activeyesno = 2).filter
> > (grantstartdt__year=yr)
>
> > Thank you for any assistance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



filter date in view.py

2009-05-29 Thread Jesse

Hello,

year_id (2004 etc) is a dropdown box on the template.  The users
selects a year and this is retrieved as year_id in the view.  I need
to select publications based on year from a field called grantstartdt
which is in the format 2008-01-01.  The error is:

int() argument must be a string or a number, not 'Year'

year_id = request.GET['year_id']
yr = get_object_or_404(Year, pk=year_id)
projectyr=Researchproject.objects.exclude(activeyesno = 2).filter
(grantstartdt__year=yr)

Thank you for any assistance!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django-cms admin template format off

2009-05-20 Thread Jesse

I installed django-cms with Apache/windows.  Pages comes up under the
admin menu.  I can also see new pages I added.  When I open the new
page the formatting is off.  The add content to template is hiding
behind the info window (dates, times, etc).  I'm not sure how to fix
this formatting problem?  Thx for any 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: http://127.0.0.1:8000/admin/admin/logout/ (duplicate admin)

2009-05-19 Thread Jesse

Thanks!  I'm in the middle of reloading everything again, because I
thought it was something I had done.  Good to know that wasn't the
case and glad they are working on it.
Thanks, again!

On May 19, 11:11 am, Reiner <mr.squ...@googlemail.com> wrote:
> I stumbled across this bug too some days ago, it is already known and
> being worked on, it is one of the tickets that need to be fixed in
> order to ship django 1.1.
>
> http://code.djangoproject.com/ticket/10061
>
> If you need a quick fix, have a look at the comment by 
> carljm:http://code.djangoproject.com/ticket/10061#comment:23
>
> On May 19, 7:57 pm, Jesse <adles...@gmail.com> wrote:
>
> > I'm setting up a new server with Apache/mod_python on windows.  I can
> > see my data on the admin page, but when I log out it is logging out
> > with two admin/admin and I get an error page not found.  I cannot
> > figure out why this is happening?
> > Thx
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



http://127.0.0.1:8000/admin/admin/logout/ (duplicate admin)

2009-05-19 Thread Jesse

I'm setting up a new server with Apache/mod_python on windows.  I can
see my data on the admin page, but when I log out it is logging out
with two admin/admin and I get an error page not found.  I cannot
figure out why this is happening?
Thx
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



override the cms_urls in django-cms

2009-05-15 Thread Jesse

Hello,

I've successfully implemented django-cms with tinymce for all my
webpages.  My problem is that one of the webpages must retrieve data
from the database into drop down boxes.  The template is called
search_globaldb.  The cms forces the url to look for this template in
the cms database table.  I need the url to look for this template in
my template directory, so the url can send a request to view.py to get
data from the database to populate the drop down boxes in the
search_globaldb template.
--~--~-~--~~~---~--~~
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: flatpage content not appearing

2009-05-12 Thread Jesse

Now I get all kinds of 404 errors.  I guess I'm missing something in
my understanding of flatpages.  I was going to place all my html pages
into flatpages, including the home page.  How does all that work
without using URLs and views?

On May 12, 10:42 am, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On May 12, 6:13 pm, Jesse <adles...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > I'm using tiny_mce with flatpages in the admin.  I can get the
> > template to appear with the extended CSS, but not the flatpage
> > contents of the page.
> > My flatpage in admin is:
> > URL:  /
> > Content:  much text that is not appearing in the template.
>
> > The template:
> > ...templates/flatpages/default.html:
> > {% extends "base.html" %}
> > {{ flatpage.content }}
>
> > url.py
> >     (r'^$', default),
>
> > View.py
> > def default(request):
> >   return render_to_response('default.html', RequestContext(request))
>
> > What am I missing?  Thx
>
> You're defining a view that renders a template, but don't pass any
> context to it, so naturally it is not populated.
>
> If you want to use flatpages, you don't define a view - the flatpage
> renderer is called when the URL is not found in urls.py. So delete the
> 'default' view from your urls and views, and it should work.
> --
> 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-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
-~--~~~~--~~--~--~---



flatpage content not appearing

2009-05-12 Thread Jesse

Hello,

I'm using tiny_mce with flatpages in the admin.  I can get the
template to appear with the extended CSS, but not the flatpage
contents of the page.
My flatpage in admin is:
URL:  /
Content:  much text that is not appearing in the template.

The template:
...templates/flatpages/default.html:
{% extends "base.html" %}
{{ flatpage.content }}

url.py
(r'^$', default),

View.py
def default(request):
  return render_to_response('default.html', RequestContext(request))

What am I missing?  Thx
--~--~-~--~~~---~--~~
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-cms and flatpages with tiny_mce path problem

2009-05-07 Thread Jesse

Hello,

The thread link didn't go through.

On May 7, 12:25 pm, branesks <brane...@gmail.com> wrote:
> Follow this thread.
>
> Sent from my iPhone
>
> On May 7, 2009, at 12:09, Jesse <adles...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > I've implemented both django-cms and flatpages, but can not get
> > tiny_mce to display in either.  My
>
> > URLs.py file:
> >    (r'^tinymce/', include('tinymce.urls')),
>
> > from django.conf import settings
> > if settings.DEBUG:
> >    urlpatterns += patterns('',
> >    (r'^site_media/(?P.*)$', 'django.views.static.serve',
> >            {'document_root': settings.MEDIA_ROOT}),
> > )
>
> > SETTINGS.py
>
> > TINYMCE_JS_URL = 'http://127.0.0.1:8000/site_media/js/tiny_mce/
> > tiny_mce.js'
> > TINYMCE_JS_ROOT = 'http://127.0.0.1:8000/site_media/js/tinymce/'
> > TINYMCE_DEFAULT_CONFIG = {
> >   'plugins': "table,spellchecker,paste,searchreplace",
> >   'theme': "advanced",
> >    'cleanup_on_startup': True,
> >    'custom_undo_redo_levels': 10,
> > }
> > TINYMCE_SPELLCHECKER = False
> > TINYMCE_COMPRESSOR = False
> > TINYMCE_FILEBROWSER = True
> > CMS_USE_TINYMCE = True
>
> > ADMIN.py
> > from django.contrib.flatpages.models import FlatPage
> > from django.contrib.flatpages.admin import FlatPageAdmin
> > #Flatpages
> > class FlatPageAdmin(FlatPageAdmin):
> >    class Media:
> >        js = ('http://127.0.0.1:8000/js/tiny_mce/tiny_mce.js',
> >              'http://127.0.0.1:8000/js/tiny_mce/textareas.js',)
>
> > # We have to unregister it, and then reregister
> > admin.site.unregister(FlatPage)
> > admin.site.register(FlatPage, FlatPageAdmin)
> > #django-cms
> > from myprograms.cms.models import Page
> > class PageOptions(admin.ModelAdmin):
> >    class Media:
> >        js = ('http://127.0.0.1:8000/site_media/js/tiny_mce/
> > tiny_mce.js', 'http://127.0.0.1:8000/site_media/js/tiny_mce/
> > textareas.js')
> > #admin.site.register(Page, PageOptions)
>
> > In the base.html file
> > 
> > 

django-cms and flatpages with tiny_mce path problem

2009-05-07 Thread Jesse

Hello,

I've implemented both django-cms and flatpages, but can not get
tiny_mce to display in either.  My

URLs.py file:
(r'^tinymce/', include('tinymce.urls')),

from django.conf import settings
if settings.DEBUG:
urlpatterns += patterns('',
(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)

SETTINGS.py

TINYMCE_JS_URL = 'http://127.0.0.1:8000/site_media/js/tiny_mce/
tiny_mce.js'
TINYMCE_JS_ROOT = 'http://127.0.0.1:8000/site_media/js/tinymce/'
TINYMCE_DEFAULT_CONFIG = {
   'plugins': "table,spellchecker,paste,searchreplace",
   'theme': "advanced",
'cleanup_on_startup': True,
'custom_undo_redo_levels': 10,
}
TINYMCE_SPELLCHECKER = False
TINYMCE_COMPRESSOR = False
TINYMCE_FILEBROWSER = True
CMS_USE_TINYMCE = True

ADMIN.py
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin
#Flatpages
class FlatPageAdmin(FlatPageAdmin):
class Media:
js = ('http://127.0.0.1:8000/js/tiny_mce/tiny_mce.js',
  'http://127.0.0.1:8000/js/tiny_mce/textareas.js',)

# We have to unregister it, and then reregister
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)
#django-cms
from myprograms.cms.models import Page
class PageOptions(admin.ModelAdmin):
class Media:
js = ('http://127.0.0.1:8000/site_media/js/tiny_mce/
tiny_mce.js', 'http://127.0.0.1:8000/site_media/js/tiny_mce/
textareas.js')
#admin.site.register(Page, PageOptions)

In the base.html file



There are so many different options when accessing the various user
groups, docs, etc.  I'm not sure what is the correct syntax.  The CMS
doesn't do me much good without some kind of text editor.
Thx
--~--~-~--~~~---~--~~
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: tinymce not displaying on admin template

2009-05-05 Thread Jesse

Hello Zain,

Thanks for noticing that.  I keep moving the files around hoping
something will connect.  However, even correcting this error I still
don't see the tinymce in the admin template.  Everything works, I'm
just not able to edit with an easy editing tool.  This is the script
in my template:

http://127.0.0.1:8000/site_media/</a>
js/tiny_mce/tiny_mce.js">
http://127.0.0.1:8000/site_media/</a>
tiny_mce/tiny_mce.js">

I'm not sure what other connection I'm missing?

On May 4, 5:00 pm, Zain Memon <z...@inzain.net> wrote:
> Your TINYMCE_JS_URL is .../site_media/js/tiny_mce/tiny_mce.js while the file
> apparently is at .../site_media/tiny_mce/tiny_mce.js.
> Zain
>
> On Mon, May 4, 2009 at 9:59 AM, Jesse <adles...@gmail.com> wrote:
>
> > Hello,
>
> > I'm trying to implement django-cms.  The CMS pages in admin display,
> > but not with the editing someone without html knowledge will be able
> > to use.  I see no tinymce options. I've placed tinymce in several
> > places hoping somehow it would display where I need it.
>
> > Using this statement in a firefox browser:
> >http://127.0.0.1:8000/site_media/tiny_mce/tiny_mce.js
>
> > I see this displayed:
> > var tinymce=
>
> > {majorVersion:"3",minorVersion:"2.3",releaseDate:"2009-04-23",_init:function
> > (){var o=this,k=document, etc.
>
> > My setting.py file:
> > MEDIA_ROOT = 'c:/django/myprograms/site_media/'
> > MEDIA_URL = 'http://127.0.0.1:8000/site_media/'
>
> > TINYMCE_JS_URL = 'http://127.0.0.1:8000/site_media/js/tiny_mce/
> > tiny_mce.js'
> > TINYMCE_JS_ROOT = 'c:/django/myprograms/site_media/js/tiny_mce'
> > TINYMCE_DEFAULT_CONFIG = {
> >    'plugins': "table,spellchecker,paste,searchreplace",
> >    'theme': "advanced",
> >    'cleanup_on_startup': True,
> >    'custom_undo_redo_levels': 10,
> > }
>
> > TINYMCE_SPELLCHECKER = False
> > TINYMCE_COMPRESSOR = False
> > TINYMCE_FILEBROWSER = True
>
> > CMS_USE_TINYMCE = True
>
> > INSTALLED_APPS = (
> >    'cms',
> >    'tinymce',
> >    'filebrowser',
> > )
>
> > I''ve not found any download files with the uppercase TinyMce, but
> > only tinymce
> > or tiny_mce.
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



tinymce not displaying on admin template

2009-05-04 Thread Jesse

Hello,

I'm trying to implement django-cms.  The CMS pages in admin display,
but not with the editing someone without html knowledge will be able
to use.  I see no tinymce options. I've placed tinymce in several
places hoping somehow it would display where I need it.

Using this statement in a firefox browser:
http://127.0.0.1:8000/site_media/tiny_mce/tiny_mce.js

I see this displayed:
var tinymce=
{majorVersion:"3",minorVersion:"2.3",releaseDate:"2009-04-23",_init:function
(){var o=this,k=document, etc.

My setting.py file:
MEDIA_ROOT = 'c:/django/myprograms/site_media/'
MEDIA_URL = 'http://127.0.0.1:8000/site_media/'

TINYMCE_JS_URL = 'http://127.0.0.1:8000/site_media/js/tiny_mce/
tiny_mce.js'
TINYMCE_JS_ROOT = 'c:/django/myprograms/site_media/js/tiny_mce'
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,spellchecker,paste,searchreplace",
'theme': "advanced",
'cleanup_on_startup': True,
'custom_undo_redo_levels': 10,
}

TINYMCE_SPELLCHECKER = False
TINYMCE_COMPRESSOR = False
TINYMCE_FILEBROWSER = True

CMS_USE_TINYMCE = True

INSTALLED_APPS = (
'cms',
'tinymce',
'filebrowser',
)

I''ve not found any download files with the uppercase TinyMce, but
only tinymce
or tiny_mce.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



FileField error

2009-04-27 Thread Jesse

I am receiving this error when requesting a pdf file that was uploaded
in admin using FileField

Page not found (404)
Request Method: GET
Request URL:http://127.0.0.1:8000/site_media/pdf/Alg_.pdf

The settings file:
MEDIA_URL = 'http://127.0.0.1:8000/site_media/'


the models file:
 internalfilename = models.FileField(upload_to="pdf/", blank=True,
help_text="Publication must NOT be copyrighted")

Postgres table:
internalfilename  character length 100

Template:

 {% if publication.internalfilename %}
 ( {{ publication.mediaformat.mediaformat|safe }}
{{ publication.digitalsize|safe }})
   {% else %}

   {% endif %}

Shouldn't the pdf file open without having to add anything to the
URL.py file?

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



Re: Temperature degree ascii code error on cvs output file

2009-04-14 Thread Jesse

Thanks I'll give the suggestions a try.

On Apr 14, 9:55 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, Apr 14, 2009 at 12:35 PM, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > On Tue, Apr 14, 2009 at 12:25 PM, Jesse <adles...@gmail.com> wrote:
>
> >> The error is 'ascii' codec can't encode character u'\xb0' in position
> >> 98: ordinal not in range(128) and it occurs when a temperature degree
> >> such as 35°C
> >> is in the text.
>
> >> I'm using the following code in the view.py:
>
> >>   response = HttpResponse(mimetype='text/csv')
> >>    response['Content-Disposition'] = 'attachment;
> >> filename=publication.csv'
> >>    writer = csv.writer(response)
> >>    writer.writerow(['Title', 'Authors', 'Year', 'Journal',
> >> 'Citation', 'Web Address'])
> >>    for publication in publication_list:
> >>        writer.writerow([publication.pubtitlestrip,
> >> publication.pubauthors, publication.year, publication.journal,
> >> publication.pubcitationnum, publication.pubwebaddress])
> >>    return response
>
> >> Is there someway to unicode the writer?
>
> > Simon Willison(I think) wrote up a class that implements the same API but
> > handles unicode:http://www.djangosnippets.org/snippets/993/
>
> Note also this is really a pure Python question and has nothing to do with
> Django.  Don't forget to consult the relevant docs for whatever code (in
> this case csv) you happen to be using.
>
> In this case the Python csv doc:
>
> http://docs.python.org/library/csv.html
>
> covers the issue pretty clearly (just search for unicode on the page), and
> also includes an example of a writer class that supports writing Unicode.
>
> Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Temperature degree ascii code error on cvs output file

2009-04-14 Thread Jesse

The error is 'ascii' codec can't encode character u'\xb0' in position
98: ordinal not in range(128) and it occurs when a temperature degree
such as 35°C
is in the text.

I'm using the following code in the view.py:

   response = HttpResponse(mimetype='text/csv')
response['Content-Disposition'] = 'attachment;
filename=publication.csv'
writer = csv.writer(response)
writer.writerow(['Title', 'Authors', 'Year', 'Journal',
'Citation', 'Web Address'])
for publication in publication_list:
writer.writerow([publication.pubtitlestrip,
publication.pubauthors, publication.year, publication.journal,
publication.pubcitationnum, publication.pubwebaddress])
return response

Is there someway to unicode the writer?


--~--~-~--~~~---~--~~
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: Search on concatenated fields of qset

2009-04-02 Thread Jesse

Hello Tim,

I gave it a try, no errors, but also no results for the Contact.  I
think I have a problem in the resultsc statement.  How do I filter out
both qset3 and qset3_inner?

query = request.GET['q']
terms = query.split()
# terms = re.findall(r'\w+', query)
if query:   # will eventually add the split to this section
qset = (
Q(pubtitlestrip__icontains=query) |
Q(pubauthors__icontains=query)|
Q(journal__journal__icontains=query)
)
pubresults = Publication.objects.exclude(active = 0).filter
(qset).distinct()
qset3=Q()
for term in terms:
qset3_inner = Q()
for (field_to_search, how) in (
('firstname', 'icontains'),
('lastname', 'icontains'),
):
name = "%s__%s" % (field_to_search, how)
qset3_inner |= Q(**{name: term})
qset3 &= qset3_inner  # AND them together
resultsc = Contact.objects.filter(qset3).distinct()

Thanks!!

On Apr 1, 1:12 pm, Tim Chase  wrote:
> > My model has firstname and lastname as separate fields.  In a search
> > box if a person types in one name say "Bunny" then based on the
> > following query they will find Bunny:
>
> > qset = (
> >             Q(firstname__icontains=query) |
> >             Q(lastname__icontains=query)  |
> >         )
>
> > If a person types in "Bunny Foo" to find first and last name they
> > won't find anything using the above query.  How can I concatenate
> > firstname || lastname to make contactname and use it in the qset?
>
> The typical way to do this is to split the search-string into
> words on which you want to search.  You also have to decide
> whether you want to require that both terms match (AND) or a
> match can be found either way (OR):
>
>    search = "Bunny Foo"
>    terms = search.split()
>    # terms = re.findall(r'\w+', search)
>
>    qset = Q()
>    for term in terms:
>      qset_inner = Q()
>      for (field_to_search, how) in (
>          ('firstname', 'icontains'),
>          ('lastname', 'icontains'),
>          ):
>        name = "%s__%s" % (field_to_search, how)
>        qset_inner |= Q(**{name: term})
>      qset &= qset_inner  # AND them together
>      #qset |= qset_inner # OR them together
>
> -tim
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Search on concatenated fields of qset

2009-04-01 Thread Jesse

My model has firstname and lastname as separate fields.  In a search
box if a person types in one name say "Bunny" then based on the
following query they will find Bunny:

qset = (
Q(firstname__icontains=query) |
Q(lastname__icontains=query)  |
)

If a person types in "Bunny Foo" to find first and last name they
won't find anything using the above query.  How can I concatenate
firstname || lastname to make contactname and use it in the qset?
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: template tag for nested tables

2009-03-26 Thread Jesse

I was not aware of the __in option!  However, I think the best option
now that I've rethought this problem is to change my models.  Thanks!

On Mar 25, 6:21 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Wed, 2009-03-25 at 09:46 -0700, Jesse wrote:
> > One research project can have many publications.  One model includes
> > the research projects, one model includes the publications and a third
> > model assigns multiple publications to each research project.
> > The model:
> > class Researchproject(models.Model):
> >     restitle = models.TextField()
>
> > class Publication(models.Model):
> >     pubtitle = models.TextField()
>
> > class Researchpublications(models.Model):
> >     researchproject = models.ForeignKey(Researchproject)
> >     publication = models.ForeignKey(Publication)
>
> > In the view.py the research projects are selected and appended into a
> > list called:
> > research_list
>
> > In the view I created this statement:
> > respublications=Researchproject.objects.filter
> > (researchpublications__researchproject=research_list), which doesn't
> > get any errors, but also doesn't seem to do what I need it to do.
>
> The problem here is in the filter constraint. The left-hand side of a
> "thing=value" filter is talking about individual "things", so an
> individual ResearchProject record in this case. That's a long way of
> saying that you need to use the "__in" lookup type here:
>
>         filter(researchpublications__researchproject__in=research_list)...
>
> I think you'll find that will do what you're after. Right now (with your
> current filter), not ResearchProject row will be equal to the list of
> values on the right-hand side of the filter.
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



template tag for nested tables

2009-03-25 Thread Jesse

One research project can have many publications.  One model includes
the research projects, one model includes the publications and a third
model assigns multiple publications to each research project.
The model:
class Researchproject(models.Model):
restitle = models.TextField()

class Publication(models.Model):
pubtitle = models.TextField()

class Researchpublications(models.Model):
researchproject = models.ForeignKey(Researchproject)
publication = models.ForeignKey(Publication)

In the view.py the research projects are selected and appended into a
list called:
research_list

In the view I created this statement:
respublications=Researchproject.objects.filter
(researchpublications__researchproject=research_list), which doesn't
get any errors, but also doesn't seem to do what I need it to do.

In the template a research project should show all the publications
associated with it.  The template:
   {{ respublications }}  gives this [] as the result.  I need to grab
the publication.id.

Any help is appreciated.  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: Need two response statements on same def

2009-03-19 Thread Jesse

Thanks everyone for the suggestions!  I will get started on redoing
the functions and views.


On Mar 19, 9:29 am, Andy Mckay <a...@clearwind.ca> wrote:
> On 19-Mar-09, at 8:35 AM, Jesse wrote:
>
> > My concern is that each view has 87 lines of duplicate code from the
> > "GET" data to get the appended list (shown here as: data retrieved to
> > create a list .list.append(publications)).  Anytime I make a
> > change in one view I have to remember to make the change in the other
> > view.
>
> A view is just a Python function, you can do whatever you'd normally  
> do to refactor Python to refactor views. So move the 87 lines of  
> duplicated code into another function and re-use.
> --
>    Andy McKay
>    Clearwind Consulting:www.clearwind.ca
>    Blog:www.agmweb.ca/blog/andy
>    Twitter: twitter.com/clearwind
--~--~-~--~~~---~--~~
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: Need two response statements on same def

2009-03-19 Thread Jesse

My concern is that each view has 87 lines of duplicate code from the
"GET" data to get the appended list (shown here as: data retrieved to
create a list .list.append(publications)).  Anytime I make a
change in one view I have to remember to make the change in the other
view.  Since I'm fairly new at Django, I'm thinking there must be a
more efficient way to write the views?  I'm very pleased with how
everything is working, so now I am going back to try to clean up the
code.

Thanks.

On Mar 18, 6:43 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Wed, 2009-03-18 at 11:24 -0700, Jesse wrote:
> > In the view.py I have  (def Bypub) that sends data to a template and
> > paginates it.  I have a second (def TextFile) that uses the same data
> > to send to a CSV file.  I would like to combine the two (def Bypub and
> > def TextFile) together into def Bypub, but I'm not sure how to write
> > the statements to combine two responses.
>
> What problem are you trying to solve here? You already have two views
> where the common stuff is in a separate function (the bit you've marked
> as retrieving the data in a list) and the distinct stuff is in the
> separate views. That ideal.
>
> If the problem is that you want one URL to be able to access both
> formats, then simplest is to create a third view that works out which of
> the current two views to call and then passes onto them:
>
>         def dispatch_view(request,...):
>            # ... work out which to call somehow...
>
>            if output_format == 'csv':
>               return TextFile(request)
>            else:
>               return Bypub(request)
>
> Is that what you're trying to do?
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Need two response statements on same def

2009-03-18 Thread Jesse

In the view.py I have  (def Bypub) that sends data to a template and
paginates it.  I have a second (def TextFile) that uses the same data
to send to a CSV file.  I would like to combine the two (def Bypub and
def TextFile) together into def Bypub, but I'm not sure how to write
the statements to combine two responses.

def Bypub(request):
data retrieved to create a list .
list.append(publications)

paginator = Paginator(list, 10)  #number of records per page
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1
try:
pub_list = paginator.page(page)
except (EmptyPage, InvalidPage):
pub_list = paginator.page(paginator.num_pages)
return render_to_response('search/searchresults_pub.html', {
 'list' : list,
'pub_list' : pub_list,
},
)

def TextFile(request):
data retrieved to create a list .
list.append(publications)

response = HttpResponse(mimetype='text/csv')
response['Content-Disposition'] = 'attachment;
filename=publication.csv'
writer = csv.writer(response)
writer.writerow(['Title', 'Authors'])
for publication in list:
writer.writerow([publication.pubtitle,
publication.pubauthors])
return 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, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[Job] Senior Web Engineer (Django, Javascript)

2009-03-18 Thread Jesse Noller

Hi Everyone, I'm helping a good friend of mine find someone with
Django/Web skills for a new startup - the opening will be posted on
djangogigs soon, but I also wanted to share it with you.

Feel free to contact me (jnoller at gmail dot com) or jobs at nasuni
dot com about this position. I've also posted it here:

http://jessenoller.com/2009/03/17/job-opening-senior-web-engineer-django-javascript/

So feel free to share it.

Description:

CONSULTING SOFTWARE ENGINEER

Nasuni is turning storage as service into a real product businesses
can use. We will deliver unlimited protected storage at an exceptional
value to our customers. We are bringing together a stellar engineering
team to tackle the challenge. We value talent, intelligence and the
desire to work hard as part of a team of A-players to create something
new. Founded by storage veterans, Nasuni is backed by leading Boston
venture capital firms North Bridge and Sigma Partners. Our
headquarters are in Natick, MA.

Responsibilities

Nasuni is looking for a Javascript developer and leader with 5+ years
of building DHTML- based interfaces for rich Internet applications.
The role is for an engineer (as opposed to a designer) who is fluent
in web development, expert in Javascript/DOM manipulation, and capable
of working with a fast-moving and dynamic team across a whole series
of disciplines to distill lots of functionality into something simple
and beautiful.

Experience and Education

- Expertise in HTML, CSS, DOM, and Javascript: these are highly
dynamic sites with a lot of interactive pieces. Candidate must be able
to look at a comp and quickly implement it in HTML+CSS and have good
knowledge of how to hook into Javascript.
- Attention to detail is a must: we’ll have high traffic Internet site
with lots of traffic and award-winning design. Careful
coordination/work with designers, and understanding about meeting
design requirements is a necessary
- Strong experience with Django (or a good argument for an alternative platform)
- Test-driven development experience necessary. Developer is
responsible for his own unit tests (JSUnit), as well as for designing
functional test plans for QA
- Successful track record of leading agile web development teams

Strongly Desired

- Knowledge of one of the following open source Javascript libraries
is a big plus: jQuery, Prototype, Yahoo UI Library.
- Experience with any internal or external cloud (i.e. Amazon S3/EC2)
services and APIs
- eCommerce knowledge
- Experience with relational databases (Postgresql, MySQL, Oracle,
SQLServer, etc)
- Understanding of I18N and L10N issues in globally targeted websites,
particularly for multibyte languages
- Open source philosophy

Additional information
- You should be able to point to a couple AJAX-based web apps that
you’ve built and be able to discuss them. Demonstration of previous
work is required.

Must be authorized to work in the United States on a full-time basis
for any employer.

--~--~-~--~~~---~--~~
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: Numbering of items in template

2009-03-17 Thread Jesse

I'm please to know of such a tag.  Do you know of a good example of
how it is used with the sum filter?  Otherwise, I will try.

Thanks!

On Mar 17, 9:51 am, Alex Koshelev <daeva...@gmail.com> wrote:
> You can use `forloop.counter` with `sum` filter. Or use `ol` html tag
> with proper `start` attribute.
>
> On Tue, Mar 17, 2009 at 7:47 PM, Jesse <adles...@gmail.com> wrote:
>
> > Hello,
>
> > I've finally gotten pagination to work.  Now I would like to add a
> > sequential number to the beginning of each record in the output.  In
> > previous languages I used something like count=count+1 and then placed
> > count at the beginning of each record output in the template.  How is
> > a record count created in django that can be displayed at the
> > beginning of each record in the template?
>
> > If I use  the count starts over again for each page under
> > pagination.  I need to be able to label records 1 - 100 across several
> > pages.
> > 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
-~--~~~~--~~--~--~---



Numbering of items in template

2009-03-17 Thread Jesse

Hello,

I've finally gotten pagination to work.  Now I would like to add a
sequential number to the beginning of each record in the output.  In
previous languages I used something like count=count+1 and then placed
count at the beginning of each record output in the template.  How is
a record count created in django that can be displayed at the
beginning of each record in the template?

If I use  the count starts over again for each page under
pagination.  I need to be able to label records 1 - 100 across several
pages.
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: pagination problem with "Next" and saving results as a dictionary

2009-03-16 Thread Jesse

Hello Paul,

Thanks!! I'll try it.

On Mar 13, 2:21 pm, pkenjora <pkenj...@gmail.com> wrote:
> Uhm maybe this post will help its a tag that handles thepaginationon 
> query objects.  I've used it in a few of my projects and
> its quite handy.
>
> http://blog.awarelabs.com/?p=29
>
> -Paul
>
> On Mar 13, 12:13 pm, Jesse <adles...@gmail.com> wrote:
>
> > Hello Micah,
>
> > I can get the q with GET, but I have too complicated of a search and I
> > need to use POST.  I'm having much difficulty with my template code
> > with POST to work with paginator.  I'll keep trying.  Thanks for your
> > patience 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pagination problem with "Next" and saving results as a dictionary

2009-03-13 Thread Jesse

Hello Micah,

I can get the q with GET, but I have too complicated of a search and I
need to use POST.  I'm having much difficulty with my template code
with POST to work with paginator.  I'll keep trying.  Thanks for your
patience 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pagination problem with "Next" and saving results as a dictionary

2009-03-12 Thread Jesse

Hello Micah,

I tried this in the template:
next

The browser URL is:
http://127.0.0.1:8000/Search/?q=?=2

and this in the template:

 next

The browser URL is:
http://127.0.0.1:8000/Search/?q=harris=2,

which is correct for q, but the error for both is still:

Request Method: GET
Request URL:http://127.0.0.1:8000/Search/
Exception Type: MultiValueDictKeyError
Exception Value:

Key 'q' not found in 
--~--~-~--~~~---~--~~
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: pagination problem with "Next" and saving results as a dictionary

2009-03-12 Thread Jesse

Hello Micah,

My view is too commplicated.  The q and the pathologyid ( I actually
have two other retrievals that also appended with these) are all
appended into the "list".  What I need to figure out is how to send
the "list" to it's own dictionary, which I can then retrieve with a
new view and use that view for the pagination.  I can see that the
pagination works better with a simple retrieval.  Can you tell me how
to create a new object from "list" that can be retrieved in a new
view?

Thanks.

On Mar 11, 10:20 pm, Micah Ransdell <mjr...@gmail.com> wrote:
> Jesse,
>
> The error you are getting is from "q" not being in your post
> QueryDictionary. This happens because when you click next you are not
> rePOSTing the q variable. Either you can put the q variable into an input
> box and POST it again by making your next link a submit button, or you could
> change q to a querystring parameter and use request.GET to retrieve it. This
> makes it easier to pass on to future pages in your search by putting it into
> the querystring for your next link as well.
>
> I have solved this by putting another variable in my next link like this:
>
> {% if page_obj.has_next %}
>     next
> {% endif %}
>
> Micah
>
> On Wed, Mar 11, 2009 at 12:51 PM, Jesse <adles...@gmail.com> wrote:
>
> > The following code is for a search on q and attaches tuples from the
> > search on another model.  The search results are appended together to
> > create the final data results "list".
>
> > def Bypub(request):
> >   query = request.POST['q']
> >    if query:
> >        qset = (
> >            Q(pubtitlestrip__icontains=query) |
> >        )
> >        pubresults = Publication.objects.filter(qset).distinct()  #
> > original
> >    else:
> >        pubresults = []
> >    pathology_id = request.POST['pathology_id']  #original works
> >    p = get_object_or_404(Pathology, pk=pathology_id)
> >    pub1=Publication.objects.filter(pathpubcombo__pathology=p)
> >    for publication in pubresults:
> >        if publication not in list:
> >            list.append(publication)  # the object going to template
>
> >    paginator = Paginator(list, 5)
> >    try:
> >        page = int(request.GET.get('page', '1'))
> >    except ValueError:
> >        page = 1
> >    try:
> >        publications = paginator.page(page)
> >    except (EmptyPage, InvalidPage):
> >        publications = paginator.page(paginator.num_pages)
> >    return render_to_response('search/searchresults_pub.html', {
> >        "query": query,
> >        "pubresults": pubresults,
> >        'pub1': pub1,
> >        'pathology': p,
> >        'list' : list,
> >        'publications' : publications,
> >    },
> >        context_instance=RequestContext(request)
> >    )
>
> > The template:
>
> > {% for publication in publications.object_list %}
> >    {{ publication.pubtitle|safe }}
> >      {% endfor %}
> >    {% else %}
> >      No publications found.  Please try a different search.
> >    {% endif %}
>
> >  
> >    
> >        {% if publications.has_previous %}
> >            previous
> >        {% endif %}
>
> >        
> >            Page {{ publications.number }} of
> > {{ publications.paginator.num_pages }}.
> >        
>
> >        {% if publications.has_next %}
> >            next > a>
> >        {% endif %}
> >    
> > 
>
> > Every thing works just fine until I select the link for the "Next"
> > page.  The URL in browser is:
> >http://127.0.0.1:8000/Search/?page=2
> > ERROR:
> > Exception Type:         MultiValueDictKeyError
> > Exception Value:
> > Key 'q' not found in 
>
> > I think when I select "Next" it is returning to the def Bypub, but of
> > course the q is not there the second time.  How do I preserver the
> > "list" as a dictionary to output to the next page?  This might also
> > answer the other problem I'm having with sending the "list" to a csv
> > file.  I also need some way to store the data for the csv file.
> > Any help is appreciated.  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
-~--~~~~--~~--~--~---



pagination problem with "Next" and saving results as a dictionary

2009-03-11 Thread Jesse

The following code is for a search on q and attaches tuples from the
search on another model.  The search results are appended together to
create the final data results "list".

def Bypub(request):
   query = request.POST['q']
if query:
qset = (
Q(pubtitlestrip__icontains=query) |
)
pubresults = Publication.objects.filter(qset).distinct()  #
original
else:
pubresults = []
pathology_id = request.POST['pathology_id']  #original works
p = get_object_or_404(Pathology, pk=pathology_id)
pub1=Publication.objects.filter(pathpubcombo__pathology=p)
for publication in pubresults:
if publication not in list:
list.append(publication)  # the object going to template

paginator = Paginator(list, 5)
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1
try:
publications = paginator.page(page)
except (EmptyPage, InvalidPage):
publications = paginator.page(paginator.num_pages)
return render_to_response('search/searchresults_pub.html', {
"query": query,
"pubresults": pubresults,
'pub1': pub1,
'pathology': p,
'list' : list,
'publications' : publications,
},
context_instance=RequestContext(request)
)

The template:

{% for publication in publications.object_list %}
{{ publication.pubtitle|safe }}
  {% endfor %}
{% else %}
  No publications found.  Please try a different search.
{% endif %}

 

{% if publications.has_previous %}
previous
{% endif %}


Page {{ publications.number }} of
{{ publications.paginator.num_pages }}.


{% if publications.has_next %}
next
{% endif %}



Every thing works just fine until I select the link for the "Next"
page.  The URL in browser is:
http://127.0.0.1:8000/Search/?page=2
ERROR:
Exception Type: MultiValueDictKeyError
Exception Value:
Key 'q' not found in 

I think when I select "Next" it is returning to the def Bypub, but of
course the q is not there the second time.  How do I preserver the
"list" as a dictionary to output to the next page?  This might also
answer the other problem I'm having with sending the "list" to a csv
file.  I also need some way to store the data for the csv file.
Any help is appreciated.  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
-~--~~~~--~~--~--~---



filter through two models to subset list

2009-03-11 Thread Jesse

class Pathology(models.Model):
pathology = models.CharField(max_length=100, null=True,
blank=True)

class Pathpubcombo(models.Model):
pathology = models.ForeignKey(Pathology)
publication = models.ForeignKey(Publication)

 Currently, I select all the pathologies from the model Pathology and
send to a drop down list on the template:
def publications(request):
 pathology_list = Pathology.objects.all().order_by('pathology')
 return render_to_response("search/search.html",
"pathology_list": pathology_list,
})

I would like to filter the pathology list, so that it only selects the
unduplicated pathology ids from the model Pathpubcombo.  I've tried
several variations of the following statement, but always get an
error:
This is the working statement, but doesn't subset pathology_id from
Pathpubcombo
pathology_list = Pathology.objects.all().order_by('pathology')
and this one doesn't work:
   pathology_list = Pathology.objects.select_related().get
(pathpubcombo__pathology__id)

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



Re: radio button assignment as filter in search

2009-03-09 Thread Jesse

The problem is that the python converts the andor value to a
character, even though the radio button is presenting it as numeric.
I needed to place quotes around the number:
if andor == '1' and then it works.  Hope this helps someone else.
--~--~-~--~~~---~--~~
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: radio button assignment as filter in search

2009-03-09 Thread Jesse

Template:




{% for pathology in pathology_list %}
{{ pathology.pathology }}
{% endfor %}

   
There are actually three search selects(pathology, commodity,
technology)  The user can do and/or for a mix or match of the three,
which is why I need the and/or option in the views.py.

The views.py:
def Bypub(request):
andor1 = request.POST['andor1']
pathology_id = request.POST['pathology_id']
p = get_object_or_404(Pathology, pk=pathology_id)
pub1=Publication.objects.exclude(pathpubcombo__pathology__id =
1).filter(pathpubcombo__pathology=p)
list=[]
andlist=[]
for publication in pub1:
if andor1 == 1:
if publication not in list:
list.append(publication)
if andor1 == 2:
if publication in list:
andlist.append(publication)
#list=andlist
return render_to_response('search/categories.html', {
'andor1' : andor1,
'pub1': pub1,
'pathology': p,
'list' : list,
'andlist' : andlist,
},
context_instance=RequestContext(request)
)

I know that all my code works without error, but the line (if andor1
==1:) and (if andor1 ==2:)
is being ignored.  I suspect that the value for andor1 does not appear
at the point where I'm using it.  I think it doesn't actually render
until after the return render_to_response, because it appears in the
next template as a value, otherwise I would see some kind of response
at the if andor1 ==1: in the template.  Any suggestions?

--~--~-~--~~~---~--~~
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: Q search with foreign key

2009-03-04 Thread Jesse

Thanks!  That worked.
--~--~-~--~~~---~--~~
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: Q search with foreign key

2009-03-03 Thread Jesse

I tried that option and received this error:

Cannot resolve keyword 'institution_institution' into field

However, I think I may have it.  I used this statement:

   qset2 = (
   Q(institution__icontains=queryr)
)
resultsi = Institution.objects.filter(qset2).distinct()
for id in resultsi:
resultsii=Researchproject.objects.filter(institution=id)

And am able to get the results in the template.  It just makes for
more coding, however, in the view.  It would be easier to have all the
code in the qset and not have to add another qset2.

On Mar 3, 1:01 pm, Tim  wrote:
> If you want to look up an Institution using the Project model, you
> should be able to use "institution__institution__icontains"
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Q search with foreign key

2009-03-03 Thread Jesse

I have a Project model with a foreign key to institution.  I want to
do a Q(institution_icontains)=queryr
on the institution field in the institution table, but the filter
needs to go through the Projects model.
I need all institutions associated with a Project.


class Project(models.Model):
restitle = models.TextField(null=True, blank=True)
institution = models.ForeignKey(Institution, null=True,
blank=True)
contact = models.ForeignKey(Contact, null=True, blank=True)
def __unicode__(self):
return self.restitle
class Meta:
ordering = ["restitle"]

class Institution(models.Model):
institution = models.TextField(null=True, blank=True)
def __unicode__(self):
return self.institution
class Meta:
ordering = ["institution"]


def projects(request):
queryr = request.GET.get('qr', '')
if queryr:
qset = (
   Q(projecttitle__icontains=queryr)
)
resultsr = Project.objects.filter(qset).distinct() # original
qset2 = (
   Q(institution__icontains=queryr)
)
resultsi = Institution.objects.filter(qset2).distinct()
else:
resultsr = []
resultsi = []
return render_to_response("search/search.html", {
"queryr": queryr,
"resultsr": resultsr,
"resultsi": resultsi,

This statement gives me an error, because institution is not in
Project, but the institution_id.
qset = (
   Q(projecttitle__icontains=queryr) |
   Q(institution__icontains=queryr)
)


This statement selects results from both models (projects and
institutions), but institution is
independent of the Projects.

qset = (
Q(projecttitle__icontains=queryr)
)
resultsr = Project.objects.filter(qset).distinct() # original
qset2 = (
Q(institution__icontains=queryr)
)
resultsi = Institution.objects.filter(qset2).distinct()

Can anyone please help me with the syntax?


--~--~-~--~~~---~--~~
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: template ifequal substitution of value

2009-02-26 Thread Jesse

I figured out what to do.

I created a new instance in the view.py:

def search(request):
newdate='1999'

In the template I used the "Y" for both instances and was able to get
the comparison to work:

{% ifequal  items.startdt|date:"Y"  newdate|date:"Y"  %}

this does the correct comparison

   {% endifequal %}
--~--~-~--~~~---~--~~
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: Fwd: python sql query in django

2009-02-26 Thread Jesse

Thank you for all the suggestions!

Solution 1 - Did not work:  pub4=Publication.objects.filter
(techpubcombo__technology=t).filter(pathpubcombo__pathology=p).filter
(commpubcombo__commodity=c)
Solution 1 didn't pull any records

Solution 2 - Did not work:
pub5=Publication.objects.filter(commpubcombo__commodity=c)
pub5=Publication.objects.filter(pathpubcombo__pathology=p)
pub5=Publication.objects.filter(techpubcombo__technology=t)
Solution 2:  Grabbed the last selection, overwriting the two previous
selections

Solution 3 - Did work!
for publication in pub1:
if publication not in list:
list.append(publication)
for publication in pub2:
if publication not in list:
list.append(publication)
for publication in pub3:
if publication not in list:
list.append(publication)

My last question!  How do I sort the list.append(publication) by
pubtitle?

Thank you!




On Feb 25, 9:24 pm, Parthan SR <python.technofr...@gmail.com> wrote:
> On Thu, Feb 26, 2009 at 2:24 AM, Jesse <adles...@gmail.com> wrote:
>
> > I have three statements:
> > publications = Publication.objects.filter(techpubcombo__technology=t)
> > publications2 = Publication.objects.filter(pathpubcombo__pathology=p)
> > publications3 = Publication.objects.filter(commpubcombo__commodity=c)
>
> > I need to combine the three sets into one set to eliminate duplication
> > in the publications and then output the final set to the template.
>
> If am not wrong, the result of first filter is a query object until
> you do .all() on it (for ex.) and hence the query object can be
> subjected to other filters as well if required. So you should be able
> to do one of the following..
>
> [1] publications =
> Publication.objects.filter(techpubcombo__technology=t).filter(pathpubcombo__pathology=p).filter(commpubcombo__commodity=c)
> [2]  publications = Publication.objects.filter(techpubcombo__technology=t)
>  publications = Publication.objects.filter(pathpubcombo__pathology=p)
>  publications = Publication.objects.filter(commpubcombo__commodity=c)
>
> both [1] and [2] applies all the three filter conditions on the
> Publication.objects and return you the final query object on which you
> might be able to do publications.all() and get all the results.
>
> --
> With Regards,
>
> Parthan "Technofreak" (2FF01026)http://blog.technofreak.in
--~--~-~--~~~---~--~~
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: Fwd: python sql query in django

2009-02-25 Thread Jesse

> I believe this would work:
>
> publications = Publication.objects.filter(techpubcombo__technology=t)
>
> Regards,
>
> --
> Christian Joergensenhttp://www.technobabble.dk

Hello Christian,

Thank you so much for your answer.  I have been struggling with the
users group to get that syntax (I must not have been explaining it
well enough).  Now I need the syntax for the next step, which I'm
hoping you can help with.

I have three statements:
publications = Publication.objects.filter(techpubcombo__technology=t)
publications2 = Publication.objects.filter(pathpubcombo__pathology=p)
publications3 = Publication.objects.filter(commpubcombo__commodity=c)

I need to combine the three sets into one set to eliminate duplication
in the publications and then output the final set to the template.

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



template ifequal substitution of value

2009-02-25 Thread Jesse

I have two date fields:  startdt and enddt.  The template code that
works is:

{% ifequal  items.startdt  items.enddt %}

this says startdt and enddt are the same (as seen in the template)

   {% endifequal %}

In  postgres I have a date value in the startdt and enddt fields
stored like this:  1999-01-08, which appears as Jan 08, 1999 in the
template.

I would like the Jan 08, 1999 value to appear as blank or nothing in
the template.  I tried this:

{% ifequal  items.startdt  "1999-01-08" %}

   (this space should show nothing) (as not seen in the template)

   {% endifequal %}

I get no error, but I also get no action for this syntax, either.

Any help would be appreciated.

--~--~-~--~~~---~--~~
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: Highlight current active page

2008-10-20 Thread Jesse Young

I have a template block tag {% ifactive %} that lets you highlight the
currently active page using similar syntax as the {% url %} tag (i.e.,
you can specify urlpattern names and arguments in the same way), e.g.:

Page 1
Page 2
...
Page N

The code for this is at http://demo.apture.com/demo/ifactive.py .

I admit that the syntax {% ifactive request page2 %}...{% endifactive
%} is somewhat verbose, but the link above also explains how to write
specific template tags that are customized for your own templates,
e.g.:

Page 2

I like this method because it determines whether a page is active by
checking if the same view is called with the same arguments, instead
of just comparing URLs. So it can handle cases where different URLs
map to the same view. It also doesn't require modifying any of the
child templates, like some of the solutions described above.

-Jesse

On Oct 17, 6:02 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> A slight variation that doesn't require repeating the whole navigation
> div in each base_SECTION.html template:
>
> # base.html
> {% block content %}...{% endblock %}
> {% block navigation %}
> 
>     <li{% block active_section_1 %}{% endblock %}>Section
> 1
>     <li{% block active_section_2 %}{% endblock %}>Section
> 2
> 
> {% endblock %}
>
> # base_section1.html
> {% extends "base.html" %}
> {% block active_section_1 %} class="active"{% endblock %}
>
> # base_section2.html
> {% extends "base.html" %}
> {% block active_section_2 %} class="active"{% endblock %}
>
> # section1_specific_page.html
> {% extends "base_section1.html" %}
> {% block content %}...{% endblock %}

--~--~-~--~~~---~--~~
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 problem

2008-09-01 Thread Jesse

I have to say, I discovered my own problem, as usually happens
directly after I make a post for help.

The documentation has listed:

Model FieldForms Field
TextFieldCharField with widget=Textarea

I tried that to no avail. Eventually I found a snippet of code with
google where someone had specified widget=forms.Textarea, which worked
fine.

My apologies.

On Sep 1, 9:48 pm, Jesse <[EMAIL PROTECTED]> wrote:
> I'm terribly new and inexperienced, and after 30-40 minutes of
> googling I cannot find anything to help my problem:
>
> class roomForm(forms.Form):
>         authorName = forms.CharField(max_length = "30")
>         authorWebsite = forms.CharField(max_length = "50")
>         title = forms.CharField(max_length = "30")
>         content = forms.TextField()
>
> That forms.TextField() is getting me an error. I saw and tried various
> other things, which were probably legacy stuff, like
> TextField(widget=TextArea) or something to that effect.
>
> Anyhow, I appreciate any help.
>
> Also, is this somewhere in the documentation? I couldn't find 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?hl=en
-~--~~~~--~~--~--~---



newforms problem

2008-09-01 Thread Jesse

I'm terribly new and inexperienced, and after 30-40 minutes of
googling I cannot find anything to help my problem:

class roomForm(forms.Form):
authorName = forms.CharField(max_length = "30")
authorWebsite = forms.CharField(max_length = "50")
title = forms.CharField(max_length = "30")
content = forms.TextField()


That forms.TextField() is getting me an error. I saw and tried various
other things, which were probably legacy stuff, like
TextField(widget=TextArea) or something to that effect.

Anyhow, I appreciate any help.

Also, is this somewhere in the documentation? I couldn't find 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?hl=en
-~--~~~~--~~--~--~---



Using a Read-Only model for data, second database for "django stuff"

2008-03-26 Thread Jesse Noller

This is a bit of an oddball question, but I figured I'd throw it out there.

I hate bugzilla's interface. I love Django.

I've been handed the task of doing a bit of data-mining on a bugzilla
database, and rather than work through the straight SQL, or using the
somewhat awful bugzilla query interface, I would much rather build out
my own little django app to provide the custom interface I want.

The problem I have is this - the bugzilla DB is read-only, no client
but bugzilla itself can change the tables, so I want to use the
auto-generated models.py from an inspectdb against the bz database,
but use a different database for any of the "other" tables/data (i.e:
the admin tables). I'd also need to set the model for the bz database
to read only.

Any suggestions on this - I know there was some discussion back in
Feb. about adding readonly/shadow flags to the models classes/Meta
options.

thanks

-jesse

--~--~-~--~~~---~--~~
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 Error

2007-08-30 Thread Jesse G. Lands

This only occurs (as far as I have found) when I use the {% block %}
feature of a template.  Anyone know of a reason why?


Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/template/__init__.py" in
render_node
  723. result = node.render(context)
File "/usr/lib/python2.5/site-packages/django/template/loader_tags.py"
in render
  19. context.push()

  AttributeError at /tickets/
  'str' object has no attribute 'push'



-- 
JLands
Arch Current   
Registered Linux User #290053
 When you have accomplished your goal
simply walk away.
This is the path way to Heaven.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



SQL Debug middleware

2007-04-21 Thread Jesse Lovelace

Hey all,

I made this the other day to help me track all the sql statements my
pages were doing.  I wanted something unobtrusive (i.e. middleware)
and simple.  Hope you like:

from django.db import connection
import re, pprint

body_end = re.compile('', re.IGNORECASE)

class DebugMiddleware(object):

def process_response(self, request, response):
if body_end.search(response.content) is not None:
db_info = pprint.pformat(connection.queries)
total = 0.0
for con in connection.queries:
total += float(con['time'])
response.content = body_end.sub('%s\nTotal: 
%f' %
(db_info,total), response.content)
return 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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



models in separate files - relation help

2007-04-14 Thread Jesse Lovelace

Hi all,

Would anyone be able to give some "best practice" information on how
to use django with multiple models files?  My current setup is (SVN
Django):

/myproject/
app1/
models/
  __init__.py - has all of the "from tag import Tag" lines
so syncdb works (when validation does)
  tag.py - has "class Tag(models.Model)..."
  ...

Ok, so far, so good.  But when I start trying to use foreign keys that
are many-to-manys (custom, not ManyToManyField because need attributes
on relation) between the same model and circular associations
(friendships) I start running into some problems.

1. It seems you cannot use field1 models.ForeignKey('Whatever'), the
quoted model name just fails validation with: AttributeError: 'str'
object has no attribute '_meta' (/django/db/models/options.py", line
~127, in get_all_related_objects)

2. ...which means I have to import, but:
import tag
...
   fields = models.ManyToManyField(tag.Tag)
...
Seems to not work either (or I'm crazy)

3. Doing any find of "from tag import Tag" works, but then circular
dependencies always start to appear.

Could anyone point the way for me?  I don't think my answer is "all
models in one file" since this is a very large site with 80+ models.

Many thanks,

jesse

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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
-~--~~~~--~~--~--~---



HTTP faking

2007-04-12 Thread Jesse Lovelace

Hi all,

I've been interested in the idea of faking HTTP methods that
browsers/servers might not support like the rails people are doing in
1.2 so I've written a very minimal middleware to do this--if someone
else has done this already sorry for the repetition. (It does the
method faking using a post form with a )

{{{
class RestfulMiddleware(object):
fakers = ['PUT','DELETE']

def process_request(self, request):
if request.method == 'POST':
if request.has_key('_method'):
if request.POST['_method'] in self.fakers:
request.method = request.POST['_method']
return None
}}}

That coupled with @require_http_methods seems to work well in my
minimal testing.

jesse

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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
-~--~~~~--~~--~--~---