Re: Sets

2008-07-20 Thread Cole Tuininga

>> On Sat, Jul 19, 2008 at 11:50 PM, Julien Phalip <[EMAIL PROTECTED]> wrote:
>> >
>> Oops - sorry, I wasn't very clear in my original request.  I'm looking
>> for a set type in the Django model hierarchy.  Does this make more
>> sense?
>
> A set is just an unordered collection of objects. In other words, it's
> the rows in a database table, so it's instances of a Django model. Thus,
> if you want to model a set, you can use a many-to-one relation
> (ForeignKey) or a many-to-many relation.

I had figured that this might be the way to accomplish what I'm doing.
 What I'm really looking for is something in the model structure that
would make use of a MySQL "set" type.

Basically, I have an object where an attribute is a set of codes
(strings for all practical purposes).  These items don't really
warrant their own class - it's truly a set that is an attribute of a
class.

If I have to implement it as a many to many relationship with another
class, then that's how it is.  I suppose I could also do it as a bunch
of named boolean attributes in the original class, but that somehow
feels more hackish.

-- 
Cole Tuininga
http://www.tuininga.org/

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

2008-07-20 Thread Cole Tuininga

On Sat, Jul 19, 2008 at 11:50 PM, Julien Phalip <[EMAIL PROTECTED]> wrote:
>
> 'set' is a Python standard object [1], since version 2.4. In version
> 2.3 you need to import the 'Set' package first.
> So, if you care about backward compatibility in Python, the most
> secure way to import it is:

Oops - sorry, I wasn't very clear in my original request.  I'm looking
for a set type in the Django model hierarchy.  Does this make more
sense?

-- 
Cole Tuininga
http://www.tuininga.org/

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



Sets

2008-07-19 Thread Cole Tuininga

Quick question for you folks - is there a native "set" type in the
Django model system?  I'm currently on 0.96.1.  Thanks!

-- 
Cole Tuininga
http://www.tuininga.org/

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



Accessing Session from urls.py

2008-04-13 Thread Cole Tuininga

Hey folks -

I'm looking to make url "routing" choices based on some values from
the session.  That is, I want to change the url->view mapping based on
the session variables.  Problem is, I can't seem to figure out how to
access the session from urls.py.  I understand that outside views I
can load up a session object by importing
django.contrib.sessions.models.Session and then doing a get by using a
pk of the session id.  But since I don't know how to access the
request object from within urls.py, I don't know how to get the cookie
value containing the session id.  :)  And if I could access the
request object, I wouldn't need to go through that rigamarole, since
I'd be able to just access request.session directly.

Help?  (I'm using Django 0.96.1, btw)

Many thanks!

-- 
Cole Tuininga
http://www.tuininga.org/

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



Model design help

2007-07-28 Thread Cole Tuininga

Hey all - I was hoping I could solicit some help with a model design.
I'm using 0.96 rather than the svn version at the moment.

I'm working on a website for my wife that is intended to help with
taking registrations for a conference.  The idea is that each workshop
in the conference has a "timeslot" attribute.  Obviously, multiple
sessions can point at the same timeslot.  Timeslots are also models so
that as the conference is organized, my wife can alter them through
the admin interface.

When a person registers, they are asked to select their top three
choices of workshops for each timeslot.  The thing is that as the
timeslots are variable, I'm having trouble figuring out how I should
set up the relationship between the attendee and the selected
workshops.

I could do something like a simple many to many relationship in the
attendee model, but that doesn't indicate ordering (most preferred to
least preferred) per timeslot.

Have I explained this well enough?  Anybody have thoughts?

-- 
Cole Tuininga
http://www.tuininga.org/

--~--~-~--~~~---~--~~
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: Dynamically created fields for a newform

2007-07-10 Thread Cole Tuininga

On 7/10/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> This includes some documentation of Select and SelectMultiple form
> fields. The other possible source of documentation is the model_forms
> model test, and the forms regression test, distributed in the test
> directory of the Django sources. This isn't really documentation, but
> it is working examples of pretty much every widget and field in
> action.

Ahhh - that will do quite nicely in lieu of documentation for the time
being.  Many thanks to you, and to the wonderful folks that have put
so much work into developing Django.

-- 
Cole Tuininga
http://www.tuininga.org/

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



Dynamically created fields for a newform

2007-07-10 Thread Cole Tuininga

Hey all - I'm a newforms newbie running 0.96.  I was just wondering if
there was a way to create fields for a newform dynamically.  Some of
the fields are coming from a database and hence, could change when the
form is created.

Also, is there any documentation on select boxes with newforms somewhere?

Thanks in advance folks...

-- 
Cole Tuininga
http://www.tuininga.org/

--~--~-~--~~~---~--~~
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: {% include %}'d files not interpolating {% block %}s?

2006-09-05 Thread Cole Tuininga

