Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread Lachlan Musicman
On Wed, Jul 1, 2009 at 06:02, zweb wrote: > > What book or resource would you recommend to learn advanced Python? > (other than python docs) "How to think like a computer scientist": http://www.greenteapress.com/thinkpython/ -- "I'm in IT and we generally know how to use the interwebs like supe

Why doesn't my isinstance() work?

2010-04-20 Thread Lachlan Musicman
Hola, I'm having trouble getting a subclass to trigger an isinstance(). Code below: model.py excerpt: from django.db import models from django.forms import ModelForm class Author(models.Model): first = models.CharField(u'First Name', max_length=20) other = models.CharField(u'Oth

Re: Why doesn't my isinstance() work?

2010-04-21 Thread Lachlan Musicman
On Wed, Apr 21, 2010 at 19:33, Daniel Roseman wrote: >> >> Any tips? > > This is the expected behaviour. You've asked for an Author object, so > that's what you've got. There's no way to tell from the Author model > that this particular instance of it is also an instance of Translator. I presume

loaddata and m2m backend tables...

2010-04-25 Thread Lachlan Musicman
Hi, I used loaddata to insert some data into my app - now all my model related tables are correctly populated. How do I fill in the many to many tables, since there isn’t a model that directly represents those tables? I found this: http://www.b-list.org/weblog/2007/nov/21/install-time/ but it su

Re: loaddata and m2m backend tables...

2010-04-25 Thread Lachlan Musicman
On Mon, Apr 26, 2010 at 15:06, Lachlan Musicman wrote: > > How do I fill in the many to many tables, since there isn’t a model > that directly represents those tables? Ah, just import it straight into database, works a treat. I used phpmyadmin and my csv dump. No need for loadda

Re: translation for variables

2010-07-09 Thread Lachlan Musicman
On Fri, Jul 9, 2010 at 07:05, Börni wrote: > Hello together, > i'm using the trans tpl tag for translation a value from database. If > i'm adding this value to my django.po file and run makemessages > afterwards, my changes got lost. Are you manually adding the field to your po file? Are you run

Re: translation for variables

2010-07-10 Thread Lachlan Musicman
On Sat, Jul 10, 2010 at 05:26, Börni wrote: >> > Hello together, >> >> Are you running "django-admin.py compilemessages" to create the >> relevant django.mo file after the event? > > Yes, i've tried it with the existing django.po file. And my other try > was to create an additional file called dat

Re: Help with localization

2010-07-25 Thread Lachlan Musicman
I have L10n working, and the set up is almost the same. I also have, in settings.py the following: LOCALE_PATH = ( os.path.join(PROJECT_DIR, "myapp/locale"), ) > * locale/sk/LC_MESSAGES/django.po: > ... > #: forms.py:7 > msgid "Your name" > msgstr "Vaše meno" > ... > > Confirm which ve

Re: Help with localization

2010-07-25 Thread Lachlan Musicman
On Mon, Jul 26, 2010 at 11:16, Martin Tiršel wrote: > * userproject/settings.py: > LANGUAGE_CODE = 'sk' > > LANGUAGES = ( >('en', 'English'), >('sk', 'Slovensky'), > ) > USE_I18N = True > USE_L10N = True > Gah, my eyes were closed. Have you also added the appropriate Middleware product?

Re: Dango-tagging incompatibilities?

2010-08-05 Thread Lachlan Musicman
I am using django-tagging with trunk and am not experiencing any real problems. Admittedly, I'm not under massive load, but it's working fine... cheers L. On Fri, Aug 6, 2010 at 08:18, adelein wrote: > Has anyone used django-tagging lately with Django 1.1 and above? I am > starting to use it but

Re: Translation

2010-08-10 Thread Lachlan Musicman
On Wed, Aug 11, 2010 at 02:43, kostia wrote: > Docs and djangobook useless in question of translation. Any other > guide to read is available? I would recommend you use Firefox, go to Edit->Preferences->Content, choose the language of choice at the bottom. You can't just translate the site and e

Re: Translation

2010-08-11 Thread Lachlan Musicman
On Thu, Aug 12, 2010 at 03:07, kostia wrote: > > Great. It somehow got working. > > I have the next code in the template: > {% blocktrans with form_type|capfirst as task %}{{ task }} project{% > endblocktrans %} > > Rosetta shows me an error in the left window: > %(task)s project > > And when I tr

Re: forms tutorials

