Re: new : advise on installing Django, issues

2007-10-18 Thread Drasty

Since the Django folder is on your desktop, try typing

cd ~/Desktop/Django-0.96


On Oct 18, 4:19 pm, Paper Planes <[EMAIL PROTECTED]>
wrote:
> Hello Hugh + Others,
>
> Thanks for responding and for the answers!
>
> I ran it at the top unix shell level, not within Python. (I had tried
> both before posting.)
>
> Is the issue that I downloaded Django to my desktop and not through
> FTP using unix?
>
> I feel like my computer doesn't know where the files are and I don't
> know how
> let it know where they are because I don't know UNIX commands.
>
> For example, the change directory command results in:
>
> 232:~ NNN$ cd Django-0.96
> -bash: cd: Django-0.96: No such file or directory
>
> The file "Django-0.96" is just sitting on my desktop.
>
> Thanks!
> Paper
>
> As a result, the suggested commands in the installation guide are not
> working.
>
> 232:~ $ sudo python setup.py install
> Password:
> /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/
> Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such
> file or directory
> 232:~ Chaddus$
>
> On Oct 18, 1:32 pm, "Hugh Bien" <[EMAIL PROTECTED]> wrote:
>
> > I think you're trying to run the 'tar' program inside the Python shell.
> >  Instead, just run it in your command line without running Python.
>
> > You could also just find the Django-0.96.tar.gz file in Finder and double
> > click on it.
>
> > Django comes with its own server for development, so you don't need Apache
> > or mod_python.
>
> > On 10/18/07, Paper Planes <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I want to start learning a computer language and I'm starting with
> > > > Django.
>
> > > > But sadly, given the instructions on-line + my naivity, I can't figure
> > > > out how to install it.
>
> > > > I have a MacBook (v 10.4.10).
> > > > I downloaded the latest Python. Python 2.5 (r25:51918, Sep 19 2006,
> > > > 08:49:13)
>
> > > > This is a message I get when I try to Untar:
> > > > >>> tar xzvf Django-0.96.tar.gz
> > > >   File "", line 1
> > > > tar xzvf Django-0.96.tar.gz
> > > >^
> > > > SyntaxError: invalid syntax
>
> > > > I'm unsure if it is the syntax (I've tried others) or if the
> > > > downloaded Django-0.96 is in the right place. It's just on my desktop?
>
> > > > I know if I can't install it then there is something I'm extremely
> > > > naive about.
>
> > > > Another question, do I need to install Install Apache and mod_python?
> > > > The installation guide says I can skip it if I'm just playing around.
>
> > > > Thank you,
> > > > Paper


--~--~-~--~~~---~--~~
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: alter FreeComment date/time?

2007-09-07 Thread Drasty

Sweet! Thanks!

On Sep 7, 9:45 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 9/7/07, Drasty <[EMAIL PROTECTED]> wrote:
>
> > Unless there's some way to override this without actually tweaking the
> > source code?
>
> http://www.djangoproject.com/documentation/db-api/#raw-saves
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."


--~--~-~--~~~---~--~~
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: alter FreeComment date/time?

2007-09-07 Thread Drasty

Well. I should've just looked at the code before asking! submit_date
has auto_now_add=True. Looks like I'll be adding comments outside the
Admin!

Unless there's some way to override this without actually tweaking the
source code?

On Sep 7, 9:26 pm, Drasty <[EMAIL PROTECTED]> wrote:
> I'm in the process of "re-creating" a series of blog posts & comments
> in a new Django project. I can't seem to be able to adjust the "Date/
> time submitted" field in the Admin interface. Is this a bug, can't you
> do this, or is there a specific technique to use?


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



alter FreeComment date/time?

2007-09-07 Thread Drasty

I'm in the process of "re-creating" a series of blog posts & comments
in a new Django project. I can't seem to be able to adjust the "Date/
time submitted" field in the Admin interface. Is this a bug, can't you
do this, or is there a specific technique to use?


