Re: Dynamic Base Template

2014-07-17 Thread cmawebsite
You could make a custom assignment_tag like: {% get_datasets_for_user user as dataset %} https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#assignment-tags -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

idea: deploy static files on github pages CDN

2014-07-17 Thread cmawebsite
I had an idea today that I wanted to share, if anyone finds it helpful or has feedback. ./manage.py collectstatic cd $STATIC_ROOT rm -rf .git/ # optionally don't keep history git init . git add . git commit -m"static files" git push -f g...@github.com:username/yourrepo master:gh-pages then set

Re: Errors Using Pip In Powershell to Download Django

2014-07-17 Thread cmawebsite
> > Yesterday I tried to get the 1.7rc1 and got the error 'file contains no > section headers'. I assumed this was because it was a tarball, and after > looking around gave up for the night. > Tonight I decided to just get 1.6.5. But to my surprise, I got the same > error. I have no control ove

Re: How to call a function when a project starts.

2014-07-31 Thread cmawebsite
I think if you put it in urls.py it should run (once) just before the first request. On Thursday, July 31, 2014 10:30:08 AM UTC-4, ke1g wrote: > > It runs twice because runserver uses two processes: the real server, and; > the monitoring process that restarts the other when you change a source

Re: building a xenserver web client

2014-07-31 Thread cmawebsite
You mentioned "full featured". Check out https://github.com/openstack/horizon if you haven't. On Thursday, July 31, 2014 9:55:43 AM UTC-4, ma...@tubeards.com wrote: > > Hi, > > is anyone interested in co-building a full featured web client for > xenserver instances? > Since version 6.2 the upda

Re: image upload

2014-07-31 Thread cmawebsite
Are you using ? On Thursday, July 31, 2014 7:20:19 AM UTC-4, ngangsia akumbo wrote: > > i have a problem of displaying my image on my web page. > > i have upload my pic in admin and when i display it it shows me the this > > media/Lighthouse_1.jpg > > models.py > > class Image(models.Model): >

Re: hanging django/postgres idle connections

2014-07-31 Thread cmawebsite
Does it work fine on django 1.6? It could be a regression. On Wednesday, July 30, 2014 10:41:58 AM UTC-4, Jani Kajala wrote: > > Hi, > > I have a problem with leaking Postgres DB connections even if I > have CONN_MAX_AGE=0. Every time I start the server and stop it by > Ctrl+Break a DB connectio

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread cmawebsite
Right, the question isn't "is user x logged into the website right now", it actually only makes sense for for request.user. This will return all users in the database: logged_in_users = [user for user in User.objects.all() if user.is_authenticated()] -- You received this message because you ar

Re: Why are DateTimeField auto_now and auto_now_add bad?

2014-07-31 Thread cmawebsite
It gets confusing if those fields are editable in the admin. I recommend setting editable=False on those fields. On Sunday, July 27, 2014 6:47:33 PM UTC-4, Russell Keith-Magee wrote: > > > I'm not aware of a formally documented list anywhere. > > To the best my knowledge, the bug/downside that i

Re: Screenshot pdf from AWS hosted django app

2014-07-31 Thread cmawebsite
I just use commandline imagemagick instead of PythonMagic, if the python bindings are the issue getting imagemagick to work. cmd = 'convert -density 300 -flatten -interlace line -quality 92 -colorspace sRGB -thumbnail'.split() + size + [default_storage.path(name) + '[0]', 'jpg:-'] proc = Popen(

Re: Screenshot pdf from AWS hosted django app

2014-07-31 Thread cmawebsite
And if local dev is an issue, you could try setting MEDIA_URL to your live site. -- 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...@google

Re: Django Queryset with filtering on reverse foreign key failing

2014-07-31 Thread cmawebsite
What does the FieldError say? -- 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 dja

Re: Different choices values for a single field in inherited class

2014-07-31 Thread cmawebsite
class Color(models.Model): red_or_white = models.CharField(max_length=10, choices=[('red', 'Red'), ('white', 'White')]) tone = models.CharField(max_length=32) class Wine(models.Model): name = models.CharField(max_length=255) color = models.ForeignKey(Color) -- You receiv

Re: Django limit_choices_to - ForeignKey

2014-07-31 Thread cmawebsite
If you are using the admin: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_choice_field Otherwise, you'll need to dynamically create that field or the entire form. -- You received this message because you are subscribed to the Google Group

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread cmawebsite
something like this may work: from django.contrib.auth.models import User from django.contrib.sessions.models import Session User.objects.filter(id__in=(s.get_decoded().get('_auth_user_id') for s in Session.objects.all())) for s in Session.objects.all() -- You received this message

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread cmawebsite
or for a specific user: from django.contrib.sessions.models import Session any(s.get_decoded().get('_auth_user_id') == user.id for s in Session.objects .all()) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: invalid attribute

2014-07-31 Thread cmawebsite
Do you have the full error message? On Thursday, July 31, 2014 5:48:55 PM UTC-4, ngangsia akumbo wrote: > > *Got an invalid attribut error* > > class Product(models.Model): > name = models.CharField(max_length=255, unique=True) > slug = models.SlugField(max_length=255, unique=True, >