2010-08-11 Thread Lachlan Musicman
These are the more up to date docs: http://docs.djangoproject.com/en/dev/topics/forms/ Also, in IRC yesterday Mattmcc (I think) dropped this doozy: http://sprawsm.com/uni-form/ Once you have mastered forms, uni-form should make the css a lot easier - note the django plugin at the bottom of the

Re: Django 1.3

2010-08-15 Thread Lachlan Musicman
On Sun, Aug 15, 2010 at 20:38, DjangoRocks wrote: > I was wondering if South would be added as part of the standard Django > release? > As I understand it the Django devs have requested it's integration, and the South dev has responded "I would like the South code to be cleaner and smarter". I

Re: Мобильная версия

2010-08-27 Thread Lachlan Musicman
according to google: I can not understand how best to implement the definition of what a person gone now, with mobile, and that I need to shove him to the mobile version? Maybe someone already implement these moments? It's a drunk russian beat poet that's lost his or her way, just ignore them.

Re: Мобильная версия

2010-08-27 Thread Lachlan Musicman
2010/8/27 Lachlan Musicman : > It's a drunk russian beat poet that's lost his or her way, just ignore them. That come out wrong on re reading. I didn't mean to offend if I did, apols. > > 2010/8/27 Олег Корсак : >> English? >> >> 27.08.2010 04:42, V

Re: set utf8 as default database char set

2010-08-31 Thread Lachlan Musicman
On Tue, Aug 31, 2010 at 23:52, Elim Qiu wrote: > I just feel kind of redundant to have the same text in and above the > textfields. This is a result of the tutorial - they aren't always the same :) > And also the odd table layout that makes choice fields and votes' fields so > apart; and do

Re: Does anyone have the completed and fully-working code from the Tutorial?

2010-09-07 Thread Lachlan Musicman
On Wed, Sep 8, 2010 at 04:27, Erskine wrote: > After much gnashing of teeth and having looked over the code dozens of > times I finally realized I was missing one wretched little comma in > the HttpResponseRedirect return argument. > heh. The archetypal "welcome to coding" bug headfsck. I still

Re: django-tagging languages and multi fields

2010-09-07 Thread Lachlan Musicman
On Tue, Sep 7, 2010 at 16:39, Henrik Genssen wrote: > Hi, > > has someone a solution for tags in more than one language for the same > entry? > I normally use transdb (1) to archive this on char or textfields. But what > about tags in multi languages for one entry? > > Has someone managed to get m

Re: Language Translation

2010-09-08 Thread Lachlan Musicman
On Wed, Sep 8, 2010 at 17:42, Kenneth Gonsalves wrote: > On Wed, 2010-09-08 at 00:32 -0700, hemi19 wrote: >> Iam new to the django and i want know how can i translate my site >> language >> according to the country or any language. suppose if my user selects >> chinese >> language then the site sh

Re: Conf/locale

2010-11-21 Thread Lachlan Musicman
On Sat, Nov 20, 2010 at 23:29, Tsolmon Narantsogt wrote: > Hello fellows. > I'm using Django 1.1 version. My goals is create multiple language site. > I make po file > myprojectname/conf/locale/mn/LC_MESSAGES/django.po > and some msgid, msgstr. > But it's don't work. It's too late in the day to g

percentage of models given field value?

2010-11-24 Thread Lachlan Musicman
Hola, Using django 1.2 I wanted to present some statistics on the data that we have been collecting in our db. We have source texts with authors, and target texts with their translators. The target text model has a value "Language". I get the count of the target texts: all, and then filtered by

Re: percentage of models given field value?

2010-11-24 Thread Lachlan Musicman
On Thu, Nov 25, 2010 at 13:44, Christophe Pettus wrote: > > On Nov 24, 2010, at 4:37 PM, Lachlan Musicman wrote: >> Using django 1.2 I wanted to present some statistics on the data that >> we have been collecting in our db. >> >> We have source texts with author

Re: Django - Alternative to using NULLs? (for integer and FK fields).

2010-11-29 Thread Lachlan Musicman
On Tue, Nov 30, 2010 at 12:28, Victor Hooi wrote: > Hi, > > I'm wondering what the community's stance on using NULL in Django is? > > Say for example you have: > >    class Person(models.Model): >        street_address = models.CharField(max_length=50, blank=True) >        suburb = models.CharFiel

Re: percentage of models given field value?

2010-12-08 Thread Lachlan Musicman
On Thu, Nov 25, 2010 at 16:00, Christophe Pettus wrote: > > On Nov 24, 2010, at 8:13 PM, Lachlan Musicman wrote: >> Thanks Christopher. I've never done raw SQL in Django before. This may >> seem like a silly follow up question, but is it standard practice to >> put th

