Friday, December 30, 2011

Re: project help

Here it is again:

https://github.com/wtrevino/django-djobberbase/wiki

On Dec 31, 12:39 am, Jesramz <jesus.ramirez.ute...@gmail.com> wrote:
> I found something promising <a href = "https://github.com/wtrevino/
> django-djobberbase/wiki">Djobberbase</a>. In case this helps anybody
> else.
>
> On Dec 30, 2:10 am, Jesramz <jesus.ramirez.ute...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thank you Denis!  django-userena seems great. Im glad I asked for
> > advice.
>
> > Im a noob so I dont quite get pinax fully.
>
> > On Dec 28, 2:33 am, Denis Darii <denis.da...@gmail.com> wrote:
>
> > > You can also consider to use pinax:http://pinaxproject.com/
>
> > > or userena for accounts:http://django-userena.org/
>
> > > Denis.
>
> > > On Tue, Dec 27, 2011 at 8:58 PM, Jesramz <jesus.ramirez.ute...@gmail.com>wrote:
>
> > > > Hello All,
>
> > > > I would like to create a job search project a lot like monster or
> > > > indeed.
>
> > > > Does anyone have any resources such as other projects or repositories
> > > > similar to what I'm looking for that can push me in the right
> > > > direction? Or any advice whatsoever would also be appreciated.
>
> > > > I am planning on using:
> > > >    django registration
> > > >    django profiles
> > > >    geodjango
>
> > > > Not sure what else yet
>
> > > > --
> > > > You received this message because you are subscribed to the Google Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscribe@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.

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

Re: project help

I found something promising <a href = "https://github.com/wtrevino/
django-djobberbase/wiki
">Djobberbase</a>. In case this helps anybody
else.

On Dec 30, 2:10 am, Jesramz <jesus.ramirez.ute...@gmail.com> wrote:
> Thank you Denis!  django-userena seems great. Im glad I asked for
> advice.
>
> Im a noob so I dont quite get pinax fully.
>
> On Dec 28, 2:33 am, Denis Darii <denis.da...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You can also consider to use pinax:http://pinaxproject.com/
>
> > or userena for accounts:http://django-userena.org/
>
> > Denis.
>
> > On Tue, Dec 27, 2011 at 8:58 PM, Jesramz <jesus.ramirez.ute...@gmail.com>wrote:
>
> > > Hello All,
>
> > > I would like to create a job search project a lot like monster or
> > > indeed.
>
> > > Does anyone have any resources such as other projects or repositories
> > > similar to what I'm looking for that can push me in the right
> > > direction? Or any advice whatsoever would also be appreciated.
>
> > > I am planning on using:
> > >    django registration
> > >    django profiles
> > >    geodjango
>
> > > Not sure what else yet
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscribe@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

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

Re: Misfiring signal handler

If you can create a self-contained small example project which does
this, it would make it much easier to debug this. I don't know why the
signal misfired, and I don't see a way that it could misfire. So,
without some ability to reproduce this it is hard to help.

- Anssi

On Dec 30, 5:40 pm, Jay Wineinger <jay.winein...@gmail.com> wrote:
> Hey guys,
>
> I have an odd problem where a post_save signal handler is getting
> called from a class different than what I specified as the sender.
> The code is athttp://dpaste.com/hold/679348/and also below for when
> the pastebin is deleted.
>
> I'm connecting the rating_denormalizer() function to the post_save
> signal of the Rating model.  However, when I visit the site with a
> fresh browser a new Session is created and for some reason, this
> signal handler is called with a Session instance.
>
> I was able to fix this by moving this code from users/signals.py to
> bars/signals.py, directly importing Rating instead of using get_model,
> and moving the AppUser import inside rating_denormalizer().  However,
> I still would like to figure out why this was happening.
>
> # users/signals.py
> from django.db.models.signals import post_save
> from django.db.models import F, get_model
>
> Rating = get_model('bars','Rating')
> AppUser = get_model('users','AppUser')
>
> def rating_denormalizer(sender, instance, created, **kwargs):
>     """
>     Post-save signal handler on Rating to keep the denormalized fields
> on
>     AppUser up-to-date
>     """
>     if created:
>         AppUser.objects.filter(pk=instance.user_id).update(
>             rating_count=F('rating_count') + 1,
>             last_rating=instance.created,
>         )
> post_save.connect(rating_denormalizer, sender=Rating,
> dispatch_uid='rating_denormalizer')
>
> # Get a 500 error when going to /admin/ with a fresh browser
> 2011-12-27 16:45:07,608 ERROR Internal Server Error: /admin/
> Traceback (most recent call last):
>   File "/var/www/python/myapp/lib/python2.6/site-packages/django/core/
> handlers/base.py", line 178, in get_response
>     response = middleware_method(request, response)
>   File "/var/www/python/myapp/lib/python2.6/site-packages/django/
> contrib/sessions/middleware.py", line 36, in process_response
>     request.session.save()
>   File "/var/www/python/myapp/lib/python2.6/site-packages/django/
> contrib/sessions/backends/db.py", line 63, in save
>     obj.save(force_insert=must_create, using=using)
>   File "/var/www/python/myapp/lib/python2.6/site-packages/django/db/
> models/base.py", line 460, in save
>     self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
>   File "/var/www/python/myapp/lib/python2.6/site-packages/django/db/
> models/base.py", line 570, in save_base
>     created=(not record_exists), raw=raw, using=using)
>   File "/var/www/python/myapp/lib/python2.6/site-packages/django/
> dispatch/dispatcher.py", line 172, in send
>     response = receiver(signal=self, sender=sender, **named)
>   File "/var/www/python/myapp/App/users/signals.py", line 13, in
> rating_denormalizer
>     AppUser.objects.filter(pk=instance.user_id).update(
> AttributeError: 'Session' object has no attribute 'user_id'

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

Managers of related fields

I have Articles that refer to Authors using
ForeignKey(related_name='articles'). Given an Author author, I'd like
to be able to use the default manager for author.articles, but I'd
also like to have author.published_articles, using a custom manager.
Is this possible?

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

Unable to display static content.

Hi All,

I am just learning Python and Django. I am able to see the webpage but
css and images are not picked up.

Configuration as below:

Linux Ubuntu 11.04
Python 2.7.2
Django 1.3.1

I have setup Django using VirtualEnv. I am using PyCharm and my Django
project is pointing to the VirtualEnv Django installation.

In firebug, I am getting 404 for css and images.

Project Structure.

ProjectRoot
-media
-images
-stylesheets
-templates
-webapp

urls.py
------------------------------------------------------------------------------------------
from django.conf.urls.defaults import patterns, include, url
import settings
from talenthunt.web import views

urlpatterns = patterns('',
url(r'^search-form/$', views.search_form),
url(r'^search/$', views.search),
)

if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}))