--~--~-~--~~~---~--~~
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: loaddata issue

2007-08-26 Thread Drasty

It seems like it was an issue with the transition from MySQL to
PostgreSQL; I had been using build 6001 (as I noted at the end, sorry
it wasn't very obvious), but I just ran svn update and was able to
loaddata, although the project will remain on MySQL.

On Aug 26, 9:16 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/26/07, Drasty <[EMAIL PROTECTED]> wrote:
>
>
>
> > Loading 'courses' fixtures...
> > Installing xml fixture 'courses' from '/../eeyore/courses/fixtures'.
> > Problem installing fixture '/../eeyore/courses/fixtures/courses.xml':
> >  node is missing the 'name' attribute
>
> This sounds like there is an attribute missing in the output XML. Can
> you provide an example model and data that causes this problem to
> occur?
>
> > I receive this error if I dumpdata as JSON and attempt loaddata:
>
> > Installing json fixture 'courses' from '/../eeyore/courses/fixtures'.
> > Problem installing fixture '/../eeyore/courses/fixtures/courses.json':
> > column "enable_comments" is of type boolean but expression is of type
> > integer
>
> This sounds like the data is not getting output correctly for a given
> field type. Again, can you provide sample data?
>
> On top of the sample data, can you also please provide the version of
> Django you are using (SVN revision or release number), and any other
> configuration details - in particular, the source and target database.
>
> Yours,
> Russ Magee %-)


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



loaddata issue

2007-08-25 Thread Drasty

I'm attempting to use the loaddata action to load an XML file
(generated using the dumpdata action on an MySQL db) to populate an
app in a project that is using PostgreSQL for its db. I receive the
following error:

Loading 'courses' fixtures...
Installing xml fixture 'courses' from '/../eeyore/courses/fixtures'.
Problem installing fixture '/../eeyore/courses/fixtures/courses.xml':
 node is missing the 'name' attribute

--

I receive this error if I dumpdata as JSON and attempt loaddata:

Installing json fixture 'courses' from '/../eeyore/courses/fixtures'.
Problem installing fixture '/../eeyore/courses/fixtures/courses.json':
column "enable_comments" is of type boolean but expression is of type
integer
LINE 1: ...TO
"courses_note" ("schedule_id","content","file","enable_co...
 ^
HINT:  You will need to rewrite or cast the expression.

--

Help! (I'm using svn trunk, build 6001.)


--~--~-~--~~~---~--~~
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: merge models for generic view

2007-08-23 Thread Drasty

I'll give it a shot.

One alternative I think could work for me is to use just one model for
each of the (current) models I'm trying to merge in the view, with a
bunch of fields that are flagged with "blank=True." This makes
ordering them in generic views very easy, but I don't like the
prospects of having a bunch of extra fields in my Admin form. (I'm
relatively agnostic to multiple empty fields in a db table, though.)

Would there be a way to take one model and have multiple ways to
display it in the Admin? (E.g., the model "Entry" might appear as if
it were these models: Entry, Thought, Link, Image?)

I'm leaning toward just using one model with a choice list for
filtering by "kind" of data in a table row, since handling that model
is within my current level of technical "expertise" (ha!).

Thanks for your help!

On Aug 23, 12:20 pm, Doug B <[EMAIL PROTECTED]> wrote:
> What I gave you should work, I have no idea about the error your
> getting.  Here is a complete example, maybe that will help.
>
> In [15]: ls1=cm.Listing.objects.all()[:2]
> In [16]: ls2=cm.Listing.objects.all()[10:13]
> In [17]: fs3=cm.Field.objects.all()[:2]
> In [18]: q=list(ls1) + list(ls2) + list(fs3)
> In [19]: sorted_list=sorted(q,key=operator.attrgetter('modified'))
> In [20]: sorted_list
> Out[20]:
> [,
>  ,
>  ,
>  ,
>  ,
>  ,
>  ]
>
> As for other options, it depends on what you are doing.  Generic
> relations aren't too bad, unless you want to filter on them.   I had
> some complex needs for an event calendar, and went with a wrapper
> class.  MyWrapper(list(ls1) + list(ls2) + list(fs3)).  The wrapper
> went through the objects and put them in the right slots and extracted
> the display information from a dummy class on each model (like having
> class Admin: in the model for admin) to pass to a template tag for
> rendering the event.


--~--~-~--~~~---~--~~
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: merge models for generic view

2007-08-23 Thread Drasty

I get an AttributeError: 'list' object has no attribute 'model'

Is there a way to circumvent this, or should I try to do something
involving a generic relationship for the models (i.e., a model with
almost nothing to it, to which all the other models have a generic
relationship)? Will that kind of thing work? (At this point, I can't
seem to wrap my head around generic relationships, which is why I
wanted to explore other options.

On Aug 22, 4:23 pm, Doug B <[EMAIL PROTECTED]> wrote:
> q = list(a) + list(b) + list(c)
> q.sort('-date')
>
> The problem you have here is the q.sort() method doesn't understand
> how to compare your objects. '-date' means nothing to it.I'm
> pretty sure you need to write your own comparison function and pass
> that to sort.  If you've got models with the same field name to sort
> by, you can use operator:
>
> import operator
> sorted_list=sorted(q,key=operator.attrgetter('modified'))
>
> If you've got to inspect the object and 'guess' the date sort field,
> or have different field names to use, I think the only way to do it is
> with your own comparison function.
>
> def cmp_date_field(x,y):
># do some model inspection to find attribute name to use for date
> comparison
>xdate=getattr(x,datefield_x,None)
>ydate=getattr(y,datefield_y,None)
>if xdate> ydate: return 1
>elif xdate==ydate: return 0
>else: return -1
>
> q.sort(cmp_date_field)


--~--~-~--~~~---~--~~
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: merge models for generic view

2007-08-23 Thread Drasty

Good to know! Since all the models have a DateTimeField "date"
operator should work. I'll let you know if it works.

On Aug 22, 4:23 pm, Doug B <[EMAIL PROTECTED]> wrote:
> q = list(a) + list(b) + list(c)
> q.sort('-date')
>
> The problem you have here is the q.sort() method doesn't understand
> how to compare your objects. '-date' means nothing to it.I'm
> pretty sure you need to write your own comparison function and pass
> that to sort.  If you've got models with the same field name to sort
> by, you can use operator:
>
> import operator
> sorted_list=sorted(q,key=operator.attrgetter('modified'))
>
> If you've got to inspect the object and 'guess' the date sort field,
> or have different field names to use, I think the only way to do it is
> with your own comparison function.
>
> def cmp_date_field(x,y):
># do some model inspection to find attribute name to use for date
> comparison
>xdate=getattr(x,datefield_x,None)
>ydate=getattr(y,datefield_y,None)
>if xdate> ydate: return 1
>elif xdate==ydate: return 0
>else: return -1
>
> q.sort(cmp_date_field)


--~--~-~--~~~---~--~~
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: merge models for generic view

2007-08-22 Thread Drasty

On Aug 22, 2:10 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> It's just an idea... you could cast to list and use extend.

For the list:
q = list(a) + list(b) + list(c)
q.sort('-date')


I'm unfamiliar, though with "extend." How do I use it?


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



merge models for generic view

2007-08-22 Thread Drasty

Is there a way to concatenate model querysets and use the
concatenation as the basis for a date-based generic view? Or, would I
be able to mimic the generic view code but alter it in such a way that
it handles the concatenation?

(Each of the models would have a DateTimeField called "date")

E.g. (I'm not very familiar with Python, so forgive me if the last
couple lines look "wrong"):

class ThingA(models.Model):
date = models.DateTimeField()
content = models.TextField()

class ThingB(models.Model):
date = models.DateTimefield()
link = models.URLField()

class ThingC(models.Model):
date = models.DateTimeField()
note = models.CharField(maxlength=250)

a = ThingA.objects.all()
b = ThingB.objects.all()
c = ThingC.objects.all()

q = a + b + c
q.sort('date')


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



Closed

2007-08-19 Thread Drasty

It was a typo. Everything works now. Sorry for the fuss!

On Aug 19, 12:07 pm, Drasty <[EMAIL PROTECTED]> wrote:
> I'm getting an escaped double quotation mark (", rendered as '%22') at
> the end of some stuff that I'm using to reference an anchor on the
> same page. This isn't a problem in templates, since the links and
> corresponding anchors are generated. But if I want to enter a link in,
> say, a TextField to one of those anchors, it becomes a bit tedious.
>
> I'm wondering if there's a way for me to get rid of that apparently
> automatically generated character.
>
> Here's an example, with the escaped character in the "Output" section:
>
> (Code:)
>
> class Thing(models.Model):
>  words = models.TextField()
>  note = models.IntegerField()
>
>  def note_anchor(self):
>   return self.note
>
> (Template:)
>
> Note {{ thing.note }}
> 
>  {{ thing.words }}
> 
>
> (Input:)
>
>  words = 'Blah blah.'
>  note = '1'
>
> (Output:)
>
> Note 1
> 
>  Blah blah.
> 


--~--~-~--~~~---~--~~
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: Question: trailing escaped character in a href=""?

2007-08-19 Thread Drasty

Sorry, I got confused about your input question re: the note integer.
(The confusion is from my accidental use of single quotes around the
input note value.)

I'm afraid I'm not using any buggy middleware, unless the stuff in
django.contrib is buggy.

I'll investigate to see if  will successfully point
to , though I have my doubts!

On Aug 19, 1:00 pm, olivier <[EMAIL PROTECTED]> wrote:
> > def note_anchor(self):
> >  return int(self.note)
>
> If it's already an integer, you don't need to do this,do you ?
>
> Otherwise, are you not using a buggy middleware that tries to
> refactors your html to make it valid XHTML ?
>
> If not, I'm afraid I don't have any clues...
>
> Olivier


--~--~-~--~~~---~--~~
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: Question: trailing escaped character in a href=""?

2007-08-19 Thread Drasty

No, I'm using MySQL. The same thing happens with a SlugField, so I'm
not sure if the string/integer difference matters here. To return
'note' as an integer, would I write:

def note_anchor(self):
 return int(self.note)

or something else?

On Aug 19, 12:21 pm, olivier <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On 19 août, 19:07, Drasty <[EMAIL PROTECTED]> wrote:
>
> > class Thing(models.Model):
> >  words = models.TextField()
> >  note = models.IntegerField()
>
> >  def note_anchor(self):
> >   return self.note
>
> > (Input:)
>
> >  words = 'Blah blah.'
> >  note = '1'
>
> In your example, you input `note` as a string, whereas `note` is an
> IntegerField.
>
> Is it a typo ?
> What database backend are you using ? Sqlite, I guess ?
>
> Olivier


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



Question: trailing escaped character in a href=""?

2007-08-19 Thread Drasty

I'm getting an escaped double quotation mark (", rendered as '%22') at
the end of some stuff that I'm using to reference an anchor on the
same page. This isn't a problem in templates, since the links and
corresponding anchors are generated. But if I want to enter a link in,
say, a TextField to one of those anchors, it becomes a bit tedious.

I'm wondering if there's a way for me to get rid of that apparently
automatically generated character.

Here's an example, with the escaped character in the "Output" section:

(Code:)

class Thing(models.Model):
 words = models.TextField()
 note = models.IntegerField()

 def note_anchor(self):
  return self.note


(Template:)

Note {{ thing.note }}

 {{ thing.words }}



(Input:)

 words = 'Blah blah.'
 note = '1'


(Output:)

Note 1

 Blah blah.



--~--~-~--~~~---~--~~
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: object doesn't have get_absolute_url() methods

2007-08-15 Thread Drasty

Which actually works. Oh, you Django with your various appropriate
ways to call things!


--~--~-~--~~~---~--~~
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: object doesn't have get_absolute_url() methods

2007-08-15 Thread Drasty

Aha! It has to do with #2.

I get an AttributeError that leads me to think I'm asking the wrong
question. So:

Is there a way to call a field from a related ForeignKey for one of
the attributes of get_absolute_url()?

That is:

class Thing(models.Model):
 slug = models.SlugField()

class OtherThing(models.Model):
 thing = models.ForeignKey(Thing)
 slug = models.SlugField()

 def get_absolute_url(self):
  return '/%s/%s/' % (self.thing.slug, self.slug)


On Aug 15, 2:42 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> I don't see anything wrong with what you have there. Try these:
>
> 1. Make sure the get_absolute_url method uses correct indentation (tab
> vs. 4 spaces) consistent with the rest of your models.py
>
> 2. Drop into a shell with "python manage.py shell" and get an instance
> of your model object. Then issue a direct obj.get_absolute_url() call
> on it to see why it might be failing.


--~--~-~--~~~---~--~~
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: object doesn't have get_absolute_url() methods

2007-08-15 Thread Drasty

On Aug 15, 1:26 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> What error does it throw?

Page not found (404)
 Request Method: GET
  Request URL: http://127.0.0.1:8000/admin/r/7/1/

thing objects don't have get_absolute_url() methods

--

I should note that I don't receive an error when I attempt to reach
the URL outside the admin; but my templates don't give me an object's
absolute URL, even when I call them in the template. All other
requests to the object (e.g. {{ object.title }}) appear on the page,
but {{ object.get_absolute_url }} comes up blank.


--~--~-~--~~~---~--~~
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: object doesn't have get_absolute_url() methods

2007-08-15 Thread Drasty

Additional information: I'm using the *latest* SVN version, checked
out less than 2 minutes ago. In addition, I converted all of the
varables in get_absolute_url() to the SlugField model, in an attempt
to overcome any potential unicode hiccups. I still have the same
problem--get_absolute_url() remains empty for the model. Help!


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



object doesn't have get_absolute_url() methods

2007-08-15 Thread Drasty

I have a get_absolute_url() method on the object, but it doesn't
appear in the template, and the admin throws the error in the subject
line if I try to follow the "view on site" link.

Here's a sample model:

class Thing(models.Model):
 subject = models.CharField(maxlength=10)
 slug = models.SlugField(unique=True)

 def get_absolute_url(self):
  return '/thing/%s/%s/' % (self.subject, self.slug)

The "view on site" link points to '/admin/r/1/7/' (not the abs url!),
and my anchor tag is empty (a href=""), even thought I
reference {{ object.get_absolute_url }} as the link. Help!


--~--~-~--~~~---~--~~
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: 404 for date-based generic views--Help!

2007-08-02 Thread Drasty

I should also note that adding
 allow_future=True
results in the same 404 error. (I'm also testing with data with dates
in 2006, so "TIME_ZONE" in settings.py shouldn't be a contributing
factor, even though I'm using the "correct" designation for where I
am.)

On Aug 2, 11:42 am, Mackenzie Kearl <[EMAIL PROTECTED]>
wrote:
> You should put some template code up as well i know that I recently
> could not see posts that existed because
> allow_future: defaults to 
> Falsehttp://www.djangoproject.com/documentation/generic_views/#django-view...


--~--~-~--~~~---~--~~
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: 404 for date-based generic views--Help!

2007-08-02 Thread Drasty

On Aug 2, 11:42 am, Mackenzie Kearl <[EMAIL PROTECTED]>
wrote:
> You should put some template code up as well

Here you go (there are no variables in "zora.html"):

{% extends "zora.html" %}

{% block title %}Pictures of Zora (from {{ day|date:"N d, Y" }}){%
endblock title %}

{% block bodystyle %}{% endblock bodystyle %}

{% block content %}
Pictures from {{ day|date:"F j, Y" }}

{% for object in object_list %}
{{ object.title }}
taken at {{ object.time|date:"P" }}
{% endfor %}

{% endblock content %}


--~--~-~--~~~---~--~~
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: 404 for date-based generic views--Help!

2007-08-02 Thread Drasty

I figured out the year archive issue (it doesn't use the object_list,
argh!) but still get 404s for the day and detail generic views.


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



404 for date-based generic views--Help!

2007-08-02 Thread Drasty

I'm getting 404 errors on day and detail views for date-based generic
views. In addition, the year archive doesn't show any entries, but the
month view does!

Here's my urlconf--is there something I'm missing? (I'm using Python
2.4.4, MySQL, & the dev server on localhost.)


from django.conf.urls.defaults import *
from datetime import datetime, date
from commonplace.family.models import ZoraPic


def latest_pics():
return ZoraPic.public_objects.all()[:3]

def year_list():
return ZoraPic.public_objects.dates('time', 'year').order_by('time')


zora_latest_dict = {
'extra_context': {
'latest_pics': latest_pics,
'year_list': year_list
}
}
zora_dict = {
'queryset': ZoraPic.objects.all(),
'date_field': 'time',
'extra_context': {
'year_list': year_list
}
}


urlpatterns = patterns('django.views.generic',
(r'^(?P\d{4})/(?P\d{2})/(P?\d{2})/(?P[-\w]+)/
$', 'date_based.object_detail', dict(zora_dict, slug_field='slug',
month_format='%m', template_name='zora/detail.html')),
(r'^(?P\d{4})/(?P\d{2})/(P?\d{2})/$',
'date_based.archive_day', dict(zora_dict, month_format='%m',
template_name='zora/day.html')),
(r'^(?P\d{4})/(?P\d{2})/$', 'date_based.archive_month',
dict(zora_dict, month_format='%m', template_name='zora/month.html')),
(r'^(?P\d{4})/$', 'date_based.archive_year', dict(zora_dict,
template_name='zora/year.html')),
(r'^$', 'simple.direct_to_template', dict(zora_latest_dict,
template='zora.html')),
)


--~--~-~--~~~---~--~~
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: Object list generic view + list

2007-07-11 Thread Drasty

Have you tried using the http://www.djangoproject.com/
documentation/db-api/#order-by-fields">order_by method on your
queries?

Even though it may get cumbersome, you could also add something along
these lines to your url.py file for each specific query you might want
to call:

def some_list():
 return Model.objects.all().order_by('some_field')


--~--~-~--~~~---~--~~
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: contextual ForeignKey?

2007-04-25 Thread Drasty

Thanks for the suggestion. Even if it doesn't work--I haven't really
looked at Generic Relations before--it'll be fun figuring out how to
play with them. I'll put something up if I figure out anything useful,
either here or at djangosnippets.org

Erik

On Apr 25, 7:01 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 4/25/07, Erik Vorhes <[EMAIL PROTECTED]> wrote:
>
>
>
> > Since I'm only reviewing one thing in each Review, it'd be possible to
> > change ForeignKey to OneToOneField, but (aside from likely changes to
> > the way Django handles one-to-one relationships), that doesn't change
> > my predicament.
>
> > I'd appreciate any help you can offer!
>
> You might want to have a look at GenericRelations. This feature allows
> you to have a single relation that can refer to any other model class.
>
> http://www.djangoproject.com/documentation/models/generic_relations/
>
> They aren't fully documented, and they are not completely integrated
> into the admin view, but they can be extremely useful in situations
> such as yours.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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: Django database referential problem

2007-04-25 Thread Drasty

Depending on how you want to limit versions in your projects, you
could do something with the "limit_choices_to" argument in your
ForeignKey.


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