Re: Search Frameworks

2008-04-16 Thread rich

I'm very happy with Sphinx and David Cramer's Django-Sphinx, very easy
to implement!

Cheers
- rich

http://www.davidcramer.net/code/117/announcing-django-sphinx-200.html

On Apr 16, 12:11 am, brydon <[EMAIL PROTECTED]> wrote:
> I'm curious what people are currently using for search frameworks on
> django based projects. I've done a fair bit of research here and
> elsewhere and I still haven't landed on a clear decision. What are
> people successfully using with django to get robust search
> capabilities a la lucene etc? Are pylucene, xapian working?
>
> thanks,
> brydon
--~--~-~--~~~---~--~~
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: Advice on RequestContext

2008-04-25 Thread rich

Both questions answered very helpfully.

Thank you very much!

- Richard

On Apr 26, 12:29 pm, Darryl Ross <[EMAIL PROTECTED]> wrote:
> Richard Atkinson wrote:
> > Hello all! Been lurking for a while, this is my first post.
>
> Welcome!
>
> > I understand that RequestContext is required in order to access  
> > {{ MEDIA_URL }} in templates. I have two questions related to this.
>
> > 1. Please could somebody give an example of how to pass RequestContext  
> > to a generic view from urls.py (sorry if it is in the documentation,  
> > but I couldn't find it).
>
> Generic views use RequestContext, so you don't need to do anything
> special. It's only views you write yourself which you need to handle
> specially.
>
> > 2. Given that I have applications with views that I'd like not to care  
> > about template issues, is there a nice way to specify using  
> > RequestContext by default (maybe from settings.py), without writing  
> > anything in my applications?
>
> If you find yourself doing something over and over again, in Python it
> is easy to abstract that out into a separate function. I find I want to
> use RequestContext in all my views, so instead of the following code:
>
> - <<< -
>   from django.shortcuts import render_to_response
>   from django.template import RequestContext
>
>   def my_view(request):
>       # ...
>       return render_to_response(template, context_vars,
>                                 context_instance=RequestContext(request))
> - <<< -
>
> I abstract out the render_to_response call into a separate function and
> use that in my own views. I create a top level folder called 'helpers'
> which is where I put various bits and pieces. Inside that I create a
> views.py file which has view helpers. My code then becomes:
>
> - <<< -
> ### helpers/views.py
>   from django.shortcuts import render_to_response
>   from django.template import RequestContext
>
>   def render_template(request, template, context_vars={}):
>       return render_to_response(template, context_vars,
>
>                                 context_instance=RequestContext(request))
>
> ### views.py
>   from helpers import render_template
>
>   def my_view(request)
>       # ...
>       return render_template(request, template, context_vars)
> - <<< -
>
> Hope that gives you some ideas.
>
> Regards
> Darryl
>
>  signature.asc
> 1KDownload
--~--~-~--~~~---~--~~
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: Django Performance Discoveries Part 1

2008-04-27 Thread rich

Thanks for sharing!

My setup is similar to yours except I don't use nginx at all - just
another apache virtual host for media.mysite.com. Not sure which is
best, but one less moving part from my point of view?

I haven't done any load testing, but I really like the way mod_wsgi
works; I use it in daemon mode (with worker MPM Apache) - it's never
caused me a problem and **feels** tidier than fcgi.

Also I have much less memcached - only 16MB, but I'm on a 256Mb
slicehost slice, for now; I haven't explored any optimisations here as
I'm still building core features in my first django project.

I've had one drama where Gutsy crashed: out of memory, unfortunately I
didn't realise until all log evidence fell off the end of the syslog
cliff.

Happy optimising
Rich

On Apr 27, 3:16 pm, Prairie Dogg <[EMAIL PROTECTED]> wrote:
> Hey Everybody,
>
> I've been using django for almost a year now and I've been spending
> some time recently trying to optimize the slicehost VPS(s) that I use
> to run several django sites I've developed.  I wanted to share my
> findings with the larger group in hopes that my oversights can be
> pointed out and whatever 'findings' I've made can be useful to folks
> who are just starting off.  I've been developing a blow-by-blow of my
> slicehost setup - I gained a lot from the "dreamier django dream
> server" blog post a while back.  But to make things brief for the
> first post, I'll just summarize my setup here:
>
> 512 meg slicehost slice w/ Hardy Heron
> memcached with cmemcached bindings doin' its cache thang with 256 megs
> of RAM
> nginx on port 80 serving static files
> apache mpm worker on 8080 w / mod_wsgi serving dynamic content
> postgres 8.3 w/ geo libraries
> django_gis (thanks justin!)
> my application
>
> I'll keep it to 3 sections of musings for this post:
>
> triage troubles
> memcached musings
> context-processor conundrum
>
> triage troubles
>
> At pycon someone asked Jacob KM what he used to performance test his
> websites and he said "siege".  A quick google search turned it up
> (http://www.joedog.org/JoeDog/Siege).
> I seem to recall Jacob mentioning that this was his preferred method
> because it was more of a "real life" test than perhaps benchmarking
> tools that would profile the code.  Compiling and using siege was a
> snap.  My test was of a site I wrote that does a lot of database
> queries to draw up any given page (mostly because of a complex
> sidebar) when I turned it on, real easy like, to a dev server, the
> server crumbled with only 10 simultaneous users and anything higher
> than 5 clicks per user.
>
> Observation #1: Make sure your debug settings are turned off.
>
> After I turned debug settings off, performance maybe doubled, but
> still was nothing that could handle even moderate traffic gracefully.
> 20 simultaneous users on 3 clicks per user were getting up into the
> 20+ second wait for a response range. Basically awful.  Not shocked,
> because I knew that my db querying was horrendously inefficient.  This
> was OK, because I had memcached up my sleeve.  An observation that I
> made on the first test that was constant throughout all subsequent
> tests, was that initial queries were the fastest and subsequent
> queries became progressively slower and slower.  I'm assuming this is
> because of something like queries queuing up at that db, or running
> through memory, but I don't have enough context or knowledge of the
> whole stack to isolate the problem, more on this later.
>
> memcached musings
>
> I went on and compiled cmemcache because the consensus opnion on the
> internets is that its fastest.  I'll just assume that's so because it
> has 'c' in the name and if you read it on the internets, it must be
> true.
>
> I put in all the cache settings, put in the Cache middleware and ran
> siege again, waiting for the glorius results.  Blam.  Exactly the
> same.  Actually, a little worse.  I scratched my head for about 3
> hours before I realized that I had mistyped the memcached port number
> in the settings.  After that, much improved.  I could do 300
> simultaneous visitors doing 3-5 clicks apiece with tolerable
> performace.  1000 visits doing 1 click each also held up very well,
> the longest response time being in the 4-6 second range.  Without
> fail, the earliest requests were the shortest wait, many well under a
> second,  the last requests were the longest waits.  Also, as I
> ratcheted up pressure from siege, I was running top on the 'beseiged'
> server watching the running processes.  I notice a ton of postgres
> processes.  This challenged my noti

Re: Django Performance Discoveries Part 1

2008-04-27 Thread rich

Yes, I too am at a similar level of confusion as to when django is not
thread safe.

I assume this could happen only if I explicitly create new threads
myself, or if I use some non-django module that isn't itself thread
safe.

Would be fantastic if someone could clarify this!

many thanks

Richard


On Apr 27, 11:08 pm, Prairie Dogg <[EMAIL PROTECTED]> wrote:
> I'm still trying to wrap my head around what the advantages of
> worker MPM are, I've read a couple articles that have started me
> down this road - the consensus view seems to be worker MPM
> w/ mod_wsgi is the best way to go from a memory and separtion
> of concerns POV, the only potential drawback being that your
> django app needs to be 'thread safe'.  Sadly I'm too much of
> a novice to really understand what that means in terms of my
> code or what sorts of patterns I should be using or avoiding.
>
> On Apr 27, 7:17 am, rich <[EMAIL PROTECTED]> wrote:
>
> > Thanks for sharing!
>
> > My setup is similar to yours except I don't use nginx at all - just
> > another apache virtual host for media.mysite.com. Not sure which is
> > best, but one less moving part from my point of view?
>
> > I haven't done any load testing, but I really like the way mod_wsgi
> > works; I use it in daemon mode (with worker MPM Apache) - it's never
> > caused me a problem and **feels** tidier than fcgi.
>
> > Also I have much less memcached - only 16MB, but I'm on a 256Mb
> > slicehost slice, for now; I haven't explored any optimisations here as
> > I'm still building core features in my first django project.
>
> > I've had one drama where Gutsy crashed: out of memory, unfortunately I
> > didn't realise until all log evidence fell off the end of the syslog
> > cliff.
>
> > Happy optimising
> > Rich
>
> > On Apr 27, 3:16 pm, Prairie Dogg <[EMAIL PROTECTED]> wrote:
>
> > > Hey Everybody,
>
> > > I've been using django for almost a year now and I've been spending
> > > some time recently trying to optimize the slicehost VPS(s) that I use
> > > to run several django sites I've developed.  I wanted to share my
> > > findings with the larger group in hopes that my oversights can be
> > > pointed out and whatever 'findings' I've made can be useful to folks
> > > who are just starting off.  I've been developing a blow-by-blow of my
> > > slicehost setup - I gained a lot from the "dreamier django dream
> > > server" blog post a while back.  But to make things brief for the
> > > first post, I'll just summarize my setup here:
>
> > > 512 meg slicehost slice w/ Hardy Heron
> > > memcached with cmemcached bindings doin' its cache thang with 256 megs
> > > of RAM
> > > nginx on port 80 serving static files
> > > apache mpm worker on 8080 w / mod_wsgi serving dynamic content
> > > postgres 8.3 w/ geo libraries
> > > django_gis (thanks justin!)
> > > my application
>
> > > I'll keep it to 3 sections of musings for this post:
>
> > > triage troubles
> > > memcached musings
> > > context-processor conundrum
>
> > > triage troubles
>
> > > At pycon someone asked Jacob KM what he used to performance test his
> > > websites and he said "siege".  A quick google search turned it up
> > > (http://www.joedog.org/JoeDog/Siege).
> > > I seem to recall Jacob mentioning that this was his preferred method
> > > because it was more of a "real life" test than perhaps benchmarking
> > > tools that would profile the code.  Compiling and using siege was a
> > > snap.  My test was of a site I wrote that does a lot of database
> > > queries to draw up any given page (mostly because of a complex
> > > sidebar) when I turned it on, real easy like, to a dev server, the
> > > server crumbled with only 10 simultaneous users and anything higher
> > > than 5 clicks per user.
>
> > > Observation #1: Make sure your debug settings are turned off.
>
> > > After I turned debug settings off, performance maybe doubled, but
> > > still was nothing that could handle even moderate traffic gracefully.
> > > 20 simultaneous users on 3 clicks per user were getting up into the
> > > 20+ second wait for a response range. Basically awful.  Not shocked,
> > > because I knew that my db querying was horrendously inefficient.  This
> > > was OK, because I had memcached up my sleeve.  An observation that I
> > > made on the 

Django on Jython - anybody doing it?

2008-04-30 Thread rich

More out of curiosity than anything else, is anybody using Django on
Jython?
--~--~-~--~~~---~--~~
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: Django on Jython - anybody doing it?

2008-04-30 Thread rich

>From the link:
> "Lastly, Django running on Jython, like other Python web app frameworks, is a 
> compelling alternative for Java developers who need to use the Java platform, 
> but without unnecessary pain and development cost."

Amen brother.



On May 1, 1:00 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 30, 2008 at 9:44 PM, rich <[EMAIL PROTECTED]> wrote:
> >  More out of curiosity than anything else, is anybody using Django on
> >  Jython?
>
> Several people are, and are actively involved in improving both Jython
> and Django to work better together; a number of bugs have been
> reported to both projects (most of them worked out by now), and Leo
> Soto (who's done a lot of unsung work to keep things rolling) is doing
> a Google Summer of Code project dedicated to that:
>
> http://code.google.com/soc/2008/psf/appinfo.html?csaid=DA6AC3DE94E157E
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: GeoDjangoFriendly?

2008-05-05 Thread rich

You can install anything you want on Slicehost or any other VPS;
provided that you have enough linux skills to do everything yourself.
There's plenty of help out there on the web, slicehost have some great
tutorials for setting up your slice, and mod_wsgi is very easy to
setup as a low memory alternative to mod_python.
I have a 256MB slice, and for $20 per month it's excellent.
If you can do it at home, you can do it on a VPS.
Rich

On May 5, 7:07 pm, tupixo <[EMAIL PROTECTED]> wrote:
> > You may recognize my name from that forum topic.
>
> > I've been working for over a week to get PostGIS installed correctly
> > for my hosting at WebFaction. The support team is very responsive and
> > helpful and we have worked through a lot of issues. That said, it
> > still doesn't work correctly.
>
> > This is definitely not something they seem to do a lot, so there's no
> > set process to actually get everything working. It seems to be a
> > one-off thing with a slightly different process for every user.
>
> > I'd be glad to share what I've done to get thus far in the process, if
> > you're interested.
>
> > I want to reiterate that the support guys at WebFaction have really
> > worked hard on this and have been very helpful. It just seems like
> > it's something that's somewhat non-standard for them.
>
> > Of course, if you have a slice at SliceHost, you can install anything
> > you want. The limit is only your knowledge and capabilities.
>
> > /alex
>
> > On Sun, May 4, 2008 at 9:43 AM, Justin Bronn <[EMAIL PROTECTED]> wrote:
>
> > >  > Anyone have experience/opinions on hosting GeoDjango with PostGIS on
> > >  > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)?
> > >  > I'm wondering if WebFaction shared account allows you enough freedom
> > >  > to install all the geodjango dependencies...
>
> > >  While I don't personally use WebFaction and/or Slicehost, others have
> > >  mentioned they've had success running on WebFaction:
> > >  http://forum.webfaction.com/viewtopic.php?id=957
>
> > >  Because I'm not familiar w/the way WebFaction sets things up I'd try
> > >  the GeoDjango installation instructions first over what is posted in
> > >  that forum topic:
> > >  http://code.djangoproject.com/wiki/GeoDjangoInstall
>
> WebFaction had a few issues with GeoDjango at first but I think
> they've now resolved them because they were able to setup GeoDjango on
> 3 of my accounts with no problem.
>
> Kevin.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Yet another installation question (on Godaddy)

2006-10-09 Thread rich

I've walked through the "Running Django on a shared-hosting provider
with Apache" -- but apparently I don't catch on that fast.My
largest challenge is that I don't have SSH access.  I've read a few
things here and there about creating a script to install it, but I'm
not sure what type of script or what goes in it.

Details:
Trying to setup on the root of my domain
GoDaddy Deluxe Linux plan
Apache (mod_python not available)
Python 2.4
FastCGI
MySQL

Here is what I've done:
Added to the bottom of .htaccess (just copied from tutorial):
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]

Created mysite.fcgi (just copied from tutorial):
#!/usr/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home/user/python")

# Switch to the directory of your project. (Optional.)
# os.chdir("/home/user/myproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")


...Now what?

I know I need flup. And I need to put the Django source on the server.
But *where* do I upload them to, and *how* do I install them (how do i
run the setup.py) without SSH?

Any help would be awesome.

Thanks guys.
-rich


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



templates not updating when i change things please help

2012-02-19 Thread Rich
Hi I am pretty new to django and I feel like I either have some kind
of configuration wrong or maybe im not understanding how something
works.

Whats happening is when I make a small change in one of my templates,
the change is not reflected on my site.

I have noticed that if I make significant changes in one of my views,
I might see an update in the actual website after reloading the page
(but it seems to be hit or miss)

If I make only a small change, there is almost never an update to the
actual website unless it is a change within a view.

Changing some text within a template file yields no results.

If I mess up some code i will get debugging messages, but if I fix the
code, I get the same (cached?) result

-- 
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: templates not updating when i change things please help

2012-02-19 Thread Rich
I found my problem... I had 2 different templates created with the
same code and I was using the wrong one

On Feb 19, 9:53 am, Rich  wrote:
> Hi I am pretty new to django and I feel like I either have some kind
> of configuration wrong or maybe im not understanding how something
> works.
>
> Whats happening is when I make a small change in one of my templates,
> the change is not reflected on my site.
>
> I have noticed that if I make significant changes in one of my views,
> I might see an update in the actual website after reloading the page
> (but it seems to be hit or miss)
>
> If I make only a small change, there is almost never an update to the
> actual website unless it is a change within a view.
>
> Changing some text within a template file yields no results.
>
> If I mess up some code i will get debugging messages, but if I fix the
> code, I get the same (cached?) result

-- 
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 Admin template

2011-05-03 Thread Rich
I know it's possible to overwrite the Django admin templates by
copying the templates to your local project.  I want to modify the
"add user" template but cannot seem to figure out which template it
is.  I want to create a button which will use APG to generate a random
password rather than typing in the password.  Anyone, have any idea
how this can be accomplished.

Thanks,
Richard

-- 
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 Admin template

2011-05-03 Thread Rich
Thanks! I will check out urls.py to find the template for that view

On May 3, 2:38 pm, Shawn Milochik  wrote:
> You can check out the urls.py in admin and use that to find the view and
> template.
>
> http://code.djangoproject.com/browser/django/trunk/django/contrib/aut...

-- 
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 Admin template

2011-05-03 Thread Rich
Thanks! Jacob.  I will check it out.

Richard

On May 3, 2:50 pm, Jacob Kaplan-Moss  wrote:
> On Tue, May 3, 2011 at 1:23 PM, Rich  wrote:
> > I know it's possible to overwrite the Django admin templates by
> > copying the templates to your local project.  I want to modify the
> > "add user" template but cannot seem to figure out which template it
> > is.  I want to create a button which will use APG to generate a random
> > password rather than typing in the password.  Anyone, have any idea
> > how this can be accomplished.
>
> You should check out the 
> docs:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-ad
> That bit walks you through the process, which is basically creating an
> "admin///.html" template with the app-specific
> template you'd like. The docs list each template that can be
> overridden; the one you want is "change_form.html". So since you're
> working on the "user" model in the "auth" app you'd create a template
> named "admin/auth/user/change_form.html".
>
> Hope that helps,
>
> Jacob

-- 
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 Admin template

2011-05-04 Thread Rich
I'm still not able to narrow down on which template I need to modify,
perhaps it is a group of templates.

This is the screen shot of the admin panel.
https://picasaweb.google.com/108522207223325173920/May42011DjangoAdmin?authkey=Gv1sRgCIbMrMaet7XudQ#5602847506056859010

In Uploader, I click on Add button which displays this panel:
https://picasaweb.google.com/108522207223325173920/May42011DjangoAdmin?authkey=Gv1sRgCIbMrMaet7XudQ#5602847508038833618

I need to create a button to automatically generate a password for a
user.

Any ideas which specific template I need to modify?

Richard

On May 3, 5:45 pm, Shawn Milochik  wrote:
> On 05/03/2011 05:39 PM, roberto wrote:
>
> > django-google-toolbar ? or django-debug-toolbar ?
>
> The latter. The former must have been a typo.
>
> https://github.com/robhudson/django-debug-toolbar

-- 
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 password reset modification

2011-05-05 Thread Rich
Django framework comes with a reset password out of the box feature.
I would like to modify this to where a password is sent to the user
via e-mail. I looked at the code in django\contib\auth\views.py
I'm not sure how I can modify it.




Django Reset Password

The Django framework comes with support for resetting user passwords.
This is implemented for the Admin app, but it is possible to re-use
from your own screens.
URLs

The following four URLs are used in the password reset

(r'^accounts/password/reset/$',
'django.contrib.auth.views.password_reset',
{'post_reset_redirect' : '/accounts/password/reset/done/'}),
(r'^accounts/password/reset/done/$',
'django.contrib.auth.views.password_reset_done'),
(r'^accounts/password/reset/(?P[0-9A-Za-z]+)-(?P.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'post_reset_redirect' : '/accounts/password/done/'}),
(r'^accounts/password/done/$',
'django.contrib.auth.views.password_reset_complete'),

Templates

The following five templates are required. These are the templates for
the four urls pointed to from the urlpatterns above, plus one template
for the email.

* registration/password_reset_complete.html
* registration/password_reset_confirm.html
* registration/password_reset_done.html
* registration/password_reset_form.html
* registration/password_reset_email.html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



custom Middleware for Django

2011-01-26 Thread Rich
I'm new to Django and trying to place a custom middleware file in the
Django path. I'm modifying the settings.py file in my project.  The
swfupload.py is located in django

/usr/lib/python2.4/site-packages/django/middleware

I had it in the project earlier but ti did not work and this does not
work either.


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'django.middleware.swfupload.SWFUploadMiddleware',
}

-- 
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: custom Middleware for Django

2011-01-27 Thread Rich
Thanks! guys for all the help

regard,
Richard

On Jan 27, 6:45 am, Piotr Kilczuk  wrote:
> > That isn't exactly mod_wsgi's fault. You should go have a read of:
>
> >  http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
>
> > some time and then you might understand the horrible things that the
> > development server does with paths.
>
> > :-)
>
> Yes, I didn't state it's mod_wsgi's fault and I'm a big fan of your script.
>
> I just recall my disappointment when I deployed Django for the first time
> and... doh! 500! But it all worked!
>
> Regards,
> Piotr

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



user profiles

2011-03-06 Thread Rich
hi i am trying to create user profiles with django , id like a user to
be able to log in through the django admin site and add things to
their profile, then view the profile on the profile page

does anyone know of any tutorial created on how to set something like
this up?

ive been reading and reading and trying things left and right and its
very frustrating

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



Designing templates for database application

2018-01-14 Thread rich
I've developed database applications before but this is my first attempt to 
use Django. I'm building a client management system for my own use and 
would like to see examples of templates for this purpose. It's not a blog 
or document-heavy app, but consists of tables (the schema's written) for 
companies, contacts, and other sales information. I've not before used 
grids or forms so these are new to me and having a template I can modify 
(or use for ideas) would be very helpful. Pointers appreciated.

Rich

-- 
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/3d529db6-3bb7-44d0-ba6d-d0a8ef2ab6bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Beginner's question

2007-07-09 Thread Chris Rich

Hi all,
  Quick question.  Is there any way to add a verbose name for one of
my apps?  I have an app named my_transfers and in the admin index view
it displays it as

My_Transfers
---
-model 1
-model 2
-blah blah blah... etc

A minor point =).

Thanks in advance.

Chris


--~--~-~--~~~---~--~~
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: Beginner's question (take two)

2007-07-09 Thread Chris Rich

Cool thanks,
  Yeah I was didn't think there was a meta class for the app names.
I'll go fiddle around with it.

Chris

On Jul 9, 3:23 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Quick question.  Is there any way to add a verbose name for
> > one of my apps?  I have an app named my_transfers and in the
> > admin index view
>
> Ah...I missed that it was the *app* not the Model that you were
> looking for.
>
> According to django/contrib/admin/templates/admin/index.html
>
> you want to affect the value of {{app_list.name}}  This is
> assigned in the django/contrib/admin/templatetags/adminapplist.py
>
> Tracing this back to db/models/base.py where it's assigned, and
> looking at several other places in the code, this looks like this
> needs to be a name that can be used in identifier contexts.
>
> However, since it's just being pulled into the template, you can
> tweak the django/contrib/admin/templates/admin/index.html and its
> kin to pull a prettified app-name if desired for presentation
> purposes, and fall back to the original code if not specified.
>
> -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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Generating graphs from db data and displaying results using Django?

2007-07-10 Thread Chris Rich

Hey all,
  So, I'm a beginner here with Django/webdesign/database stuff/all the
rest of it and I may be getting ahead of myself.  I am currently
getting my feet wet in the Django environment, but I eventually want
to graph/calculate averages on some of the values in my database.  I
would like to display the results in my Django page and maybe even
make it so I could change some of the graph parameters using some
simple Django forms.  Any ideas on the best way to go about this?
Thanks in advance.

Chris


--~--~-~--~~~---~--~~
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: DateTimeField in models renders incorrect select input

2007-10-15 Thread Rich Says...
Nevermind. You just got newbafied. Our projects override the default date
time format on the callback.
Sorry. Anyone interested in the form code can e-mail me though!


On 10/15/07, personificator <[EMAIL PROTECTED]> wrote:
>
>
> The default models.DateTimeField() renders a 1-24 hour select input
> box on the form. Isn't the proper time display from 00:00 - 23:59?
>
>
> >
>

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



Questions about css in templates

2007-11-15 Thread Chris Rich

Hi all,
  I'm new to Django and new to html/css/webdesign in general.  I have
a question about how to have my base.html template point to the
correct directory where I store my .css file for my site.

  I noticed in the admin version,  the admin .css is store in the
subdirectory /media/css/.  This path is referenced in the admin
base.html file as:



 I have all my templates in the /mytemplates/ folder and wanted to
similarly wanted to store my css in a subdirectory, /mytemplates/media/
css/base.css.  So I though I ought to put something like below in my
base.html template:



...but it doesnt like that.  I've tried typing in the full path name
and that doesn't seem to work either.  My template folder path is
indicated in my TEMPLATE_DIRS in my settings.py file for the site.  So
my big question is how do I pass the appropriate path for my css to my
template?

Please let me know if you need more info.

Thanks a bunch!
--~--~-~--~~~---~--~~
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: Questions about css in templates

2007-11-15 Thread Chris Rich

Ok,
  I just got it to work by using the {% include %} tag.  Is this a
fine way to include css stuff or should I not use this for some
reason?

Chris

On Nov 15, 3:41 pm, Chris Rich <[EMAIL PROTECTED]> wrote:
> Okay,
>   I think I am still doing something wrong.
>
> So, I went ahead and sent my MEDIA_ROOT to my filepath for my template
> folder as below:
>
> MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/
> mytemplates/media'
>
> Then I set
>
> MEDIA_URL = /mymedia/
>
> You also mentioned to activate the appropriate context processor.  I
> didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to
> begin with so I added the lines:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
> "django.core.context_processors.auth",
> "django.core.context_processors.debug",
> "django.core.context_processors.i18n",
> "django.core.context_processors.media"
> )
>
> So, I saved settings.py and edited my base.html file to have
>
> http://localhost:8000/mymedia/css/base.css{% endblock %}" >
>  in the 
>
> I can view a page that uses base.html fine.  The problem that I am
> having is that when I view a page that uses my base.html file, it
> doesnt have the styling that I laid out in the css file.  I think the
> problem is how I am refering to the path of my css file.
>
> I also tried
>
> http://localhost:8000/mymedia/css/base.css
>
> in my browser's, which i thought ought to get me to the file, and
> received a 404 error.
>
> Thanks in advance for any help. Sorry if what I am explaining is still
> unclear.
>
> Chris
>
> On Nov 15, 12:24 pm, RajeshD <[EMAIL PROTECTED]> wrote:
>
> > > 
>
> > > ...but it doesnt like that.  I've tried typing in the full path name
> > > and that doesn't seem to work either.
>
> > You need to define "doesn't seem to work" more clearly. For example,
> > if you request that stylesheet URL from your browser's URL bar, does
> > the stylesheet come up?
>
> > Also, serving of CSS (or any other static files for that matter) is
> > not automatic in Django. See this for more details:
>
> >http://www.djangoproject.com/documentation/static_files/
>
> > > My template folder path is
> > > indicated in my TEMPLATE_DIRS in my settings.py file for the site.  So
> > > my big question is how do I pass the appropriate path for my css to my
> > > template?
>
> > A good place to store your CSS is in /css/*.css where
> > MEDIA_ROOT is whatever you defined it to be in your settings file. If
> > your settings.MEDIA_ROOT and settings.MEDIA_URL are consistent with
> > each other, you can reference the MEDIA_URL in your template once you
> > activate the appropriate context processor mentioned here:
>
> >http://www.djangoproject.com/documentation/templates_python/#django-c...
--~--~-~--~~~---~--~~
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: Questions about css in templates

2007-11-15 Thread Chris Rich

Gotcha,

  Ok back to trying to figure out how to make it work properly. If you
have any comments to my 2nd post that would be greatly appreciated.

Chris

On Nov 15, 3:57 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> On Nov 15, 6:54 pm, Chris Rich <[EMAIL PROTECTED]> wrote:
>
> > Ok,
> >   I just got it to work by using the {% include %} tag.  Is this a
> > fine way to include css stuff or should I not use this for some
> > reason?
>
> Unless your CSS is very short, you should not use this technique
> because it inserts the entire CSS into the body of your HTML. Thus, a
> user's browser can not cache that CSS resource.
--~--~-~--~~~---~--~~
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: Questions about css in templates

2007-11-15 Thread Chris Rich

Awesome,
  Its working now.  Thanks again!

Chris

On Nov 15, 4:16 pm, Chris Rich <[EMAIL PROTECTED]> wrote:
> Thanks for the advice!
>
> I'll go try it right now and let you know how it goes.
>
> Chris
>
> On Nov 15, 4:03 pm, RajeshD <[EMAIL PROTECTED]> wrote:
>
> > > MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/
> > > mytemplates/media'
>
> > > MEDIA_URL = /mymedia/
>
> > > You also mentioned to activate the appropriate context processor.  I
> > > didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to
> > > begin with so I added the lines:
>
> > > TEMPLATE_CONTEXT_PROCESSORS = (
> > > "django.core.context_processors.auth",
> > > "django.core.context_processors.debug",
> > > "django.core.context_processors.i18n",
> > > "django.core.context_processors.media"
> > > )
>
> > > So, I saved settings.py and edited my base.html file to have
>
> > > http://localhost:8000/mymedia/css/base.css{% endblock %}" >
> > >  in the 
>
> > Once you have the media context processor you can make the above link
> > tag much cleaner like so:
>
> > 
>
> > That way, when you deploy your app to a production server, you won't
> > have to go back and change that reference to localhost.
>
> > > I can view a page that uses base.html fine.  The problem that I am
> > > having is that when I view a page that uses my base.html file, it
> > > doesnt have the styling that I laid out in the css file.  I think the
> > > problem is how I am refering to the path of my css file.
>
> > The problem is that there's nothing serving your CSS file :)
>
> > Again, see the documentation[1] about how to make Django serve static
> > files (like your CSS) from your MEDIA_ROOT and MEDIA_URL settings:
>
> > BIG DISCLAIMER: This static serving via Django is highly discouraged
> > in a production environment where you are recommended to use a proper
> > web server (say, Apache or Lighttpd) to serve such files.
>
> > [1]http://www.djangoproject.com/documentation/static_files/
--~--~-~--~~~---~--~~
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: Questions about css in templates

2007-11-15 Thread Chris Rich

Thanks for the advice!

I'll go try it right now and let you know how it goes.

Chris

On Nov 15, 4:03 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> > MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/
> > mytemplates/media'
>
> > MEDIA_URL = /mymedia/
>
> > You also mentioned to activate the appropriate context processor.  I
> > didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to
> > begin with so I added the lines:
>
> > TEMPLATE_CONTEXT_PROCESSORS = (
> > "django.core.context_processors.auth",
> > "django.core.context_processors.debug",
> > "django.core.context_processors.i18n",
> > "django.core.context_processors.media"
> > )
>
> > So, I saved settings.py and edited my base.html file to have
>
> > http://localhost:8000/mymedia/css/base.css{% endblock %}" >
> >  in the 
>
> Once you have the media context processor you can make the above link
> tag much cleaner like so:
>
> 
>
> That way, when you deploy your app to a production server, you won't
> have to go back and change that reference to localhost.
>
>
>
> > I can view a page that uses base.html fine.  The problem that I am
> > having is that when I view a page that uses my base.html file, it
> > doesnt have the styling that I laid out in the css file.  I think the
> > problem is how I am refering to the path of my css file.
>
> The problem is that there's nothing serving your CSS file :)
>
> Again, see the documentation[1] about how to make Django serve static
> files (like your CSS) from your MEDIA_ROOT and MEDIA_URL settings:
>
> BIG DISCLAIMER: This static serving via Django is highly discouraged
> in a production environment where you are recommended to use a proper
> web server (say, Apache or Lighttpd) to serve such files.
>
> [1]http://www.djangoproject.com/documentation/static_files/
--~--~-~--~~~---~--~~
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: Questions about css in templates

2007-11-15 Thread Chris Rich

Okay,
  I think I am still doing something wrong.

So, I went ahead and sent my MEDIA_ROOT to my filepath for my template
folder as below:

MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/
mytemplates/media'

Then I set

MEDIA_URL = /mymedia/

You also mentioned to activate the appropriate context processor.  I
didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to
begin with so I added the lines:

TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media"
)

So, I saved settings.py and edited my base.html file to have

http://localhost:8000/mymedia/css/base.css{% endblock %}" >
 in the 

I can view a page that uses base.html fine.  The problem that I am
having is that when I view a page that uses my base.html file, it
doesnt have the styling that I laid out in the css file.  I think the
problem is how I am refering to the path of my css file.

I also tried

http://localhost:8000/mymedia/css/base.css

in my browser's, which i thought ought to get me to the file, and
received a 404 error.

Thanks in advance for any help. Sorry if what I am explaining is still
unclear.

Chris

On Nov 15, 12:24 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> > 
>
> > ...but it doesnt like that.  I've tried typing in the full path name
> > and that doesn't seem to work either.
>
> You need to define "doesn't seem to work" more clearly. For example,
> if you request that stylesheet URL from your browser's URL bar, does
> the stylesheet come up?
>
> Also, serving of CSS (or any other static files for that matter) is
> not automatic in Django. See this for more details:
>
> http://www.djangoproject.com/documentation/static_files/
>
> > My template folder path is
> > indicated in my TEMPLATE_DIRS in my settings.py file for the site.  So
> > my big question is how do I pass the appropriate path for my css to my
> > template?
>
> A good place to store your CSS is in /css/*.css where
> MEDIA_ROOT is whatever you defined it to be in your settings file. If
> your settings.MEDIA_ROOT and settings.MEDIA_URL are consistent with
> each other, you can reference the MEDIA_URL in your template once you
> activate the appropriate context processor mentioned here:
>
> http://www.djangoproject.com/documentation/templates_python/#django-c...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django and MS SQL

2006-01-09 Thread Rich Bakos

I am experimenting with Django and MS SQL and it appears that Django is
passing parameters to MS SQL in an incorrect format.

The params are being passed in as a format string style (%s), which MS
SQL chokes on.

Is anyone here using MS SQL that might be able to shed some light on
this problem? I'm a bit of a Python newbie so I'm pretty unfamiliar
with the code base. Django becomes somewhat unusable to me if I can't
use it in conjunction with MS SQL.

Thanks,

Rich Bakos



Re: Django and MS SQL

2006-01-10 Thread Rich Bakos

Hi Russ,

Thanks for th tip on where to splunk for the offending code.

The SQL that is arriving at the sever is in the folowing format:
select foo from bar where foo = %sfooName

The query parser dies at %s with an invalid syntax exception...

The syntax that MS SQL expects:
select foo from bar where foo = @fooName

MS SQL uses the @ sybol for parameter declaration.

When I get in from of my dev machine, I'll post the traceback for
Adrian to look at.

- Rich



Re: Django and MS SQL

2006-01-10 Thread Rich Bakos


Adrian Holovaty wrote:

Hi Adrian,

> Could you paste the entire traceback you get? Also, would any other MS
> SQL users in the audience be able to help?

Here is an entire traceback I get when attempting to access the /admin
site:

Traceback (most recent call last):

  File "C:\Python24\lib\site-packages\django\core\servers\basehttp.py",
line 272, in run
self.result = application(self.environ, self.start_response)

  File "C:\Python24\lib\site-packages\django\core\servers\basehttp.py",
line 615, in __call__
return self.application(environ, start_response)

  File "C:\Python24\lib\site-packages\django\core\handlers\wsgi.py",
line 161, in __call__
response = middleware_method(request, response)

  File "C:\Python24\lib\site-packages\django\middleware\sessions.py",
line 74, in process_response
session_key = request.session.session_key or
sessions.get_new_session_key()

  File "C:\Python24\lib\site-packages\django\models\core.py", line 110,
in _module_get_new_session_key
get_object(session_key__exact=session_key)

  File "C:\Python24\lib\site-packages\django\utils\functional.py", line
3, in _curried
return args[0](*(args[1:]+moreargs), **dict(kwargs.items() +
morekwargs.items()))

  File "C:\Python24\lib\site-packages\django\core\meta\__init__.py",
line 1355, in function_get_object
obj_list = function_get_list(opts, klass, **kwargs)

  File "C:\Python24\lib\site-packages\django\core\meta\__init__.py",
line 1395, in function_get_list
return list(function_get_iterator(opts, klass, **kwargs))

  File "C:\Python24\lib\site-packages\django\core\meta\__init__.py",
line 1378, in function_get_iterator
cursor.execute("SELECT " + (kwargs.get('distinct') and "DISTINCT "
or "") + ",".join(select) + sql, params)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 592,
in execute
self.executeHelper(operation,0,parameters)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 552,
in executeHelper
self._raiseCursorError(DatabaseError,tracebackhistory)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 407,
in _raiseCursorError
eh(self.conn,self,errorclass,errorvalue)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 38,
in standardErrorHandler
raise errorclass(errorvalue)

DatabaseError:
---
Strategy 1: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 539,
in executeHelper
raise DatabaseError(e)
 DatabaseError: (-2147352567, 'Exception occurred.', (0,
'ADODB.Parameters', 'Item cannot be found in the collection
corresponding to the requested name or ordinal.',
'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240649, -2146825023), None)


---
Strategy 2: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 540,
in executeHelper
adoRetVal=self.cmd.Execute()
   File "", line 3, in Execute
   File "C:\Python24\lib\site-packages\win32com\client\dynamic.py",
line 251, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType,
argTypes) + args)
 com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB
Provider for SQL Server', "Line 1: Incorrect syntax near 's'.", None,
0, -2147217900), None)


---
Strategy 3: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 539,
in executeHelper
raise DatabaseError(e)
 DatabaseError: (-2147352567, 'Exception occurred.', (0,
'ADODB.Parameters', 'Item cannot be found in the collection
corresponding to the requested name or ordinal.',
'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240649, -2146825023), None)


---
Strategy 4: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 540,
in executeHelper
adoRetVal=self.cmd.Execute()
   File "", line 3, in Execute
   File "C:\Python24\lib\site-packages\win32com\client\dynamic.py",
line 251, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType,
argTypes) + args)
 com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB
Provider for SQL Server', "Line 1: Incorrect syntax near 's'.", None,
0, -2147217900), None)

--- ADODBAPI on command:SELECT
[core_sessions].[session_key],[core_sessions].[session_data],[core_sessions].[expire_date]
FROM [core_sessions] WHERE [core_sessions].[session_key] = %s with
parameters: ['1be3c794e7f7b0758d8b108f406bbd19']


Here is the exact SQL that is passed to MS SQL:

SELECT
[core_sessions].[session_key],[core_sessions].[session_data],[core_sessions].[expire_date]
FROM [core_sessions] WHERE [core_sessions].[session_key] = %s

As you can see, it has stopped at %s.

Is there anything I can do to help?

Rich



Re: Django and MS SQL

2006-01-10 Thread Rich Bakos


Jeremy Dunck wrote:

Hi Jeremy,

> > The syntax that MS SQL expects:
> > select foo from bar where foo = @fooName
>
> Are we talking about literals or parameters?

I'm talking about parameters.

> That is, are you expecting:
>
> select colname from tablename where colname = 'somevalue'
> or
> select colname from tablename where colname = @somevariableholdingavalue
> ?

I'm expecting the latter but %s is being passed to the engine rather
than @, causing the query to fail.

See the traceback I posted for Adrian for a clear look at what I'm
talking about.

The example traceback I posted for Adrian occurs for every query Django
tries to run against MS SQL .

E.G - an insert query is being passed as:

Insert into T1 value1, value2 values(%s, %s)

Rich



Re: Django and MS SQL

2006-01-10 Thread Rich Bakos


Jeremy Dunck wrote:

Hi Jeremy,

> Yeah, adodbapi was doing something weird with the executeHelper, so we did 
> this:

Yeah I worked that out but haven't gotten too far. I had to make a
modification to function_get_sql_clause to support the MS TOP keyword.
Also had to modify method_save to provide TOP support also.

Now I'm stuck, again. :-/

Here is my latest traceback showing that date types are not being
converted from their string representation into the actual data type:

Traceback (most recent call last):

  File "C:\Python24\lib\site-packages\django\core\servers\basehttp.py",
line 272, in run
self.result = application(self.environ, self.start_response)

  File "C:\Python24\lib\site-packages\django\core\servers\basehttp.py",
line 615, in __call__
return self.application(environ, start_response)

  File "C:\Python24\lib\site-packages\django\core\handlers\wsgi.py",
line 161, in __call__
response = middleware_method(request, response)

  File "C:\Python24\lib\site-packages\django\middleware\sessions.py",
line 76, in process_response
datetime.datetime.now() +
datetime.timedelta(seconds=SESSION_COOKIE_AGE))

  File "C:\Python24\lib\site-packages\django\models\core.py", line 118,
in _module_save
s.save()

  File "C:\Python24\lib\site-packages\django\utils\functional.py", line
3, in _curried
return args[0](*(args[1:]+moreargs), **dict(kwargs.items() +
morekwargs.items()))

  File "C:\Python24\lib\site-packages\django\core\meta\__init__.py",
line 1031, in method_save
','.join(placeholders)), db_values)

  File "C:\Python24\lib\site-packages\django\core\db\base.py", line 10,
in execute
result = self.cursor.execute(sql, params)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 592,
in execute
self.executeHelper(operation,0,parameters)

  File
"C:\Python24\lib\site-packages\django\core\db\backends\ado_mssql.py",
line 39, in executeHelper
old_executeHelper(self, operation, isStoredProcedureCall,
parameters)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 552,
in executeHelper
self._raiseCursorError(DatabaseError,tracebackhistory)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 407,
in _raiseCursorError
eh(self.conn,self,errorclass,errorvalue)

  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 38,
in standardErrorHandler
raise errorclass(errorvalue)

DatabaseError:
---
Strategy 1: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 539,
in executeHelper
raise DatabaseError(e)
 DatabaseError: (-2147352567, 'Exception occurred.', (0,
'ADODB.Parameter', 'Application uses a value of the wrong type for the
current operation.', 'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240652,
-2146824867), None)


---
Strategy 2: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 540,
in executeHelper
adoRetVal=self.cmd.Execute()
   File "", line 3, in Execute
   File "C:\Python24\lib\site-packages\win32com\client\dynamic.py",
line 251, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType,
argTypes) + args)
 com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB
Provider for SQL Server', 'Syntax error converting character string to
smalldatetime data type.', None, 0, -2147217913), None)


---
Strategy 3: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 539,
in executeHelper
raise DatabaseError(e)
 DatabaseError: (-2147352567, 'Exception occurred.', (0,
'ADODB.Parameter', 'Application uses a value of the wrong type for the
current operation.', 'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240652,
-2146824867), None)


---
Strategy 4: Traceback:Traceback (most recent call last):
   File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 540,
in executeHelper
adoRetVal=self.cmd.Execute()
   File "", line 3, in Execute
   File "C:\Python24\lib\site-packages\win32com\client\dynamic.py",
line 251, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType,
argTypes) + args)
 com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB
Provider for SQL Server', 'Syntax error converting character string to
smalldatetime data type.', None, 0, -2147217913), None)

--- ADODBAPI on command:INSERT INTO [core_sessions]
([session_key],[session_data],[expire_date]) VALUES (?,?,?) with
parameters: ['73f7cab87733fc1fac258676de931134',
'KGRwMQpTJ3Rlc3Rjb29raWUnCnAyClMnd29ya2VkJwpwMwpzLjIxNzM0ZjA3YjI4OWFmYWVhNzBi\nZGE5MTBmMWVmYzU5\n',
'2006-01-24 21:45:11.166000']

Any advise?

Thanks,

Rich



Re: Django and MS SQL

2006-01-12 Thread Rich Bakos


Jeroen Ruigrok van der Werven wrote:

Hi Jeroen,

> Can a bunch of us get together to get a/the pymssql driver fully
> operational and Django running as it should?

The pymssql driver only supports DB-LIB, which is way outdated and you
wont have access to functionality added to MSSQL after version 6.5.
This is not the best option IMHO.

Rich



Re: Django and MS SQL

2006-01-23 Thread Rich Bakos


Cheng Zhang wrote:

Hi Cheng,

> Actually my previous statement isn't correct, I just realized that
> pymssql also claimed to work on Windows, except it will use M$'s
> native libraries instead of FreeTDS.

You worked this out quicker than I ever could have. Thanks.



Earn 25$ to add Email Notification support to Django-Userena

2011-10-05 Thread Rich Jones
Hey all!

I've opened a 25$ gig on Gun.io to add Email Notification support to
Django-Userena. First person to get a pull request accepted will earn
the money!

http://gun.io/open/11/add-email-notifcations-to-django-userena-umessages

Thought you guys might be interested in earning a quick bit of money
to work on an open source project.

Rich

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



IOError: request data read error

2011-11-21 Thread Rich Jones
Uh-oh, some of you are saying, not this one again!..

I've read all of the posts on this error that I could find, but I'm
still not finding anything useful. Can somebody please explain what
this error is all about? It happens only on the POST requests to one
of my pages. It isn't a page which has an image upload, only text.

This is Python 2.6, modwsgi 2.8-2ubuntu1, and Django 1.3.

What's going on? Is it really some user just cancelling during the
POST over and over again? Does it have to do with server load? My
apache settings?

I can provide full trace if it will be useful.

Thanks so much!
Rich

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



Deverifying a URLField

2012-01-24 Thread Rich Jones
Hello, all!

I have a small conundrum I could use a hand with.

I have a deployed Django application with a Model which has a
URLField:

project_homepage = models.URLField('Project Homepage', blank=True)

and a ModelForm to create the parent object.

Currently, the application checks to see if this is a valid URL. I
would like this to be unvalidated instead.

How do I go about changing it? Will I need to do a database migration
to do this? Or can I just add a 'verified=False' and run syncdb?

Thanks so much!
Rich

-- 
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: Any Tutorials on Django similar to Web2py ????????????????

2013-08-20 Thread Rich Haase
I second the book recommendation.  I had a cursory knowledge of django
(enough to get myself in trouble) prior to reading 2 scoops of django.  Now
I have enough knowledge to really make a mess... j/k.  It's a great book
for learning about the nitty gritty of django development and informing the
questions you will ask.

Cheers,

rich


On Tue, Aug 20, 2013 at 12:48 PM, Sergio Infante Montero <
raulserg...@gmail.com> wrote:

> Maybe, you need some book like this
>
> https://django.2scoops.org/
>
> Regards
>
> On Tue, Aug 20, 2013 at 11:21 AM, Marcos Moyano 
> wrote:
> > There are several ways to manage sessions, or cache. That's up to you
> > according to your needs.
> > You can find documentation about sessions, caching and much more here:
> > https://docs.djangoproject.com/en/1.5/
> >
> > Rgds
> >
> >
> > On Tue, Aug 20, 2013 at 1:12 PM, JAI PRAKASH SINGH
> >  wrote:
> >>
> >> Thank you sir, but i need that kind of tutorials which is complete , in
> >> terms of security, session, cache like udacity  tutorilas on web2py ..
> on
> >> web development.
> >>
> >> Please revert back if u have any kind of link on it
> >>
> >>
> >> On Tue, Aug 20, 2013 at 9:35 PM, carlos  wrote:
> >>>
> >>> https://docs.djangoproject.com/en/1.5/intro/tutorial01/
> >>>
> >>> Cheers
> >>>
> >>>
> >>> On Tue, Aug 20, 2013 at 9:57 AM, JAI PRAKASH SINGH
> >>>  wrote:
> >>>>
> >>>> Any Tutorials on Django similar to Web2py 
> >>>>
> >>>> --
> >>>> 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.
> >>>> For more options, visit https://groups.google.com/groups/opt_out.
> >>>
> >>>
> >>> --
> >>> You received this message because you are subscribed to a topic in the
> >>> Google Groups "Django users" group.
> >>> To unsubscribe from this topic, visit
> >>> https://groups.google.com/d/topic/django-users/8i61qvs2tn4/unsubscribe
> .
> >>> To unsubscribe from this group and all its topics, 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.
> >>> For more options, visit https://groups.google.com/groups/opt_out.
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to django-users+unsubscr...@googlegroups.com.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/django-users.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
> >
> > --
> > Some people, when confronted with a problem, think “I know, I'll use
> regular
> > expressions.” Now they have two problems.
> >
> > Jamie Zawinski, in comp.emacs.xemacs
> >
> > --
> > 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.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> Sergio Infante Montero
> http://about.me/neosergio
> @neosergio
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
*Kernighan's Law*
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it."

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: JSON or YAML?

2013-08-30 Thread Rich Haase
Personal preference.  Python has excellent libraries to support parsing both 
JSON and YAML.

Sent from my iPhone

On Aug 30, 2013, at 7:34 AM, Floor Tile  wrote:

> Helle everybody,
> 
> Just a short and simple question:
> 
> It seams that both JSON and YAML can be used for initial data loading. (among 
> other data types but I don't care about them for the moment)
> But can't figure out what the up and/or downsides of them are.
> Is it purely a matter of personal preference or there one better to use than 
> the other for initial data loading. And which one would be the most 
> preferred, if this is the case?
> 
> Many thanks in advance!
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Reliable and cheap hosting for simple webapp in Django

2013-09-10 Thread Rich Haase
Try one of the following:

Gondor
GoogleApp Engine
Heroku


On Tue, Sep 10, 2013 at 3:55 PM, Andre Lopes  wrote:

> Hi all,
>
> I'm stuck with Django hosting. I've A2hosting but the Django hosting
> is not good at all.
>
> They use FCGI and Passenger and both have a problem.
>
> If I'm more than 15min without doing a request to the site, the first
> request is very slow and most of the time will do an Internal Server
> Error.
>
> There is any Django hosting on the cheap that works without this kind
> of problems? The website have 5/10 visits a day.
>
> I wait for reply.
>
> Best Regards,
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
*Kernighan's Law*
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it."

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New Feature

2013-10-12 Thread Rich Haase
As with all software the best solutions are written to solve a problem that 
bugs the developer.  Find something that you find troublesome on a regular 
basis, then code a solution.

Sent from my iPhone

> On Oct 12, 2013, at 12:26 AM, jasvir singh  
> wrote:
> 
> Hello everyone.
> 
> I am new to this mailing list, but have a long relationship with django.
> I want to add something new to django, a new package to django.
> Please suggest me to do something creative. 
> Previously I was thinking to create a package to embed youtube videos, but 
> packages for same already exist. Same thing happened with chatting package.
> I want to create a new package.
> Please suggest me something.
> -- 
> Mr. Singh
> -- 
> 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/CANJu%3DjFHGjVp%3Dv05zz4XJuRp9rFccSHg8wRcDAkpDMU1RKX6bw%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5E90CD2D-B9E4-446D-B09E-C012CBCD4A0E%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Midlands Django Jedi needed

2011-06-20 Thread Rich Catley
Dear all

We have an opening for a Django/Python developer. Role is based in the
Midlands, UK. Great environment, great team. Get in contact for more
details.

Thanks
Rich

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



What are the advantages of Model inheritance?

2011-06-23 Thread Rich Jones
Other than the convenience of writing them, I can't seem to find any
advantages of using model inheritance.

Please allow me to explain the trouble I am having with an example.
Suppose,

class Post(models.Model):
title = models.CharField(max_length=200)
user_owner_id = models.ForeignKey(User)

def __unicode__(self):
return self.title

class BetterPost(Post):
description = models.CharField(max_length=200)

def __unicode__(self):
return self.title

Now, in the template:

{% with profile.user.post_set.select_related as posts %}
{% for post in posts %}
{{post}}
{% empty %}
No posts!
{% endfor %}
{% endwith %}

{% with profile.user.betterpost_set.select_related as posts %}
{% for post in posts %}
{{post}}
{% empty %}
No posts!
{% endfor %}
{% endwith %}

If there are 2 'Posts' and 1 'BetterPost', the template code will
print all of the posts in the first loop, then none in the second loop
set.

So why would I use model inheritance if this is the kind of behavior I
can expect? If I can't get a set and can't access the fields, why
wouldn't I just copy the fields into BetterPost rather than extending
Post?

Thank you for reading!
R

-- 
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: What are the advantages of Model inheritance?

2011-06-23 Thread Rich Jones
Where would _meta need to go?

This code does appear to work the way I am describing it, this is just
a slightly stripped down of a real application I have made.

R

On Jun 23, 4:59 pm, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> I might be wrong here, but I'm fairly sure that the below example you pasted 
> is invalid code (i.e. you need to add a proxy _meta??).
> My apologies if I'm wrong though, as I have never encountered a need to do 
> this before, and just going off vague memory.
> Cal
> On 23/06/2011 19:24, Rich Jones wrote:Other than the convenience of writing 
> them, I can't seem to find any advantages of using model inheritance. Please 
> allow me to explain the trouble I am having with an example. Suppose, class 
> Post(models.Model): title = models.CharField(max_length=200) user_owner_id = 
> models.ForeignKey(User) def __unicode__(self): return self.title class 
> BetterPost(Post): description = models.CharField(max_length=200) def 
> __unicode__(self): return self.title Now, in the template: {% with 
> profile.user.post_set.select_related as posts %} {% for post in posts %} 
> {{post}} {% empty %} No posts! {% endfor %} {% endwith %} {% with 
> profile.user.betterpost_set.select_related as posts %} {% for post in posts 
> %} {{post}} {% empty %} No posts! {% endfor %} {% endwith %} If there are 2 
> 'Posts' and 1 'BetterPost', the template code will print all of the posts in 
> the first loop, then none in the second loop set. So why would I use model 
> inheritance if this is the kind of behavior I can expect? If I can't get a 
> set and can't access the fields, why wouldn't I just copy the fields into 
> BetterPost rather than extending Post? Thank you for reading! R

-- 
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: What are the advantages of Model inheritance?

2011-06-23 Thread Rich Jones
Even ignoring the select_related then - the fact is that

user.post_set works and user.betterpost_set won't work, seemingly as
the result of using model inheritance.

Perhaps I could get all of the posts (post and betterposts) and then
filter by time? Does that make sense / is there a way to do that in
the template?

R

On Jun 23, 5:40 pm, Micky Hulse  wrote:
> On Thu, Jun 23, 2011 at 2:17 PM, bruno desthuilliers
>
>  wrote:
> > FWIW, I have been using model inheritance - abstract and concrete - in
> > half a dozen projects, with about 30 model subclasses in one of them,
> > and it JustWorks(tm).
>
> That sounds pretty sweet! :D
>
> I would love to see some examples.
>
> I have been using abstract models for some of my projects... I find
> them extremely useful:
>
> https://gist.github.com/1043698
>
> It works for me... Of course, I am still a noobie to Python/Django, so
> may the feedback be kind. :: crosses fingers :: :D

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



FieldError, But Only In Production

2014-02-12 Thread Rich Jones
Hey guys!

I've got a real stumper here. Pulling my hair out over this one, would 
really appreciate some options!

Anywhere in my application that calls user.get_profile() causes a 
FieldError.. but only in production. I'm using WSGI and Apache.

When I run locally with:

 python manage.py runserver 0.0.0.0:

it works just fine. However, running the exact same code and the exact same 
database with Apache, I get a 500 and find this in the logs:

 [Wed Feb 12 21:23:21 2014] [error] [client] FieldError: Cannot resolve 
keyword 'user' into field. Choices are: about_me, about_me_mkd, etc..

(Full traceback: http://pastebin.com/6141pHZ2)

When I run sqlall, there is a users_id entry for the model:

"user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id") 
DEFERRABLE INITIALLY DEFERRED

What could possibly be happening here? What could the difference between 
devserver and Apache?

(For reference, this is using Django-Userena 1.0, Django 1.3.7. and 
Postgres 8.4.)

I've tried a few things I found on the internet:

http://stackoverflow.com/questions/19145787/fielderror-cannot-resolve-keyword--into-field
http://chase-seibert.github.io/blog/2010/04/30/django-manytomany-error-cannot-resolve-keyword-xxx-into-a-field.html

Which both suggest that it has something to do with the order of the 
imports, but I haven't had any success with this approach.

There is an extremely old Django bug seemingly related to this,

https://code.djangoproject.com/ticket/1796

but I don't know how relevant this is, as this is not a ManyToMany problem, 
because Userena uses a OneToOne field:

user = models.OneToOneField(User,
unique=True,
verbose_name=_('user'),
related_name='profile')

Can anybody help me? I'm going nuts over here. I just don't know why the 
behavior would be different for runserver and Apache! 

Any ideas?

Thanks so much!,
Rich 

-- 
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/41e0fdbe-520d-44a4-b3b5-ee4914d0e099%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: FieldError, But Only In Production

2014-02-13 Thread Rich Jones
Yes, all of these things worked just fine. The code is in the _same
location_ on the _same machine_ with the _same settings_ and the _same
database_. The only difference is devserver vs Apache.

:(


On Thu, Feb 13, 2014 at 2:21 AM, Vibhu Rishi  wrote:

> Seems to me somewhere in the code it is trying to put user into a field
> instead of treating it as a table.
> Basic sanity checks :
> - is the djagno versions on both production and local same ?
> - same for wsgi and apache ?
> - syncdb worked fine ?
>
> V.
>
>
>
> On Thu, Feb 13, 2014 at 11:30 AM, Rich Jones  wrote:
>
>> Hey guys!
>>
>> I've got a real stumper here. Pulling my hair out over this one, would
>> really appreciate some options!
>>
>> Anywhere in my application that calls user.get_profile() causes a
>> FieldError.. but only in production. I'm using WSGI and Apache.
>>
>> When I run locally with:
>>
>>  python manage.py runserver 0.0.0.0:
>>
>> it works just fine. However, running the exact same code and the exact
>> same database with Apache, I get a 500 and find this in the logs:
>>
>>  [Wed Feb 12 21:23:21 2014] [error] [client] FieldError: Cannot
>> resolve keyword 'user' into field. Choices are: about_me, about_me_mkd,
>> etc..
>>
>> (Full traceback: http://pastebin.com/6141pHZ2)
>>
>> When I run sqlall, there is a users_id entry for the model:
>>
>> "user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id")
>> DEFERRABLE INITIALLY DEFERRED
>>
>> What could possibly be happening here? What could the difference between
>> devserver and Apache?
>>
>> (For reference, this is using Django-Userena 1.0, Django 1.3.7. and
>> Postgres 8.4.)
>>
>> I've tried a few things I found on the internet:
>>
>>
>> http://stackoverflow.com/questions/19145787/fielderror-cannot-resolve-keyword--into-field
>>
>> http://chase-seibert.github.io/blog/2010/04/30/django-manytomany-error-cannot-resolve-keyword-xxx-into-a-field.html
>>
>> Which both suggest that it has something to do with the order of the
>> imports, but I haven't had any success with this approach.
>>
>> There is an extremely old Django bug seemingly related to this,
>>
>> https://code.djangoproject.com/ticket/1796
>>
>> but I don't know how relevant this is, as this is not a ManyToMany
>> problem, because Userena uses a OneToOne field:
>>
>> user = models.OneToOneField(User,
>> unique=True,
>> verbose_name=_('user'),
>> related_name='profile')
>>
>> Can anybody help me? I'm going nuts over here. I just don't know why the
>> behavior would be different for runserver and Apache!
>>
>> Any ideas?
>>
>> Thanks so much!,
>> Rich
>>
>>  --
>> 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/41e0fdbe-520d-44a4-b3b5-ee4914d0e099%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/E4UVZHf6kP8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAPiONw%3DwazFkycVy%3DAwoj99uq4RgqhFu%2B2iotZz712AKa0U%3DYQ%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADJYzxLTsF19wSLdztgyoBPDOU2m9_4dQqdd0kqLKyka7MMV9w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: FieldError, But Only In Production

2014-02-13 Thread Rich Jones
Since this seems to happening at a pretty deep level, would it be uncouth
to kick this over do django-dev?


On Thu, Feb 13, 2014 at 9:17 AM, Rich Jones  wrote:

> Yes, all of these things worked just fine. The code is in the _same
> location_ on the _same machine_ with the _same settings_ and the _same
> database_. The only difference is devserver vs Apache.
>
> :(
>
>
> On Thu, Feb 13, 2014 at 2:21 AM, Vibhu Rishi wrote:
>
>> Seems to me somewhere in the code it is trying to put user into a field
>> instead of treating it as a table.
>> Basic sanity checks :
>> - is the djagno versions on both production and local same ?
>> - same for wsgi and apache ?
>> - syncdb worked fine ?
>>
>> V.
>>
>>
>>
>> On Thu, Feb 13, 2014 at 11:30 AM, Rich Jones  wrote:
>>
>>> Hey guys!
>>>
>>> I've got a real stumper here. Pulling my hair out over this one, would
>>> really appreciate some options!
>>>
>>> Anywhere in my application that calls user.get_profile() causes a
>>> FieldError.. but only in production. I'm using WSGI and Apache.
>>>
>>> When I run locally with:
>>>
>>>  python manage.py runserver 0.0.0.0:
>>>
>>> it works just fine. However, running the exact same code and the exact
>>> same database with Apache, I get a 500 and find this in the logs:
>>>
>>>  [Wed Feb 12 21:23:21 2014] [error] [client] FieldError: Cannot
>>> resolve keyword 'user' into field. Choices are: about_me, about_me_mkd,
>>> etc..
>>>
>>> (Full traceback: http://pastebin.com/6141pHZ2)
>>>
>>> When I run sqlall, there is a users_id entry for the model:
>>>
>>> "user_id" integer NOT NULL UNIQUE REFERENCES "auth_user" ("id")
>>> DEFERRABLE INITIALLY DEFERRED
>>>
>>> What could possibly be happening here? What could the difference between
>>> devserver and Apache?
>>>
>>> (For reference, this is using Django-Userena 1.0, Django 1.3.7. and
>>> Postgres 8.4.)
>>>
>>> I've tried a few things I found on the internet:
>>>
>>>
>>> http://stackoverflow.com/questions/19145787/fielderror-cannot-resolve-keyword--into-field
>>>
>>> http://chase-seibert.github.io/blog/2010/04/30/django-manytomany-error-cannot-resolve-keyword-xxx-into-a-field.html
>>>
>>> Which both suggest that it has something to do with the order of the
>>> imports, but I haven't had any success with this approach.
>>>
>>> There is an extremely old Django bug seemingly related to this,
>>>
>>> https://code.djangoproject.com/ticket/1796
>>>
>>> but I don't know how relevant this is, as this is not a ManyToMany
>>> problem, because Userena uses a OneToOne field:
>>>
>>> user = models.OneToOneField(User,
>>> unique=True,
>>> verbose_name=_('user'),
>>> related_name='profile')
>>>
>>> Can anybody help me? I'm going nuts over here. I just don't know why the
>>> behavior would be different for runserver and Apache!
>>>
>>> Any ideas?
>>>
>>> Thanks so much!,
>>> Rich
>>>
>>>  --
>>> 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/41e0fdbe-520d-44a4-b3b5-ee4914d0e099%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Simplicity is the ultimate sophistication. - Leonardo da Vinci
>> Life is really simple, but we insist on making it complicated. -
>> Confucius
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/E4UVZHf6kP8/unsubscribe.
>> To unsubscribe fr

Re: FieldError, But Only In Production

2014-02-13 Thread Rich Jones
Ah, okay, noted, although I believe this may be a bug in Django itself but
want to exhaust everything before I open a ticket.

-- 
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/CADJYzxKkn1h2eb6siuNbxy%3DCfK636WmPi%3DKf%2BvqDs0hcmmY7xg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: FieldError, But Only In Production

2014-02-13 Thread Rich Jones
> Please show how you are doing this.

Using mod_wsgi and Apache, using I think a fairly standard .wsgi:

import os, sys

path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if path not in sys.path:
sys.path.append(path)

sys.path.append('/srv/myapp')

os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

With this in my sites_enabled:

WSGIScriptAlias / /srv/myapp/myapp/django.wsgi

Also, keep in mind that the application does _run_ with Apache, it is only
on calls related to user.get_profile() which causes the problem.

Is there anything else you'd need to know?

On Thu, Feb 13, 2014 at 3:01 PM, Tom Evans  wrote:

> On Thu, Feb 13, 2014 at 6:00 AM, Rich Jones  wrote:
> > Hey guys!
> >
> > I've got a real stumper here. Pulling my hair out over this one, would
> > really appreciate some options!
> >
> > Anywhere in my application that calls user.get_profile() causes a
> > FieldError.. but only in production. I'm using WSGI and Apache.
> >
>
> Please show how you are doing this.
>
> I suspect mod_wsgi might be using a different version of django,
> perhaps one in the system install.
>
> However, that is all just speculative without the config and comparing
> it with how you start 'runserver'.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/E4UVZHf6kP8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAFHbX1L%2BhYT32SnOwphBDJzmhpLTHDCe%2BQsA3dWFwwceqyLZHw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADJYzx%2BZPnFUP4xX7HYusLCLWoodBjjqmWH98ZPYkH3nERf2eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: FieldError, But Only In Production

2014-02-13 Thread Rich Jones
Said fuck it, gave up and used Nginx + Gunicorn.

We're good now. No idea what the hell was happening, but this works now.
Humbling to realize how little I know about the ORM internals.

Thanks for listening,
R

On Thu, Feb 13, 2014 at 3:13 PM, Rich Jones  wrote:

>
> > Please show how you are doing this.
>
> Using mod_wsgi and Apache, using I think a fairly standard .wsgi:
>
> import os, sys
>
> path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> if path not in sys.path:
> sys.path.append(path)
>
> sys.path.append('/srv/myapp')
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> With this in my sites_enabled:
>
> WSGIScriptAlias / /srv/myapp/myapp/django.wsgi
>
> Also, keep in mind that the application does _run_ with Apache, it is only
> on calls related to user.get_profile() which causes the problem.
>
> Is there anything else you'd need to know?
>
>
> On Thu, Feb 13, 2014 at 3:01 PM, Tom Evans wrote:
>
>> On Thu, Feb 13, 2014 at 6:00 AM, Rich Jones  wrote:
>> > Hey guys!
>> >
>> > I've got a real stumper here. Pulling my hair out over this one, would
>> > really appreciate some options!
>> >
>> > Anywhere in my application that calls user.get_profile() causes a
>> > FieldError.. but only in production. I'm using WSGI and Apache.
>> >
>>
>> Please show how you are doing this.
>>
>> I suspect mod_wsgi might be using a different version of django,
>> perhaps one in the system install.
>>
>> However, that is all just speculative without the config and comparing
>> it with how you start 'runserver'.
>>
>> Cheers
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/E4UVZHf6kP8/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/CAFHbX1L%2BhYT32SnOwphBDJzmhpLTHDCe%2BQsA3dWFwwceqyLZHw%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADJYzxJGMNbfqGhsDZkmUdAy1nKfy%3DcFbHEMmXex51A1p4FR4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: FieldError, But Only In Production

2014-02-14 Thread Rich Jones
> are you using virtualenv?  it's possible that mod_wsgi was executing
> in a different environment than the test server.
>

>Or mod_wsgi is compiled for a different version of python and thus is
>finding completely different libraries.

Heh, it was neither of those things. No virtualenv on the machine, so
that's the same, and then mod_wsgi was version 2.6 and so is Python.

No matter now, but the mystery remains.



On Fri, Feb 14, 2014 at 1:34 AM, Tom Evans  wrote:

> On Fri, Feb 14, 2014 at 12:38 AM, Javier Guerra Giraldez
>  wrote:
> > On Thu, Feb 13, 2014 at 7:09 PM, Rich Jones  wrote:
> >> We're good now. No idea what the hell was happening, but this works now.
> >> Humbling to realize how little I know about the ORM internals.
> >
> >
> > are you using virtualenv?  it's possible that mod_wsgi was executing
> > in a different environment than the test server.
> >
>
> Or mod_wsgi is compiled for a different version of python and thus is
> finding completely different libraries.
>
> No matter now...
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/E4UVZHf6kP8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAFHbX1%2ByzgtR8SXh9o5Yh_%2BsyxiPn5b40jR7AD7D2OGMPSNAuA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADJYzxJBFsJFves0djRX8gWEiYVhTywgizUR7ZrRha_xgK2_VA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Any interest in update_fields=dict(...)?

2014-06-10 Thread Rich Rauenzahn

I have a use case where I am retroactively adding save(update_fields=...) 
to an existing code base.  Sometimes the code is structured such that 
'self' of the model is modified in other helper methods of the model, but 
not saved immediately.  It seems like it would be useful to restructure the 
code such that these other methods modify a dict I pass around, and then 
when I am ready to save, I pass that dict to save() -- rather than guessing 
-- and hoping -- that I've listed (and kept up to date!) all of the 
relevant fields in the update_fields list.

It's kinda like:

class Foo(Model):
 
 def _go_do_the_complicated_stuff(self):
 self.a = ...
 self.b = ...
 ...

 def doit(self):
 self._go_do_the_complicated_stuff()
 self.done = True
 self.save(update_fields=[u???])

Where it could be:

class Foo(Model):
 
 def _go_do_the_complicated_stuff(self):
 return dict(a = ...,
 b = ...,
 ...)

 def doit(self):
 updates = self._go_do_the_complicated_stuff()
 updates['done'] = True
 self.save(update_fields=updates)

I like this because it is easy to inspect what is getting saved (and should 
be saved) at save time.

Implementation-wise, django would check update_fields for a dict (or just 
use another key) and do something like:

 for attr, value in d.iteritems(): 
setattr(self, attr, value)
 self.save(update_fields=d.keys())

Now, I know I can just make my own mixin (maybe add a save_dict()) to do 
this, but it seemed like something worth sharing.



Rich

-- 
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/6f7f4bd1-1f63-4c16-92a8-600392792ff1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Constraints across foreign keys

2017-12-04 Thread Rich Rauenzahn

Let's say I have:

class Restaurant(Model):
   pass

class Table(Model)
   restaurant = ForeignKey(Restaurant)

class Chair(Model)
   restaurant = ForeignKey(Restaurant)
   table = ForeignKey(Table)

Is there a best practice for ensuring that the chair assigned to a table is 
always from the same restaurant?  These models above assume that we might 
have spare chairs not yet assigned to tables.

My actual case is more like this:

class A(Model):
   pass

class B(Model):
   a = ForeignKey(A)

class C(Model):
   a = ForeignKey(A)

class D(Model):
   b = ForeignKey(B)
   c = ForeignKey(C)

And I want to ensure b.a == c.a.

(I think I just have to manually add db sql constraints in my migrations 
and also override save())

Are there any well supported / used django packages to manage this for me?  
This https://github.com/rapilabs/django-db-constraints looks promising, but 
is awfully quiet.

Rich


-- 
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/eea28a8f-4a73-4f74-a182-d6ade68a6737%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Testing

2018-01-14 Thread Rich Shepard

  I've not received messages from this mail list since last summer. I now
have a need to communicate with others and learned that I'm still subscribed
so I want to learn if this message posts and is sent back to me by the MLM.

Rich

--
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/alpine.LNX.2.20.1801141304320.5312%40salmo.appl-ecosys.com.
For more options, visit https://groups.google.com/d/optout.


multidb, don't create one of them during unit tests

2018-05-29 Thread Rich Rauenzahn
I'm using Django's (1.11) typical default db for my regular Django 
development, but I need to integrate with someone else's bugzilla db server 
running on mysql somewhere else (no web api available, mysql is the 
recommendation from them). So I've added a 2nd DB to my DB config 
pointing to their server.  I've used inspectdb to bring in their schema as 
models.

They have both a production instance and a test instance for reading bugs.  
These are both read only.

I'd like my unit tests to skip creating the test instance of their DB 
(since I'm not even running a mysql server to use, I don't have write 
access to theirs, and their test instance is already populated) and to just 
point my unit tests at their test instance.

I see I can override the TestRunner 

https://stackoverflow.com/questions/5917587/django-unit-tests-without-a-db

setup_databases in django.test.utils seems to take a global for keepdb so 
it doesn't seem like someone can choose on a per db basis ...

Is this possible?  How?

-- 
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/61d4c77e-2c5c-4afc-829d-3a1723d5cb2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: multidb, don't create one of them during unit tests

2018-05-29 Thread Rich Rauenzahn
On Tuesday, May 29, 2018 at 12:09:46 PM UTC-7, Rich Rauenzahn wrote:
>
>
> Is this possible?  How?
>
>
Ah, found this thread which suggests just using sqlite locally... I'll give 
it a try:

https://groups.google.com/forum/#!topic/django-users/jxkTmibjmX4 

-- 
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/2fb17ad6-e3dc-4b35-a044-da24cb734413%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fixtures won't load twice in same testcase

2016-05-04 Thread Rich Rauenzahn

I'm having a strange problem.  My test environment has been working fine, 
but I am upgrading my environment's Django revision slowly, which means I 
also need to move away from django-nose's FastFixtureTestCase.

I'm now at Django 1.7.   I have a TestCase which is more or less...

class Foo(TestCase): # and I've tried TransactionTestCase

fixtures = ['accounts.json', 'config.json', 'runtimedata.json']

def test1(self):
pass # yes, literally.

def test2(self):
pass # literally, pass right now


If I split test1 and test2 into two classes, the TestCase works fine.

Otherwise, my runtimedata app fixture ends up with a duplicate row for the 
second test during the fixture setup phase.   When I turned on postgres 
(9.2) logging, I get:

LOG:  statement: UPDATE "runtimedata_branch" SET "name" = 'mock' WHERE 
"runtimedata_branch"."id" = 1
LOG:  statement: INSERT INTO "runtimedata_branch" ("id", "name") VALUES (1, 
'mock')
ERROR:  duplicate key value violates unique constraint 
"runtimedata_branch_name_49810fc21046d2e2_uniq"
DETAIL:  Key (name)=(mock) already exists.
STATEMENT:  INSERT INTO "runtimedata_branch" ("id", "name") VALUES (1, 
'mock')
LOG:  statement: ROLLBACK
LOG:  statement: DROP DATABASE "test_db"

If I grep for runtimedata_branch in the postgres logs, I get ...starting 
after the TRUNCATE caused by TransactionTestCase 

LOG:  statement: TRUNCATE [...], "runtimedata_branch", [...]; #
LOG:  statement: SELECT "runtimedata_branch"."id", 
"runtimedata_branch"."name" FROM "runtimedata_branch" WHERE 
"runtimedata_branch"."name" = 'mock' LIMIT 21
LOG:  statement: INSERT INTO "runtimedata_branch" ("name") VALUES ('mock') 
RETURNING "runtimedata_branch"."id"
LOG:  statement: UPDATE "runtimedata_branch" SET "name" = 'mock' WHERE 
"runtimedata_branch"."id" = 1
LOG:  statement: INSERT INTO "runtimedata_branch" ("id", "name") VALUES (1, 
'mock')
ERROR:  duplicate key value violates unique constraint 
"runtimedata_branch_name_49810fc21046d2e2_uniq"
STATEMENT:  INSERT INTO "runtimedata_branch" ("id", "name") VALUES (1, 
'mock')

You can see a different pattern for the first pass fixture loading for 
test1,

LOG:  statement: INSERT INTO "runtimedata_branch" ("name") VALUES ('mock') 
RETURNING "runtimedata_branch"."id"
LOG:  statement: UPDATE "runtimedata_branch" SET "name" = 'mock' WHERE 
"runtimedata_branch"."id" = 1

The main difference I can see is the first time, the tables are generated 
from scratch, the second the tables have been truncated.  Note, I get a 
very similar outcome with TestCase which does rollbacks instead of 
truncates.

Any ideas?  This is very odd.

Also, my fixtures are dumped with --natural.  I've just tried it without 
--natural and I get the same outcome.



-- 
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/89730e77-2099-4219-9e75-34ccc3b4f457%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixtures won't load twice in same testcase

2016-05-05 Thread Rich Rauenzahn

I've been tracing into django core code, and it looks to me that I have a 
case where the fixture has a auth.User(username=rich) with a pk=1 in the 
fixture.  But sometimes as the User fixture with pk=1 is being added 
(updated?) through Model._save_table(), the same User with pk=5 is already 
in the db (did not exist prior to fixture loading).  This causes the django 
core code (Model._save_table()) to also try to insert another user with the 
same username, causing an integrity error.

I added my own _fixture_setup() that asserted my db was clean prior to 
fixture loading.  It failed!  This lead me to find objects being created in 
a TestCase.setUpClass rather than TestCase.setUp(), and so were leaking 
across tests, fouling up fixture loading.

What's odd is that django-nose's FastFixtureTestCase hid this problem. 
  I think it affected the ordering and ran all the fixture based test 
cases first before the db was polluted.   (But isn't the DB dropped and 
refreshed after every TestCase?)


-- 
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/c9d604a9-af10-4e22-91de-f81f3986d28d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixtures won't load twice in same testcase

2016-05-12 Thread Rich Rauenzahn


On Thursday, May 5, 2016 at 4:22:11 PM UTC-7, Mike Dewhirst wrote:
>
> Are you using setUp() and tearDown() as class methods in your test class? 
>
>
No, the code was using setUpClass(), which is a classmethod. 

-- 
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/01e41a08-d956-4946-a6cf-e82644201cf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixtures won't load twice in same testcase

2016-05-12 Thread Rich Rauenzahn


On Friday, May 6, 2016 at 4:11:42 AM UTC-7, Alasdair Nicol wrote:
>
>
>>
>> But In this particular run I'm currently tracing, rich is already in the 
>> db (as the only entry) as pk=5 (via fixture loading process).   For one, 
>> this tells me the sequence generators aren't always resetting between 
>> fixture loads/tests.
>>
>>  
> Sequences *are not* reset between test cases by default [2]. Perhaps you 
> need to change your code so that it doesn't assume that the user has pk=1, 
> or set reset_sequences = True.
>

My code didn't make that assumption -- it appeared that the fixture loading 
code did.
 

>
> It's difficult to offer any more advice, because you haven't posted any 
> code that can reproduce the problem. It doesn't need to be the actual code, 
> in fact the simpler the example is the better.
>

I spent some cycles trying to reproduce on a fresh Django install, but 
couldn't based on my assumptions.  As I replied later, the problem was a 
setUpClass() creating objects via a factory that persisted between 
TestCase's that did fixture loading, and they conflicted.

Rich 

-- 
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/3f1c6bfe-45be-48d8-bb94-a9a43acb8eb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Advice on python version for new project

2016-08-15 Thread Rich Shepard

  The django web site suggests that new projects use python3 unless required
dependencies are not yet available for that version. I've no idea what
python dependencies I'll need for this job.

  What I want to do is convert an abandoned php application (last upgraded a
decade ago) to django. The application is XRMS, an open source CRM (client
relationship manangement tool in my case) that is perhaps the only one that
supposedly supported postgresql via adodb. What I learned over the weekend
is that I cannot even install it and cannot find the reason why it's not
connecting to the db back end.

  A posting on a forum thread from 2007 reported that postgres was not
supported unless all extensions (none of which I need) are installed, and
all those extensions are hard coded for mysql. I have source code, schema,
and a very full set of docs; suprizingly complete.

  I suppose there's no reason to not use python-2.7.5 installed here for
this project, unless you advise me otherwise. I also need some advice and
guidance on how to proceed on creating a django application from the php
source files.

TIA,

Rich



Re: Advice on python version for new project

2016-08-15 Thread Rich Shepard

On Mon, 15 Aug 2016, Nick Santos wrote:


I'd recommend Python 3 at this point unless you encounter a good, specific
reason to use Python 2.


Nick,

  I'll take your advice. I have both -2.7.5 and -3.5.2 installed. Using pip
to install django puts it in only the 2.7.5/site/packages/ subdirectory.
I'll have to learn how to get it to install in -3.5.2, too.

Thanks,

Rich


Re: Advice on python version for new project

2016-08-15 Thread Rich Shepard

On Mon, 15 Aug 2016, Ari Davidow wrote:


If you're doing a CRM app, many advantages to using Python 3 and not having
to deal with 2's Unicode issues.


Ari,

  This is for my use only. I've outgrown the tools I've been using for my
consulting business and need to consolidate them in a single application.
Will use python3, however.

Thanks,

Rich


Re: Advice on python version for new project

2016-08-15 Thread Rich Shepard

On Mon, 15 Aug 2016, Rich Shepard wrote:


I'll have to learn how to get it to install in -3.5.2, too.


  Found the answer: pip3.

Rich


Re: Advice on python version for new project

2016-08-15 Thread Rich Shepard

On Tue, 16 Aug 2016, Avraham Serour wrote:


you should also create a virtualenv for the project


Avraham,

  OK. Please point me to some docs for this.

Regards,

Rich


Re: Advice on python version for new project

2016-08-16 Thread Rich Shepard

On Tue, 16 Aug 2016, Avraham Serour wrote:


https://virtualenv.pypa.io/en/stable/


  Thanks, Avraham. Looks interesting.

Rich


Starting new project -- version 1.10

2016-08-19 Thread Rich Shepard

  I'm working my way through the tutorial and creating the application I
want rather than the articles example. I've become stuck between two
sections of the tutorial.

  Creating the project (section 2.3.1 worked fine from the TLD,
~/development/:

django-admin startproject crm

created ~/development/crm/ containing the files it should (page 14).

  Moving to section 2.3.2 I start the runserver and, sure enough, I can see
the web page it created.

  The problem occurs in section 2.3.3 when I try to create the crm
application. I cannot do this while the development server is running; there
is no system or python prompt. When I kill the running development server
(^C), and issue the command
python3 manage.py startapp crm

I'm told that application already exists:
~/development/crm]$ python3 manage.py startapp crm
CommandError: 'crm' conflicts with the name of an existing Python 
module and
cannot be used as an app name. Please try another name.
but I have no idea where django thinks it exists.

  Not all the files are found:
~/development/crm/crm]$ ls
__init__.py  __pycache__/  settings.py  urls.py  wsgi.py

These were created by the startproject command.

  Now knowing how I dug this hole I'm in I'd appreciate your teaching me how
to get out of the hole and move on.

Rich


Re: Starting new project -- version 1.10

2016-08-19 Thread Rich Shepard

On Fri, 19 Aug 2016, Tim Graham wrote:


Don't use the same name for your app and project. When you "startproject
crm", the project settings.py, urls.py, and wsgi.py are placed in a module
named "crm" so you can't use the same name for an app.


Tim,

  I read that but overlooked the implications.

Thanks very much,

Rich


Re: Starting new project -- version 1.10

2016-08-22 Thread Rich Shepard

On Mon, 22 Aug 2016, Michal Petrucha wrote:


Just to add to what Tim wrote, there's no reason why you couldn't use the
crm package created by startproject as an “app”, too – all you have to do
is create a models.py file in there (next to the existing urls.py, if you
need any models), views.py (if you need views), and add 'crm' to
``INSTALLED_APPS``. That's pretty much the same thing as what startapp
would have done, anyway.


Michal,

  Thanks for the insight.

  Seems to me that models and views are essential to a django application.
Regardless, I saw why startapp failed: I overlooked the requirement to
create a postgres database from the commandline prior to asking django to
use it.

  INSTALLED_APPS now has 'crm' at the end of the django.contrib.* list.

  One clarification on projects vs applications will help my learning.
Rather than using the same name for both (based on prior advice), the
project name is clientmanagment and that directory contains
clientmanagement/  crm/  manage.py*

  The clientmanagement/ subdirectory contains
__init__.py   __pycache__/  settings.pyc  wsgi.py
__init__.pyc  settings.py   urls.py

and I wonder why the project-related files in this subdirectory are not
under the parent project directory. In other words, why is there a project
subdirectory under the project directory?

Thanks,

Rich



DateField default value

2016-08-22 Thread Rich Shepard

  Reading the doc for DateField() I tried to set the default as today's
date, but 'default=date.today' is not accepted.

  If there is a way to set today's data as the default for a DateField()
please point me to the doc for it.

Thanks,

Rich


Re: DateField default value

2016-08-22 Thread Rich Shepard

On Mon, 22 Aug 2016, Tim Graham wrote:


What do you mean by "not accepted"? Is there some error message? What you
wrote should work as far as I know.


Tim,

  Yes, there was an error message that was not saved.


from datetime import date


  That's probably the cause: my missing that import in the tutorial.

Thanks!

Rich


Re: Starting new project -- version 1.10

2016-08-23 Thread Rich Shepard

On Tue, 23 Aug 2016, Carsten Fuchs wrote:

I cannot remember where is was stated, but iirc another reason for the 
“project-under-the-project” subdirectory was that it is considered not as 
app, but rather as “site”.


Carsten,

  Thanks for the clarification. That helps.

Rich


Re: Starting new project -- version 1.10

2016-08-23 Thread Rich Shepard

On Tue, 23 Aug 2016, Michal Petrucha wrote:


This is mostly an issue with how we name things. You have a project, which
is a CRM application. That's the entire thing, which consists of a bunch
of different Python packages. So, each of the subdirectories in the
top-level “clientmanagement” directory is one Python package. For better
or for worse, Python packages containing Django models, views, URL
patterns, and whatnot, are referred to as “Django apps”.


Michal,

  Yesterday evening I started reading a book I bought several years ago
(when django was at version 1.5) for a project that got sidelined. With your
explanation and the book I'm starting to understand the django terminology
and project organization.


Usually, it's a good practice to split your project into smaller
self-contained packages. Those all live together inside the project
directory, and each of them can have its own URL patterns, models, views,
static files, templates, and pretty much anything else. They can even
depend on each other, although it's often a good idea to keep the coupling
between as low as possible.


  Let me test my understanding by explaining my crm project. Getting it
right from the beginning will help me a lot.

  First, this is a single-user project for my business; I'm not a
professional application developer but have built scientific and business
tools for my use for several decades. Since this, and the other django
application that has been put off for a while, are the only two that I plan
to develop I am not convinced that I need virtualenv and its wrapper. Each
will use python3 and I'll keep django upgraded to the latest version.

  Second, now that I better understand the project/app design and disk
layout I'll rename some directories so the distinctions are clearer. Which
leads to my question about apps in a project.

  Yesterday, in models.py, I set up the schema based on what I want. The crm
has several components: companies, contacts, activities, opportunities, etc.
Each of these is a single class within models.py. My question is whether
each should be a separate app since there will be methods for adding,
modifying, and deleting rows in the database tables as well as report
generation and views that incorporate data from multiple tables. If so, is
each named as a distinct python module and imported into the main models.py?

  Or, should they all remain in models.py with separate modules for adding,
editing, deleting, and reporting that are imported to models.py?

  My python2/wxPython applications have an organization that makes sense to
me and works. Since building a browser-based django application is a new
experience I want to learn how best to organize everything.

Thanks for the insights,

Rich



Using version control with django

2016-08-23 Thread Rich Shepard

  I want to track django projects with subversion. (Single developer, local,
so svn is better suited than the distributed git and mercurial.) I'd like
advice on how to lay this out vis-a-vis the django layout.

  Project overall root is ~/development/crm-project. This directory
contains:

Makefile  README  crm-project/  docs/  manage.py*  requirements.txt

  The top-level project directory is the same-named crm-project, and this
contains:

__init__.py   __pycache__/  settings.py   urls.py
__init__.pyc  crm/  settings.pyc  wsgi.py

  The app directory is crm/.

  So, where should I place trunk/, tags/, and branches/ be created? If
they're in the overall project root (~/development/crm-project/) should I
then move that directory's contents into the newly made trunk/ subdirectory?

  I find nothing in my web searches for using svn with django. Perhaps my
web foo is insufficient.

Rich


Re: Using version control with django

2016-08-23 Thread Rich Shepard

On Tue, 23 Aug 2016, Gergely Polonkai wrote:


You should put all the stuff under trunk/, so it becomes trunk/manage.py,
trunk/crm/, etc. If you are developing for multiple customers, the
branches and tags directory may come in handy later. Also, it's nothing
but naming convention: you can call these directories dog/, Pete/, and
ananas/. But that’s more for a Subversion user list, not Django.


Gergely,

  That's what I suspected to be the case.


On the other hand, you definitely should choose a distributed version
control if you are working alone.


  Well, subversion's served me well since I replaced CVS with it. Backups
are daily (using dirvish) and since the repository's been in the same place
for almost a couple of decades it's not likely to be moved. :-)

Thanks for confirmation,

Rich


Re: Using version control with django

2016-08-23 Thread Rich Shepard

On Tue, 23 Aug 2016, François Schiettecatte wrote:


I would add a +1 for git, I started off with svn and switched to git,
branching and merging is much easier which really helps when you want to
test ideas.


François,

  Thanks for your insight,

Rich


Re: Using version control with django

2016-08-23 Thread Rich Shepard

On Tue, 23 Aug 2016, Gergely Polonkai wrote:


On the other hand, you definitely should choose a distributed version
control if you are working alone. For example, Git, Mercurial and Fossil
repositories are self contained, which means the whole development history
is located right where you work.


Gergely,

  SVN is also self-contained, unless a separate repository is created for
each project. Regardless, after looking at some docs I decided to move from
svn to git. Since I'm not a professional developer I don't know it will make
any difference to me, but ...

  I also keep versions of important documents, such as books or articles
submitted for publication and drafts of my expert opinons when I'm retained
for litigation support. While svn had no problem keeping each branch of its
repository tree separate, perhaps the maintenance of separate repositories
(one for each project) will not be onerous.

Suggestion taken,

Rich


Clarifying Project vs Apps

2016-08-24 Thread Rich Shepard

  While I think that I understand the differences between a project and its
apps there remains one point of uncertainty. I've not found the answer,
although it might be in the 1.10 docs or on the Web and I've missed it.

  If the project represents the entire database, do the apps represent
individual tables? That is, should my project have a separate app for each
table with its models, templates, and views with templates of joined tables
in the main project subdirectory? Or are all tables in a single app?

TIA,

Rich



Re: Clarifying Project vs Apps

2016-08-24 Thread Rich Shepard

On Wed, 24 Aug 2016, Lee Hinde wrote:


My tuppence.


Lee,

  Before or after Brexit? The value might change. :-)


No, an app is a logical grouping of objects/tables. You might, for
instance,have an Invoice app that would include an Invoice table (model)
and a LineItems table. Products and related tables would be in a different
app.


  OK, that makes sense.

  In my current project, then, all modules for company, contact, activity,
case, etc. will be in a single app. And, perhaps, another app would be for
reporting?

  Translating from product-oriented applications to service-oriented ones is
not always easy.

Thanks very much,

Rich


Re: Clarifying Project vs Apps

2016-08-24 Thread Rich Shepard

On Wed, 24 Aug 2016, Lee Hinde wrote:


So, no one is going to grade it. You're making this for yourself, so I
wouldn't over think it. I'm working on a project now that only has two
apps, one with all the core models and one for utility models (like choice
lists).(I'm using several packages, so the database has more to it than
that.)



It sounds like something like that would work for you and still be 'right'.
Especially as a first time out of the gate project, keep it simple. IMHO.


Lee,

  Now this is a valuable lesson: core models and utility models. Many of my
classes have choice lists (select from a list of industries, or campaign
types) so I'll put those in the models.py of a separate app.


While it will certainly evolve as you use it, you're not gong to suddenly
wake up and need 18 more apps to meet your needs. And if that does happen,
you can rearrange.


  No, not on this project. But the next one will require more apps because
it has more functional groupings.

Many thanks again,

Rich


Re: Clarifying Project vs Apps

2016-08-24 Thread Rich Shepard

On Wed, 24 Aug 2016, Andreas Kuhne wrote:


If you know how your project will be used, you can usually group the models
and views in logical apps. For example a customer app that has the customer
(user) model, address model. Then another app for orders and invoices and
so on.


Andréas,

  Here you've given me an alternative approach for my application slightly
different from Lee's way of presenting it. Much to think about before I
proceed.

Much appreciated,

Rich



Re: Clarifying Project vs Apps

2016-08-24 Thread Rich Shepard

On Wed, 24 Aug 2016, Andromeda Yelton wrote:


My feeling/practice on apps is: each app is a one-word informative noun.
It contains the models that are logically grouped under that noun (and the
views, urls, etc required to interact with those models on the front end).


Andromeda,

  So are table names.


If there isn't a single word that logically represents all my models, then
they need to be separated into multiple apps. (And if models.py has gotten
long enough that it's unwieldy, it probably wants to be split.)

So, e.g., "companies" or "invoices" or "customers" or "reports" are all
perfectly decent app concepts.


  Got it, thanks.


Also, _Two Scoops of Django_ is a helpful book for developing Django best
practice intuitions.


  I have the one from django-1.5; the latest is for -1.8. Since the current
version is 1.10 I see no reason to get a newer, but still two versions
behind, copy.

Thanks very much,

Rich


Django documentation release 1.10.1a1

2016-08-30 Thread Rich Shepard

  I don't know how this PDF displays in other viewers, but in xpdf, mupdf,
and acroread important strings in the text are very difficult to read
because they have very low contrast with the white background.

  For example, comments are in a light grey and important strings are in a
very pale yellow. Page 14 has many examples of this.

  Perhaps for very young eyeballs it's not an issue, but for those of us
with many miles on our eyes it's extremely hard to read this light text on
the white background.

  It would be very helpful if this situation was quickly remedied and a
revised version released.

Thanks in advance,

Rich


Re: Django documentation release 1.10.1a1

2016-08-30 Thread Rich Shepard

On Tue, 30 Aug 2016, Tim Graham wrote:


I don't think there have been any recent changes to the styling, but if
you'd like to contribute, the place to look is probably
https://github.com/django/django/tree/master/docs/_theme.


Tim,

  I don't know what to do once I'm on that page but when time permits I'll
look around and see if I can find the source. Wonder if it's written in
LaTeX; if so, the typefaces can easily be change.

Thanks,

Rich


Project time and expense tracking

2016-09-01 Thread Rich Shepard

  Before I re-invent the wheel, does anyone know of an existing django
project time and expense application using sqlite3?

  Now and then a client needs to be invoiced by time and expense rather than
a flat rate. My financial software is supposed to do this, but I've never
been able to convert the time card records into a line-item invoice, and I
find nothing suitable in my Web searches (because they either do not run on
linux or require MySQL as the backend database.

  It should not be too difficult to put together this application if one's
not already available.

TIA,

Rich



Re: Project time and expense tracking

2016-09-02 Thread Rich Shepard

On Fri, 2 Sep 2016, Tim Graham wrote:


I see some results by searching "django time tracking app" in a search
engine. In particular, Django Packages has a nice comparison of some
options: https://djangopackages.org/grids/g/project-management/


Tim,

  That's a much better search string than those I used. I'll definitely look
at the project management packages.

Much appreciated,

Rich



Re: Project time and expense tracking [RESOLVED]

2016-09-02 Thread Rich Shepard

On Fri, 2 Sep 2016, Rich Shepard wrote:


I'll definitely look at the project management packages.


  It appears that django-timepiece will fulfill my needs.

Thanks again,

Rich


less-css

2016-09-02 Thread Rich Shepard

  The django-timepiece project requires a tool called 'less,' a css
preprocessor. However, on linux systems (if not also other unices)
/usr/bin/less is a pager with greater capabilities than more.

  Is there a conflict between these two? Where would the css-less be
installed?

TIA,

Rich


Re: less-css

2016-09-02 Thread Rich Shepard

On Fri, 2 Sep 2016, Aron Griffis wrote:


There isn't a conflict between them, because the LESS compiler installs as
"lessc" and also because you'll want to install it locally using npm rather
than system-wide.

These links might be helpful to you:

https://github.com/caktus/django-timepiece#installation
https://docs.npmjs.com/getting-started/installing-npm-packages-locally
http://lesscss.org


  Thanks, Aron. I assumed there'd be no conflict but appreciate the
confirmation. I saw less in the django-timepiece requirements file which
raised my question.

  Will look at the last two URLs first; need to install requirements before
trying django-timepiece.

Regards,

Rich


Unexpected poor template performance

2016-09-12 Thread Rich Rauenzahn

I'm working on a project that needs to occasionally render very large 
tables -- I'm picking hundreds of thousands of cells as a test point for 
trying out back end implementation scalability.

I'm parallelizing some of the rendering through ajax calls that returns 
large subsets of the rendered cells ("content") within 
a JSON structure.  I'm using a short template to render each cell:


  {{ datapoint.score }}



template = get_template('cell.djhtml')

for datapoint in self._iterate_datapoints():
datapoint_cell[datapoint.foo_id][datapoint.bar_id] = 
template.render(dict(datapoint=datapoint))


If I change the template.render() call to just a "%s" % datapoint.score, the code is an order of magnitude 
faster.

My assumption (and my reading of the django code I think confirmed) that 
the template is compiled only once, so I'm ok there.

Is this difference surprising or unexpected?  Would a single (consolidated) 
render() be expected to be much faster? (I'm trying to think of a way to 
refactor it to a single render, but I'm not looking forward to rendering 
json in a django template)

I'm also considering I may just need to return structured json and create 
the elements manually on the client side -- although if I have to do it 
that manually, I might as well use interpolation on the backend python 
without using a template...

Oh, and I just tried jinja2 -- it was much closer to interpolation speed.   
Perhaps that is my best answer.

Any thoughts or pointers on my predicament?

Thanks!
Rich

-- 
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/cb85b941-964c-46c8-8e84-148fdb6049ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Convert PostgreSQL tables to django

2016-10-29 Thread Rich Shepard

  Is there a tool to convert postgres DDL to django model syntax? It would
sure save a lot of time and effort if there is a converter.

Rich


Re: Convert PostgreSQL tables to django

2016-10-29 Thread Rich Shepard

On Sat, 29 Oct 2016, m1chael wrote:


https://docs.djangoproject.com/en/1.10/howto/legacy-databases/


  I missed seeing that. Thanks very much.

Rich


Re: Django template

2019-02-09 Thread rich gang
Hi guys,
I just finished learning python on sololeran.com.
And I wanna start django, so I was wondering If anybody would wanna help me
personally.
Like I said I have a fair knowledge about python.
I would be grateful.
thanks,

On Sat, 9 Feb 2019 at 11:43, PASCUAL Eric  wrote:

> Hi,
>
> Templates are nothing more than HTML files with special tags inside. In
> their simplest form, they can be plain HTML without any templating tags and
> they will thus be rendered without any change.
>
> In conclusion, to keep it simple and still let you the opportunity to
> benefit from templating features if ever the need arises in the future, let
> settings as they are and follow template view examples. The overhead will
> be minimal for such "static" templates since the engine provides a quite
> efficient preprocessing and caching mechanism and in any case,
> negligible compared to DB or network related stuff.
>
> Anyway, if for any reason you do not want to keep the templating engine in
> the path at all, your views can return basic HTTP responses containing
> static HTML data, either stored as constant strings in your code (not the
> cleanest option) or, better, as resources in your project (e.g. plain files
> somewhere they can be read from the app code).
>
> Best
>
> Eric
>
> --
> *From:* django-users@googlegroups.com  on
> behalf of Tom Zhang 
> *Sent:* Friday, February 8, 2019 19:59
> *To:* Django users
> *Subject:* Django template
>
> Hi,
>
> If I don't want to use any Django template and I just want to use regular
> html/javascript, how should I setup the template config in settings.py?
>
> Right now, my settings are:
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
> Thanks,
>
> Tom
>
> --
> 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/e88d65e8-c992-4a57-ac5b-3ed5f60dab24%40googlegroups.com
> 
> .
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/AM0P193MB03088A4EC2AEDE3EDCE2C2BE8C6A0%40AM0P193MB0308.EURP193.PROD.OUTLOOK.COM
> 
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAx3FUw1xTs0yRLqOAaS0A5xmGg80pJ-fPdkS79KwiCuGVeVVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Paginator UnorderedObjectListWarning on union(all=True) of two sorted queries

2019-04-16 Thread Rich Rauenzahn
I wonder if this is a case you want to catch and *not* warn about.

In my case, I'm doing a:

haves = 
MyModel.objects.filter(foreign_relationship=4).order_by('foreign_relationship__value',
 
'common_key')
havenots = MyModel.objects.exclude(id__in=haves).order_by('common_key')

query = haves.union(havenots, all=True)


And I'm using this with a Paginator.  The Paginator thinks the queries are 
not ordered, but they actually are (right?) due to the all=True in the 
union.

Is this a case the warning ought to handle and ignore?

The Django 1.11 source is:

def _check_object_list_is_ordered(self):
"""
Warn if self.object_list is unordered (typically a QuerySet).
"""
ordered = getattr(self.object_list, 'ordered', None)
if ordered is not None and not ordered:
obj_list_repr = (
'{} {}'.format(self.object_list.model, 
self.object_list.__class__.__name__)
if hasattr(self.object_list, 'model')
else '{!r}'.format(self.object_list)
)
warnings.warn(
'Pagination may yield inconsistent results with an 
unordered '
'object_list: {}.'.format(obj_list_repr),
UnorderedObjectListWarning,
stacklevel=3
)


Should I file a bug?

-- 
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/2d1dc6a6-35c1-48ac-afe3-d08cd4636990%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to structure this django application

2017-04-07 Thread Rich Shepard

  Caveat: I'm not a professional coder or web developer, but have written
many applications over the years. Because I'm also new to django I need
insights into how to structure an application application supporting
multiple users, each in its own private section.

  This application will allow my clients to upload data to the web site,
each in his own space. Data will be stored in a postgres-9.6+ backend.
Generated reports will be available for download.

  I understand that a django application has many 'apps' in it and is not a
single-file framework. If there is an example of how to set up and structure
such an application please point me to it so I can learn from success.

  Pointers, references to docs or web sites will be appreciated and used.

TIA,

Rich


Re: How to structure this django application

2017-04-07 Thread Rich Shepard

On Sat, 8 Apr 2017, Sithembewena Lloyd Dube wrote:


My best recommendation for structuring Django projects (and for
optimization and a myriad other goodies) would be the book Two Scoops of
Django by Daniel and Audrey Roy Greenfeld. I could say a lot but the bottom
line is, check the book out. It's at https://www.twoscoopspress.com/


Sithembewena,

  I have that book (the 1.8 version); pulled it off the shelf earlier today
to read again.


There are various factors to consider and this book (to me, at least) best
encapsulates all those. I believe that it also applies for newer versions
of Django than v1.8.


  What I need to build is different from a blog, newspaper, e-commerce, and
similar sites ... I think. In those, every visitor/user sees the same views
and has the same options.

  My proposed application needs to be slightly different for each category
of user and keep each in his/her own private section. How to do this may be
in 2 scoops, or may not. If I don't see how to do this I'll be back with
more questions.

Thanks,

Rich


Re: How to structure this django application

2017-04-08 Thread Rich Shepard

On Sat, 8 Apr 2017, Sithembewena Lloyd Dube wrote:


Do take the time to peruse the book. It would be time well spent. Also, do
keep in mind that the recommendations therein do not apply to a Django
blog or CRM sustem etc, per se. They would apply just as well if you were
building a RESTful mobile app backend.


Sithembewena,

  I recognized this the first time I considered using django.


The problem you describe of managing users etc is just a requirements
specification. The advice in the book is general enough across
implementations of solutions in broad problem domains. It's not a recipe
book, but more a collection of chefs' knives.


  My original question was not about structuring django code but the logical
design of the project itself. I believe that question was answered by a
message on another thread: there is at least one plug-in package that allows
individual users to work in their own database area and keeps users from
areas assigned to others. This is independent of the django project/app code
arrangement.

Thanks again,

Rich


  1   2   >