On 9/5/06, Katie Lohrenz <[EMAIL PROTECTED]> wrote:
> Is there a strong reason for putting the doc_head.tmpl code in a
> separate file? If you put that code directly into your base template,
> the title block would inherit the way you want.

Hmmm, I hadn't really thought about it.  I'd been so gung-ho to
separate out the "elements" into separate pieces, I just assumed
everything would work out.  :)

I could probably do this.

-- 
Cole Tuininga
http://www.tuininga.org/

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



Re: {% include %}'d files not interpolating {% block %}s?

2006-09-05 Thread Cole Tuininga

On 9/5/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
> I believe the {% include %} tag doesn't integrate with template
> inheritance as you're expecting it to.

Fair enough.  Is there a better way to accomplish this?  I'd much
prefer to have the title defined within the template rather than
having to pass it in as a variable from the view...

-- 
Cole Tuininga
http://www.tuininga.org/

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



{% include %}'d files not interpolating {% block %}s?

2006-09-04 Thread Cole Tuininga

Hi all -

I have a base template that looks like:

{% include "doc_head.tmpl" %}
{% include "header.tmpl" %}
{% include "menu.tmpl" %}
{% include "extra.tmpl" %}

{% block content %}
{{ section.header }}

{{ section.data }}
{% endblock %}

{% include "footer.tmpl" %}
{% include "doc_foot.tmpl" %}

and doc_head.tmpl looks like:

http://www.w3.org/TR/html4/strict.dtd";>


{% block title %}Section Title{% endblock %}






The idea being that my individaul page templates can simply {% inherit
"base.tmpl" %} and then simply do something like:

{% block title %}The title for the particular template{% endblock %}

However, when I render this, it turns out to *always* display with the
default content from doc_head.tmpl (ie "Section Title").  What am I
doing wrong here?

Thanks in advance.

-- 
Cole Tuininga
http://www.tuininga.org/

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



Admin looking for media/css/null?

2006-08-27 Thread Cole Tuininga

Hi folks - I'm setting up Django with mod_python and I've come across
a little problem.  When using the admin area, I get an error in my
apache logs.  Here's an example:

[Sun Aug 27 16:15:59 2006] [error] [client 127.0.0.1] File does not
exist: 
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/admin/media/css/null,
referer: http://localhost:8000/media/css/base.css

Relevant portions of my apache conf looks like this:

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE lll.settings
PythonDebug On

Alias /media 
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/admin/media

SetHandler None


What am I doing wrong?

-- 
Cole Tuininga
http://www.tuininga.org/

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



URLField limitations

2006-08-21 Thread Cole Tuininga

Hi folks - I'll preface this by saying that I'm a complete newbie,
writing my first Django app.

Partially for the experience, and partially driven by small need, I'm
implementing an inhouse version of tinyurl (http://www.tinyurl.com/).
The model is pretty simple - it looks like:

# Create your models here.
class ShortURL(models.Model):
tag = models.CharField(
maxlength = 10,
unique = True,
editable = False,
blank = False
)
url = models.URLField( unique = True )
created = models.DateTimeField( auto_now_add = True, editable = False )
ip_addy = models.IPAddressField( editable = False, blank = False )

I'm running into a couple problems.

1) The URLField type is being restricted to 200 characters.  Is there
a reason for this?  Can it be overridden?

2) The validator is enforcing that the URL must currently be active.
I want to use the check to make sure that the url is properly
formatted, but I don't want to enforce that the url must respond.  Is
there a way to get around this with the default validation?  Or will I
need to write my own validator that will check the syntax of the url?

Thanks in advance, and to the authors of and contributors to Django -
keep up the great work.  It's much appreciated.

-- 
Cole Tuininga
http://www.tuininga.org/

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



Re: manage.py runserver throws error message

2006-08-19 Thread Cole Tuininga

I finally figured out the problem.  In my case, I had decided to name
the project something besides "mysite"  in this case, I decided to
name it "site".  Naming it something different than "site" solved the
problem, so I'm making the assumption that I was causing some sort of
name collision?

-- 
Cole Tuininga
http://www.tuininga.org/

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



Re: manage.py runserver throws error message

2006-08-18 Thread Cole Tuininga

On 8/2/06, neuruss <[EMAIL PROTECTED]> wrote:
> > Is there anything you've forgotten to tell us? You really did just do
> > "django-admin.py startproject site", then "cd site", edit a couple of
> > lines inside settings.py and then "manage.py runserver"?
>
> No, I didn't edit any line.
> The tutorial doesn't say anything about editing lines (at least not at
> this stage...) :
> http://www.djangoproject.com/documentation/tutorial1/
>
> What am I supposed to do?

I'm running into the same problem - was there any resolution to this issue?

-- 
Cole Tuininga
http://www.tuininga.org/

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