Re: percentage of models given field value?

2010-12-08 Thread Lachlan Musicman
On Thu, Dec 9, 2010 at 14:13, Lachlan Musicman wrote: > On Thu, Nov 25, 2010 at 16:00, Christophe Pettus wrote: >> >> On Nov 24, 2010, at 8:13 PM, Lachlan Musicman wrote: >>> Thanks Christopher. I've never done raw SQL in Django before. This may >>> seem l

Re: Question!!!

2010-03-28 Thread Lachlan Musicman
On Mar 6, 11:41 am, summea wrote: > But do you know if there is any way to set a ManyToManyField's column > heading to something besides the function name itself?  For example... > I tried setting verbose_name='authors' in the model... but it didn't > seem to work as expected.  (No error really,

Date format errors and date defaults

2012-05-06 Thread Lachlan Musicman
I'm getting an error I don't quite understand how to solve - despite having USE_L10N = True DATE_FORMAT=('j N, Y') DATE_INPUT_FORMATS=('%d %B %Y') in my settings.py, the SelectDateWidget still renders in Month/Day/ Year order instead of day/month/year? Also, is there a way to set the default mon

Generic Views with flair?

2012-05-06 Thread Lachlan Musicman
I've happily worked out how to work @login_required for entries in views.py, but since the latest tutorial (which I followed) recommends moving to the Generic Views my code is now like this: urls.py ... url(r'^people/$', ListView.as_view( queryset=Person.object

Filter by retirement age?

2012-05-08 Thread Lachlan Musicman
Hola, I have a model Person with a dob = models.DateField() I would like to filter by age - in particular only include people less than 60 years old. I am having no luck getting the syntax right and was looking for pointers? queryset=Person.objects.filter(dob__year__gte = datetime.dat

Re: Filter by retirement age?

2012-05-09 Thread Lachlan Musicman
opular answer's standard lib use of from_date.replace - is there a norm regards where a small utility like that would be put? It feels wrong putting it in [views|admin|models|url].py ..? cheers L. On Wednesday, May 9, 2012, Tom Evans wrote: > On Wed, May 9, 2012 at 12:12 AM, Lachlan Musicman

Re: Filter by retirement age?

2012-05-09 Thread Lachlan Musicman
> > _Nik > > On 5/8/2012 4:12 PM, Lachlan Musicman wrote: > > Hola, > > I have a model Person with a dob = models.DateField() > > I would like to filter by age - in particular only include people less > than 60 years old. > > I am having no luck getting

Search in Django

2012-05-09 Thread Lachlan Musicman
Hi, I want to implement search in my django project. Looking around, I see lots about Haystack. I looked at Whoosh for the backend, but then I saw a tutorial for Djapian/Xapian that made the whole thing look dead simple. Also, since then I've discovered that Whoosh is lightweight and while the

Admin plugins

2012-06-13 Thread Lachlan Musicman
Hola, I just watched a video from last year about modifying the Django Admin interface. I was wondering if people recommend any particular app? Grappelli and django-admin-tools are both still being developed. Are there any others and if you prefer one, why? Am thinking especially in terms of han

Re: Admin plugins

2012-06-14 Thread Lachlan Musicman
cheers L. > > best, > patrick > > > Am Donnerstag, 14. Juni 2012 00:33:00 UTC+2 schrieb Lachlan Musicman: >> >> Hola, >> >> I just watched a video from last year about modifying the Django Admin >> interface. I was wondering if people recommend any parti

Re: New to DJANGO

2012-06-24 Thread Lachlan Musicman
On Thu, Jun 21, 2012 at 9:37 PM, LJ wrote: > I started out learning Django using the "Writing your first Django app" > article: > https://docs.djangoproject.com/en/dev/intro/tutorial01/ > This is a very well-written tutorial that goes through each part in detail. > Please note, at the bottom of ea

Re: Uninstall for clean install

2012-06-24 Thread Lachlan Musicman
Thomas, If you've ever wanted to know why vitualenv is a good idea - here's a great reason. Since it compartmentalises everything - packages the whole deal, you can just create a new virtualenv and start developing. http://www.arthurkoziel.com/2008/10/22/working-virtualenv/ Cheers L. On Sun, J

Re: Same virtual-env for all django projects

2012-07-02 Thread Lachlan Musicman
On Tue, Jul 3, 2012 at 10:52 AM, Smaran Harihar wrote: > Hi Djangoers, > > I am using virtual-env for my django project and I wanted to know that is it > ok to use the same virtual-env for all the django projects on my system? > > or do I need to create a virtual-env for every other django project

Re: migration via south for inheritance change -> please help

2012-07-04 Thread Lachlan Musicman
I'd like to know this too - but I think the real answer is "get better at python" - you are essentially (from what I can tell) in a django shell when south pops the "not blank, not null but no data" error - try pulling in some details from fixtures? cheers L. On Thu, Jul 5, 2012 at 2:30 AM, Danie

Adding more data to Generic Views

2012-07-30 Thread Lachlan Musicman
Hola, I'm confused about adding extra content to a class based Generic View. I've read the docs at file:///home/datakid/src/django-docs/topics/class-based-views.html and have written the code accordingly. I have Person, Certificate, Job and Compensation objects. The last three all have an FK (or

Re: Adding more data to Generic Views

2012-07-31 Thread Lachlan Musicman
On Tue, Jul 31, 2012 at 11:15 PM, Karl Sutt wrote: > So, in conclusion, Lachlan, you would want to do something like: > > def get_context_data(self,**kwargs): >> #Call the base implementation first to get a context >> context = super(PersonDetailView, self).get_context_data(**kwa

Re: Adding more data to Generic Views

2012-07-31 Thread Lachlan Musicman
On Wed, Aug 1, 2012 at 12:43 AM, Melvyn Sopacua wrote: > On 31-7-2012 6:17, Lachlan Musicman wrote: > > > I have Person, Certificate, Job and Compensation objects. The last three > > all > > have an FK (or M2M) back to a (or some) Person(s). > > > > So reve

Re: Adding more data to Generic Views

2012-07-31 Thread Lachlan Musicman
On Wed, Aug 1, 2012 at 8:45 AM, Lachlan Musicman wrote: > On Wed, Aug 1, 2012 at 12:43 AM, Melvyn Sopacua wrote: > >> On 31-7-2012 6:17, Lachlan Musicman wrote: >> >> > I have Person, Certificate, Job and Compensation objects. The last three >> > all >>

Created & updated date/time in models

2012-08-08 Thread Lachlan Musicman
Hola, I've got a bunch of date dependent data that I will need to analyse as the years go by. So adding create_date and update_date fields seems like the thing to do. I go researching I and I see that there are debates about whether auto_now_add and auto_now are useful or whether they should be h

Re: Created & updated date/time in models

2012-08-09 Thread Lachlan Musicman
On Thu, Aug 9, 2012 at 3:33 PM, Dennis Lee Bieber wrote: > On Thu, 9 Aug 2012 09:02:39 +1200, Lachlan Musicman > declaimed the following in gmane.comp.python.django.user: >> >> From what I can see, the admin interface already keeps this data for >> each object (exception:

Re: Created & updated date/time in models

2012-08-12 Thread Lachlan Musicman
On Sun, Aug 12, 2012 at 12:06 PM, Melvyn Sopacua wrote: > On 8-8-2012 23:02, Lachlan Musicman wrote: > >> From what I can see, the admin interface already keeps this data for >> each object (exception: no create_date for data imported via fixtures >> apparently). > &g

Re: New to Django, Admin Page not Loading

2012-08-13 Thread Lachlan Musicman
On Tue, Aug 14, 2012 at 10:04 AM, judy ngai wrote: > Here is my urls.py page > > from django.conf.urls.defaults import patterns, include, url > from django.contrib import admin > admin.autodiscover() > > > urlpatterns = patterns('', > # Examples: > # url(r'^$', 'budgetmanager.views.home',

Model method represented as non-editable field on object edit page

2012-08-13 Thread Lachlan Musicman
Hola, I have a Person object with Class Person(model.Models): ... def get_id(self): """ This returns the worker's reference number, or "worker ID" Think like a social security number Not kept in the database as it would be extraneous The 10 is added

Re: Django 1.4 admin. Calendar widget appears for DateTimeField but not DateField

2012-08-16 Thread Lachlan Musicman
Grimmus, You haven't really given us a lot of information to work with. My suggestion is: 1. Try it in another browser or clear your cache and try again 2. Send some more information, by (for example) using a code inspector (show source, firebug, etc) to see if the jquery and template code is in

Re: I LOVE THIS COMMUNITY!

2012-08-21 Thread Lachlan Musicman
+1 On Wed, Aug 22, 2012 at 10:49 AM, Babatunde Akinyanmi wrote: > Amen to that > > On 8/21/12, Mario Gudelj wrote: >> I just want to tell you guys that you're awesome! I've never seen a >> community which helps noobs so much and with so few dickheads in it. Good >> on you! >> >> Mario >> >> -- >

Model ChoiceField?

2012-08-30 Thread Lachlan Musicman
Hi, I was just wondering if there was any noticeable difference between the models.ChoiceField() and the models.CharField(max_length=x,)? In the documentation I have (offline, Django v1.4) a reference to: /path/django-docs-1.4-en/ref/forms/fields.html#django.forms.ChoiceField.choices But in the

Re: Model ChoiceField?

2012-08-30 Thread Lachlan Musicman
Ok, ignore this email - I've just realised one is a Form field, and the other is a Model field. Apols for stupid. Cheers L. On Fri, Aug 31, 2012 at 1:09 PM, Lachlan Musicman wrote: > Hi, > > I was just wondering if there was any noticeable difference between > the models.Choi

Re: To Use or Not to Use the admin backend

2012-09-03 Thread Lachlan Musicman
On Tue, Sep 4, 2012 at 3:38 AM, Frankline wrote: > Hi, > > I'm creating a site in Python/Django and feel that the admin backend, as > good as it is, may not be a one-fit-for-all situations. > > My question is this: > > Have any of you ever had a need to have a custom admin backend? Only just yest

Re: To Use or Not to Use the admin backend

2012-09-03 Thread Lachlan Musicman
Oh, and I forgot to mention, there's this video: http://python.mirocommunity.org/video/1861/djangocon-2010-customizing-the which I watched recently - it's a bit old, but interesting none the less cheers L. -- You received this message because you are subscribed to the Google Groups "Django us

'str' object is not callable in base.py

2012-09-03 Thread Lachlan Musicman
Hi all, Stumped on this one: Traceback: Environment: Request Method: GET Request URL: http://127.0.0.1:8000/tafe/timetable/2012-4/ Django Version: 1.4 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.con

Re: To Use or Not to Use the admin backend

2012-09-04 Thread Lachlan Musicman
On Wed, Sep 5, 2012 at 1:50 AM, Tomas Neme wrote: > I've a question about this. I tried to do something like this, but > using the main capabilities and hacking on the ModelAdmin classes, > changing the formsets and the like, and reusing as much as possible, > including of course the admin templat

Re: 'str' object is not callable in base.py

2012-09-04 Thread Lachlan Musicman
On Tuesday, September 4, 2012, zayatzz wrote: > From this post i can see this line beeing wrong . > > timetable = get_object_or_404(slug=slug) > > You also need to give object as one of the parameters for > get_object_or_404 shortcut: like this : > > https://docs.djangoproject.com/en/dev/intro/tut

Re: 'str' object is not callable in base.py

2012-09-04 Thread Lachlan Musicman
On Wednesday, September 5, 2012, Bill Freeman wrote: > My best guess is that, for whatever reason, 'timetable_view' in your url > conf > has not been converted into the view function. Try actually importing the > view in urls.py and putting it as the target of the pattern *without* > the quotes.

Override save or other options?

2012-09-10 Thread Lachlan Musicman
Hi All, Simplistically, I have an event type model (for a "school class") with a date field. On saving of the first event, I want to add recurring objects. Specifics for this project are "up to a latest date" (ie, end of term) and "recur weekly only" (not daily, monthly, yearly, etc - for the sch

Re: Override save or other options?

2012-09-11 Thread Lachlan Musicman
On Tue, Sep 11, 2012 at 5:15 PM, Jani Tiainen wrote: > > Rather than creating individual series of events from recurring I would do a > concept called "recurring event". So it would be just a single event that is > projected to spesific days as necessary. It requires a slightly more work > but it'

Forms, ChoiceFields and import?

2012-09-11 Thread Lachlan Musicman
Hi Is there anyway to import the choices from my models.py into my forms.py to prevent code duplication? At the moment I've got the following, but I'm getting invalid sytax errors in my forms.py: models.py : SESSION_CHOICES = ( (u'0',u'Morning 1'), (u'1',u'Morning 2')

Re: Forms, ChoiceFields and import?

2012-09-11 Thread Lachlan Musicman
have a syntax error here: >> >> timetable = >> forms.ModelChoiceField(queryset=Timtables.objects.all.ordered_by('-date') >> >> should be: >> >> timetable = >> forms.ModelChoiceField(queryset=Timtables.objects.all.ordered_by('-date')) >>

Re: Override save or other options?

2012-09-11 Thread Lachlan Musicman
reate > a series model and use it as a foreign key in your event to keep on top of > everything it should work. You mean it should work with keeping per-date attendance records you mean? cheers L. > > -m > > On 12 September 2012 07:31, Lachlan Musicman wrote: >> >> On Tue

ViewDoesNotExist !?!?! It certainly does....

2012-09-11 Thread Lachlan Musicman
Hola As per subject - I'm getting ViewDoesNotExist errors on a view that does exist. I've checked the spelling, indenting and it all seems legit. If I comment out the two lines that call the view in question from urls.py, everything is back to normal. --- tafe/urls.py from django.conf.urls

Re: ViewDoesNotExist !?!?! It certainly does....

2012-09-11 Thread Lachlan Musicman
Grrr - sorry sent before I was finished. tafe/views.py # Create your views here. from tafe.models import Session from tafe.forms import SessionRecurringForm from django.shortcuts import render_to_response from django.http import HttpResponseRedirect import datetime def session_create(request):

Re: ViewDoesNotExist !?!?! It certainly does....

2012-09-12 Thread Lachlan Musicman
On Wed, Sep 12, 2012 at 6:19 PM, Sergiy Khohlov wrote: > add to urls > from tafe.views import session_create Thanks. I actually found this solution late late last night while offline, buried deep in the docs: /PATH/django-docs-1.4-en/topics/http/urls.html#passing-callable-objects-instead-of-str

Re: Problem Accessing Admin Pages

2012-09-13 Thread Lachlan Musicman
On Fri, Sep 14, 2012 at 7:40 AM, bml1rules wrote: > Hey Guys! > > I am the webmaster of a Django database and I recently ran into a snag. We > have an admin section with about 15 privileges. All of a sudden, almost all > of them are gone. I've tried getting to them by typing in the url, but it > j

get_absolute_url is returning '' instead of url

2012-09-13 Thread Lachlan Musicman
Hi, I'm getting blank get_absolute_url problems that I just can't solve. I can get to an object by actually visiting the url that would be constructed - I've checked that: app/session/year/month/day/slug models.py: class Session(models.Model): ... @models.permalink def get_absolute_url(se

Re: get_absolute_url is returning '' instead of url

2012-09-13 Thread Lachlan Musicman
On Fri, Sep 14, 2012 at 1:38 PM, Russell Keith-Magee wrote: > On Fri, Sep 14, 2012 at 9:07 AM, Lachlan Musicman wrote: >> Hi, >> >> I'm getting blank get_absolute_url problems that I just can't solve. I >> can get to an object by actually visiting the ur

Re: get_absolute_url is returning '' instead of url

2012-09-13 Thread Lachlan Musicman
On Fri, Sep 14, 2012 at 2:05 PM, Lachlan Musicman wrote: > On Fri, Sep 14, 2012 at 1:38 PM, Russell Keith-Magee >> Something is going wrong in the reversing process, which is raising an >> exception, which is silently swallowed by the get_absolute_url call. >> The usual culpr

Re: get_absolute_url is returning '' instead of url

2012-09-13 Thread Lachlan Musicman
> How do I call reverse in the shell? Import it and...? > > reverse(s)? Gah, should have tried that before sending: >>> from django.core.urlresolvers import reverse >>> reverse(s) Traceback (most recent call last): File "", line 1, in File "/home/datakid/src/envs/mlhrd/local/lib/python2.7/s

Re: get_absolute_url is returning '' instead of url

2012-09-13 Thread Lachlan Musicman
On Fri, Sep 14, 2012 at 2:47 PM, Lachlan Musicman wrote: >> How do I call reverse in the shell? Import it and...? >> >> reverse(s)? > > Gah, should have tried that before sending: > >>>> from django.core.urlresolvers import reverse >>>> rever

Re: get_absolute_url is returning '' instead of url

2012-09-13 Thread Lachlan Musicman
On Fri, Sep 14, 2012 at 2:53 PM, Russell Keith-Magee wrote: > On Fri, Sep 14, 2012 at 10:47 AM, Lachlan Musicman wrote: >>> How do I call reverse in the shell? Import it and...? >>> >>> reverse(s)? >> >> Gah, should have tried that before sending: >

Abstract classes and inhertience

2012-09-16 Thread Lachlan Musicman
Hola, I have an abstract base class, Person, with three children: Applicants, Students and Staff. I have two questions. As per docs ($PATH/topics/db/managers.html#custom-managers-and-model-inheritance) I have three managers for the Abstract class: people = models.Manager() men = MaleManager()

Confused by BooleanField

2012-09-18 Thread Lachlan Musicman
Hola, I've written a form that has two BooleanFields on it. They render as text boxes on the page, which is great. All my initial testing included checking the boxes for the two BooleanFields as this is the major use case. I just did a test in which I didn't check the boxes, and I'm getting "Th

Re: date display problem?

2012-09-18 Thread Lachlan Musicman
On Wed, Sep 19, 2012 at 2:34 PM, Navnath Gadakh wrote: > i have post date variable to view? but when i retrieve date from database . > not displaying on browser We need more information than that - do you mean it's not displaying in a form, in a regular template or in the admin pages? And how ar

Re: Confused by BooleanField

2012-09-18 Thread Lachlan Musicman
Ignore - I've found the documentation. PATH/ref/forms/fields.html#booleanfield required=False cheers L. -- 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 thi

Re: date display problem?

2012-09-18 Thread Lachlan Musicman
On Wed, Sep 19, 2012 at 3:51 PM, Navnath Gadakh wrote: > model >class Offer(models.Model): > effective_date = models.DateField() > expiration_date = models.DateField() Nothing wrong here > view.py > HTML = HTML + "" > HTML = HTML + "Offer Desc

Re: date display problem?

2012-09-19 Thread Lachlan Musicman
On Wed, Sep 19, 2012 at 10:19 PM, Navnath Gadakh wrote: > i am fetching multiple rows? > i have already used > for offer in offers: > print offer.effective _date > but didnt work.my code is > my_offers = > Offer.objects.filter(offer_id=coupon.offer_id_id,is_active=True) >

Strange rendering behaviour in template/user/auth

2012-09-20 Thread Lachlan Musicman
Hola, I've noticed for a while that my home/index page wasn't registering the {{ user }} tag when rendering the page: there was no "Welcome Username. Change password / Log out" in the top right corner, and the link to the admin interface that I'd put in the breadcrumbs for logged in users wouldn't

Re: Strange rendering behaviour in template/user/auth

2012-09-20 Thread Lachlan Musicman
f - I guess I just add something similar? ...OK, I just added exactly the same as for the CSRF and it worked - thanks Hevok! cheers L. > > Bests, > Hevok > > > On Friday, September 21, 2012 12:20:04 AM UTC+2, Lachlan Musicman wrote: >> >> Hola, >> >> I&#x

Re: Strange rendering behaviour in template/user/auth

2012-09-20 Thread Lachlan Musicman
er placed, or to have better examples. Or maybe that's exactly what the list/IRC is for :) Cheers L. > > Cheers, > Hevok > > > > On Friday, September 21, 2012 12:50:13 AM UTC+2, Lachlan Musicman wrote: >> >> On Fri, Sep 21, 2012 at 10:29 AM, hevok wrote: >

Re: How to extend the TextField in Django?

2012-09-20 Thread Lachlan Musicman
What you are looking for is called a WYSIWYG editor widget - there are a couple of extentions/plugins lying around: http://djangosnippets.org/snippets/1705/ or http://blog.bixly.com/post/22376374604/django-tinymce-a-wysiwyg-editor-for-django or https://github.com/pydanny/django-wysiwyg/ or http://

Re: A lots of foreign keys - Django Admin

2012-09-24 Thread Lachlan Musicman
I'm not an expert on this matter, but I did read about list_select related recently: /path/django-docs-1.4-en/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_select_related which links to select related: django-docs-1.4-en/ref/models/querysets.html#django.db.models.query.QueryS

View.py v models.py

2012-09-26 Thread Lachlan Musicman
Hi I was doing some work on a view last night and realised that the code could go into either views.py or as a method on the model. Do people have internal guidelines about when they make something a method on a model rather than a view function? Is there any functional difference apart from the

Re: View.py v models.py

2012-09-26 Thread Lachlan Musicman
On Thu, Sep 27, 2012 at 10:59 AM, Javier Guerra Giraldez wrote: > On Wed, Sep 26, 2012 at 5:50 PM, Lachlan Musicman wrote: >> Do people have internal guidelines about when they make something a >> method on a model rather than a view function? > > if it's not a prese

conditional model validation

2012-09-27 Thread Lachlan Musicman
Hola, I'm searching without much luck and can't see the answer in the docs. Am wanting to override the is_valid() method on a model (I think that's what I want). Basically, I have a choices field, and if one of those choices is selected, then I want a description field to be not blank/not the em

last changed by User

2012-09-27 Thread Lachlan Musicman
Hola, I wanted to display the user that last changed a model instance. It's hard to search for because the username/email-as-login makes up the majority of the search results. Despite this, I've found a couple of pages, with this being the most like what I want: https://code.djangoproject.com/w

Re: last changed by User

2012-09-27 Thread Lachlan Musicman
On Friday, September 28, 2012, Lachlan Musicman wrote: > > I wanted to display the user that last changed a model instance. > > Despite this, I've found a couple of pages, with this being the most like > what I want: > > https://code.djangoproject.com/wiki/CookBookNewfo

Re: i am getting ConfigParser.NoSectionError: No section: 'database' plz help

2012-09-27 Thread Lachlan Musicman
On Fri, Sep 28, 2012 at 4:05 PM, Navnath Gadakh wrote: > ConfigParser.NoSectionError: No section: 'database' Off the top of my head, I would suggest you have nothing in the section DATABASES in your settings.py Does your settings.py have something that looks like: DATABASES = { 'default': {

Re: i am getting ConfigParser.NoSectionError: No section: 'database' plz help

2012-09-27 Thread Lachlan Musicman
On Fri, Sep 28, 2012 at 4:15 PM, Lachlan Musicman wrote: > On Fri, Sep 28, 2012 at 4:05 PM, Navnath Gadakh > wrote: >> ConfigParser.NoSectionError: No section: 'database' Although a quick google of the phrase is showing up lots of mysql-python hits - is python-mys

Re: conditional model validation

2012-09-28 Thread Lachlan Musicman
is a blank or empty string > Check: https://docs.djangoproject.com/en/dev/ref/forms/validation/ > which is a link to the documentation on form validation > cheers - since I am using the admin forms, I was hoping I could add it to the model, but is ok if I need to rewrite the forms

Like a Formset but not...

2012-10-03 Thread Lachlan Musicman
Hi, I am looking for a way to do something similar to a formset, but slightly different. I have a list of students in a class (class as a school subject, not class in programming) with attendance record objects having a FK to both student and class, as well as two fields with choices lists relati

Inlines defined before use?

2012-10-03 Thread Lachlan Musicman
Hola, I'm finding that if my inlines aren't defined before use in the admin.py, I'm getting the following errors: inlines=('MyModelInline',) "issubclass() arg 1 must be a class" Errors inlines=(MyModelInline,) "name 'MyModelInline' is not defined" This is a minor issue, easily solved by putting

Re: Managers, Queryset, inheritance and polymorphism

2012-10-08 Thread Lachlan Musicman
On Sat, Oct 6, 2012 at 3:14 AM, Amirouche wrote: > Héllo, > > I got a problem with manager, some of you may already know it, I try my best > to like them, if anyone can explain me the purpose of their existence I will > be so much grateful :) > > Like I said, I try my best but: > > 0) Documentatio

Re: Inlines defined before use?

2012-10-08 Thread Lachlan Musicman
re django-wranglings. Cheers L. > > On Wed, Oct 3, 2012 at 5:58 PM, Lachlan Musicman wrote: >> Hola, >> >> I'm finding that if my inlines aren't defined before use in the >> admin.py, I'm getting the following errors: >> >> inlines=(&

Re: Django testing strategy

2012-10-09 Thread Lachlan Musicman
This has been a very interesting thread - out of interest, does anyone have a preference for one of factory-boy or django-dynamic-fixture and why? They look similarly up to date and useful, but I've no idea how to differentiate them. cheers L. -- ...we look at the present day through a rear-vie

Re: perfectionists... motto doesn't fit

2012-10-13 Thread Lachlan Musicman
On Sat, Oct 13, 2012 at 12:39 PM, Russell Keith-Magee wrote: >> Russell (and Jacob), >> >> I really appreciate the way you moderate the forum. I was thinking exactly this when I read Russell's first response. This is an excellently run community. Thankyou for your work cheers L. -- ...we look

Overriding admin save event

2012-10-15 Thread Lachlan Musicman
Hola, I wanted to override the save event in the admin so that users were redirected to a different page. I found this page describing how to do it: http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html#listing10 It recommends two methods and describes one: "There are

Re: Overriding admin save event

2012-10-15 Thread Lachlan Musicman
On Tue, Oct 16, 2012 at 12:52 PM, Lachlan Musicman wrote: > Hola, > > I wanted to override the save event in the admin so that users were > redirected to a different page. Of course, further reading has turned up signals. Is this the current recommended method

  1   2   3   4   5   >