Re: Passing variables to css file in django

2013-08-26 Thread Chris Lawlor
The simplest solution is probably to keep all of the CSS that users can't customize in an external file (to be served as a static asset), but move anything that's user customizable to the of your base template, in a

Re: django , python and ides

2013-06-01 Thread Chris Lawlor
> $HOME/.screenrc-: http://collabedit.com/kuj8d > > Enjoy! > > -- > Joey "JoeLinux" Espinosa* > * > <http://therealjoelinux.blogspot.com> > <http://twitter.com/therealjoelinux><http://about.me/joelinux> > > > On Fri, May 31, 201

Re: django , python and ides

2013-05-31 Thread Chris Lawlor
Joey, Would you be interested in sharing your virtualenvwrapper setup? I assume you're using some custom postactivate hooks, looks nice. Chris On Friday, 31 May 2013 14:23:23 UTC-4, JoeLinux wrote: > > I've used both PyCharm and SublimeText extensively for months each at a > time, > and I

Developing Django Apps - best practices?

2013-05-31 Thread Chris Lawlor
All, I'd like to get some feedback from the community on the current best practices for developing standalone Django apps. To clarify, by 'standalone' I mean a codebase that is just the application itself, to be installed into a Django project via setup.py / pip, not working on the app

Re: linux or windows

2013-05-31 Thread Chris Lawlor
Django itself is completely platform agnostic. Years ago I used to develop on Windows, and typically where I would run into problems was trying to find binaries for third party libraries like PIL and psycopg2. They'd usually be available from somewhere or another, thanks to some kindhearted

Re: Template Caching with Messages

2013-04-26 Thread Chris Lawlor
V, You're exactly correct - make sure you only cache what you actually want cached : ) Anything that should only be visible for one page view isn't a good candidate for caching. If your page has any sort of content that is specific to the current user - login state, etc., you probably don't

Re: django development server timeout too quick

2013-04-26 Thread Chris Lawlor
Hadi, What is your SESSION_COOKIE_AGE set to? This setting controls session expiry. The default is 2 weeks. If you are not setting SESSION_COOKIE_AGE, check that your code is not calling request.session.set_expiry() anywhere. For light use, the default session backend (db) should meet your

Re: Calling Jquery or javascript function based on an if condition

2013-04-26 Thread Chris Lawlor
A slight variation of this approach is to map some Django template context info to Javascript variables in one of your templates, making that data accessible to your compressed / minified JS code: # in a template, "base.html" perhaps.. window.DjangoContext = { userLoggedIn: {{

Re: Am I using static files "wrong"?

2012-10-04 Thread Chris Lawlor
Micah, Here's a summary of how staticfiles works: 1. You place your static files, which are under version control, in app/static folders, or any directory defined in STATICFILES_DIRS. This is configurable, and works very similarly to how templates are placed in a project. The important thing

Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-31 Thread Chris Lawlor
Oops that should have been addressed to nav, sorry On Friday, 31 August 2012 11:57:03 UTC-4, Chris Lawlor wrote: > > Jirka, > > Is your app possibly doing a 301 (Permanent) redirect to www.* ? Or > possibly some other app you were working on recently? Browsers will cache

Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-31 Thread Chris Lawlor
Jirka, Is your app possibly doing a 301 (Permanent) redirect to www.* ? Or possibly some other app you were working on recently? Browsers will cache 301 redirects and automatically do the redirect WITHOUT making the initial request to 127.0.0.1, so if some project you were working on issued

Re: need help on set_password()..............

2012-07-29 Thread Chris Lawlor
If you're using the User model from contrib.auth, you can simply use User.objects.create_user(username, email=None, password=password). This will create a new User object, and then call set_password() # forms.py class RegistrationForm(form.Form): username = forms.CharField() password =

Re: Ranking Queryset

2012-06-20 Thread Chris Lawlor
If you can use .annotate()to calculate the rank, you can further filter / order the annotation results. An example: class Book(models.Model): title =

Re: How do you write a django model that can crunch numbers and automatically populate another field with results?