settings.py
---------------------------------------------------------------------------------------
def rel(*x):
return os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x )

MEDIA_ROOT = rel('media')
MEDIA_URL = '/media/'

STATIC_ROOT = rel('static')
STATIC_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/media/admin/'

Only pasting relevant code from settings.py

Base.html
------------------------------------------------------------------------------------------
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Organic Web Design</title>
<link href="{{ MEDIA_URL }}stylesheets/common.css"
rel="stylesheet" type="text/css" />
</head>

Any help will be much appreciated.

Thanks
Chirdeep

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

Re: django-admin.py startproject will NOT work.

On Dec 30, 8:10 am, Ramiro Morales <cra...@gmail.com> wrote:
> On Fri, Dec 30, 2011 at 1:32 AM, Chris Kavanagh <cka...@gmail.com> wrote:
> > Hi, I'm using WinXP, Python27, django 1.3.1.
>
> > When I try django-admin.py startproject mysite, I get a "Usage django-
> > admin.py subcommand [options] [args]" listing of commands instead of
> > starting the project in mysite folder. . .I've tried every workaround
> > I've found on Google & on this site. I've put C:\Python27\Lib\site-
> > packages\django\bin in my Env Variable Path, I've changed the registry
> > setting HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command
> > to PYDIR\\python.exe" "%1" %*. I've typed in the full path in the
> > command line (python django-admin.py startproject mysite) & nothing
> > works. And yes, I set it up using python setup.py install.
>
> > Any suggestions or other work arounds??? I'm at my wits end!!! Thanks
> > for any help.
>
> The safest, OS-independent and interpreted language-independent way to
> get a script like django-admin to run is to simple use:
>
>   path\to\the\interpreter\binary path\to\the\script
>
> In your case it could be:
>
>   C:\python27\python C:\path\to\django-admin startproject foo
>
> or, if you have C:\python27 in the PATH, simply:
>
>   python C:\path\to\django-admin startproject foo
>
> This is particularly true and useful in platforms like Windows where
> there is no robust/official way to associate a scripting language source
> code file to signal the OS which interpreter binary should process and
> execute it (like the #!/path/to/python line in Unix).
>
> There are a handful of third party solution and tricks (like the ones
> you tried) but from the number of times this topic appears in mailing
> lists IMHO it is evident they only muddle the landscape and/or break
> things.
>
> Regards,
>
> --
> Ramiro Morales

Thanks again for the help Ramiro. . .When you say "C:\path\to\django-
admin startproject foo", I'm not quite sure which path you're
referring to. Do you mean "C:\Python27\Lib\site-packages\django
\bin" ??? This is where the django-admin script is located (also
located in Python Scripts Folder). BTW, I have my Python Path set in
Environment Variables along with the path to where django-admin.py is
located " C:\Python27;C:\Python27\scripts;C:\Python27\Lib\site-packages
\django\bin"

So, if you could help a moron like me out, and tell me exactly which
path you're referring to when you say "C:\path\to\django-admin
startproject foo" I'll give it a try.

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

Re: What does login() and logout() actually do?

Thanks.

On Fri, Dec 30, 2011 at 4:55 PM, Mario Gudelj <mario.gudelj@gmail.com> wrote:
Hey,

All that code is in django.contrib.auth. The login() function is is in views.py in that directory.

Cheers,



On 31 December 2011 11:34, David Zheng <dg83072@gmail.com> wrote:
Hi, all.

In Django Document - User authentication in Django, it talks about how
to log a user in and out. But I really what to know what happens under
the hood when calling the functions login() and logout(). There is
little content concerned with this topic. I've read almost every
article or document I could find and the only thing I know is that
login() function
"
i) uses the session framework to save the cookie we've seen in the
first section of this article.
ii) login() saves the user's ID in the session
"
Does anyone know where can I find the source code of the login() and
logout() function or any articles talking about these two functions in
detail. I really need to know what happens behind the scene to better
understand Django's session framework.

Thanks.

-David.

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


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

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