2012-05-14 Thread Chris Lawlor
Also, you can use aggregate queries to get the tfidf max and min: from django.db.models import Max, Min Party.objects.all().aggregate(Max(tfidf')) {'tfidf__max': 0.5 } See https://docs.djangoproject.com/en/dev/topics/db/aggregation/#cheat-sheet On Wednesday, 9 May 2012 01:00:18 UTC-4, Andy

Re: 3rd party Apps in Django

2011-08-15 Thread Chris Lawlor
+1 for using virtualenv. Indispensable for working on more than one dingo project on the same development machine. If you're developing on Linux or Mac, take a look at virtualenvwrapper. It makes working with virtual environments practically painless. -- You received this message because you

Re: VERY cheap django hosting?

2011-06-08 Thread Chris Lawlor
Always Data (http://www.alwaysdata.com) has a free plan, but it is quite limited (you only get 10 MB disk space). On Jun 8, 2:39 am, Maksymus007 wrote: > megiteam.pl is 24PLN which is about 8usd a month:) > > Pozdrawiam, Maksymilian Pawlak > 08-06-2011 08:30 użytkownik

Re: Parsing feeds that are imported

2011-06-07 Thread Chris Lawlor
I've not used the django community aggregator, so I'm making some assumptions about it's functionality. If that app were to emit a signal for each feed entry that it processed, it would be fairly simple to write a signal handler that would create the associations that you want. With this

Re: cannot login to admin site using admin credentials

2011-02-07 Thread Chris Lawlor
Try running 'python manage.py createsuperuser' on your production server to create a new superuser account. You should have full privileges to log in to the admin and make changes using this account. On Feb 7, 8:15 am, xpanta wrote: > Hi, > > it seems that my problem is a bit

Re: loading the external css file

2011-01-03 Thread Chris Lawlor
, Bithu <bithin2...@gmail.com> wrote: > When i was trying to set my static files. When i added the > 'django.contrib.staticfiles' into INSTALLED_APP in my setting.py the > development server was not running showing an error  Error: No module > named staticfiles. > > On Dec 2

Re: ModelForm Field not display choice text

2010-12-27 Thread Chris Lawlor
Michael, In one of my projects, I did something like this: {% for field in rating_form %} {{ field}} {% endfor %} $('#stars').children().not(":radio").hide() $('#stars').stars({ cancelShow: false, callback: function(ui, type, value){

Re: loading the external css file

2010-12-27 Thread Chris Lawlor
Django doesn't server static files (like your CSS file) by default - but you can configure the development server to do so: http://docs.djangoproject.com/en/dev/howto/static-files/ Note that this has changed a lot in Django 1.3, so be sure to view the correct version of that page for the version

Re: Load file into a FileField

2010-12-21 Thread Chris Lawlor
Liriela, AFAIK it is not possible to programmatically populate a file input field, due to the many security exploits this would enable. If it were possible, it would be trivial to write a malicious script that would upload any file from a user's PC, so long as you knew the path. There are

Re: more than one querys LIKE in the same field

2010-12-14 Thread Chris Lawlor
Not to second guess your intent, but are you sure you don't mean to OR the two? Your current SQL / Django query will only return tags that have both 'candy' and 'milk' in the tags string. If you do want to OR the queries, you can use Q objects: from django.db.models import Q

Re: How to join a search on user and user profile

2010-11-22 Thread Chris Lawlor
You should be able to do something like: UserProfile.objects.filter(gender='female', user__email='some...@mail.com') Note the double underscore notation, which let's you access attributes of the related model. This example assumes that UserProfile has a FK field to User which is named 'user'.

Re: help with django comments

2010-11-07 Thread Chris Lawlor
Assuming your app is named 'gallery' with a model named 'photo', I believe the call should be: {% get_comment_count for gallery.photo as comment_count %} On Nov 6, 5:12 pm, Bobby Roberts wrote: > howdy - > > i'm trying to use comments on my site as follows: > > {%

Re: apache reload

2010-10-04 Thread Chris Lawlor
One approach is to set "MaxRequestsPerChild" to one, basically forcing the server to reload on every request. Probably not the most efficient way to accomplish this, but almost certainly the most simple to implement. On Oct 3, 5:39 pm, Олег Корсак wrote: >

Re: newbie question

2010-10-04 Thread Chris Lawlor
Chris Lawlor On Oct 4, 3:29 am, Martin Melin <mme...@gmail.com> wrote: > On Mon, Oct 4, 2010 at 8:25 AM, mark jason <markjaso...@gmail.com> wrote: > > hi > > I am quite new to django ..I  have written a web app that takes user > > input  and adds  customer details

Re: www.djangoproject.com

2010-07-14 Thread Chris Lawlor
Nick, thank you so much for figuring this out!! On Jul 8, 11:12 am, Nick Raptis wrote: > In firefox, check your preffered language settings, in the content tab. > > If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" > or something) instead of a locale

Re: contrib.auth.views - n00b question

2010-07-07 Thread Chris Lawlor
rs.py" in > _get_reverse_dict >   199.             self._populate() > File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in > _populate >   168.         for pattern in reversed(self.url_patterns): > File "/usr/lib/python2.6/di

Re: contrib.auth.views - n00b question

2010-07-06 Thread Chris Lawlor
You probably don't want to reference the login view to /accounts. You probably mean to do this: (r'^accounts/', include ('django.contrib.auth.urls'), That will map /accounts/login to django.contrib.views.login, /accounts/ logout to django.contrib.views.logout, etc. In general, when using an

Re: Format fields in list, but keep sortable?

2009-12-08 Thread Chris Lawlor
You could add a field to store the calculated size, and override the model's save method to perform the necessary calculation. Something like: def save(self, force_insert=False, force_update=False): self.size_formatted = self.width * self.height // or whatever your calculation actually is

Re: PyDev users: how do you manage tabs?

2009-07-02 Thread Chris Lawlor
Wayne I can't thank you enough!! As the author notes, the posted code is not cross-platform. I incorporated the fix recommended in the comments and posted here for anyone else that might want it: http://dpaste.com/hold/62468/ works fine on my windows machine, haven't tested on my Linux dev box

Re: PyDev users: how do you manage tabs?

2009-07-01 Thread Chris Lawlor
I have the same problem in Komodo Edit - although I the whole filename does show up in the window title I never think to look there. Anyway, I partially solved it by adding a comment at the top of the file for what app the file is for, so I'll see what I'm working on right there in the editor

Re: Installing django

2009-05-21 Thread Chris Lawlor
Just to see what all the fuss is about, most of that video is the guy configuring his particular application. The actual Django install is very straightforward. On May 21, 1:53 am, Kenneth Gonsalves wrote: > On Thursday 21 May 2009 11:15:29 LeonTheCleaner wrote: > > >