django-users@googlegroups.com

2008-12-05 Thread PFL

How can I get Django templates to generate links to anchors that are
*local* to the document?
In a static HTML page, I have a table of contents with links to
internal sections within the same page:

Section1
Section2

These link to sections that  that look like this:

 111 
 222 


Converting the above into a template I have:
  {% for row in content.rows %}
   {{ row.label }}


butwhen the template loads it creates output that looks like:

http://localhost:8000/doc/#1";>

That URL above now gets processed by URL conf...

I have tried various things but I cannot get the Django temlplate to
generate simply:
 so that it will navigate to a  section down the page

thanks in advance for any advice.

-Peter


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

2008-12-05 Thread PFL

The source generated by the templates is indeed correct; it looks
like:

Section1

However,  when I click on the link, Django(?) tries to resolve it as:

http://localhost:8000/doc/#1  -- not --- http://localhost:8000/doc#1

So -- how do I get local links working with Django?



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

2008-12-05 Thread PFL


Thanks for your replies --I am still stuck here.

>Have a look in the output from the development server - I very much doubt that 
>the click results in any request being sent.

A request is definitely sent for each of these cases: "/doc/", "/
doc#", "/doc#1/".  I can see each of these generating a hit on the
local dev server standard out.

I think this is a URL mapping mapping .

My url.py is:

(r'^doc/', 'doc.views.get_sections'),

Using the above, all of the following URLS map to the same
'doc.views.get_sections' view:
  http://localhost:8000/doc/
  http://localhost:8000/doc#1
  http://localhost:8000/doc#1/

I am not sure what I need to do to either my url mappings or in my
view to handle the  "#" ?
What is the way to get local links working?


On Dec 5, 11:02 am, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Dec 5, 6:04 pm, PFL <[EMAIL PROTECTED]> wrote:
>
> > The source generated by the templates is indeed correct; it looks
> > like:
>
> > Section1
>
> > However,  when I click on the link, Django(?) tries to resolve it as:
>
> >http://localhost:8000/doc/#1 -- not ---http://localhost:8000/doc#1
>
> > So -- how do I get local links working with Django?
>
> Django isn't doing anything. Have a look in the output from the
> development server - I very much doubt that the click results in any
> request being sent.
>
> The address of the page is indeed /doc/, not /doc, so it's correct
> that the local anchor would be /doc/#1.
> -
> DR.
--~--~-~--~~~---~--~~
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:

2008-12-05 Thread PFL

Rajesh -- THANK YOU  very much!  you are correct.

My issue was not on the  side -- it was on the target side -- i had
a typo that was messing up the text of the id="".
Once that was fixed, it worked exactly as you said it should; this was
a PIBKAC issue.

I did however learn something: I was not aware of the distinction
between browser/server functionality in resolving local links...of
course it seem obvious to me now.


On Dec 5, 11:58 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Dec 5, 2:41 pm, PFL <[EMAIL PROTECTED]> wrote:
>
> > Thanks for your replies --I am still stuck here.
>
> > >Have a look in the output from the development server - I very much doubt 
> > >that the click results in any request being sent.
>
> > A request is definitely sent for each of these cases: "/doc/", "/
> > doc#", "/doc#1/".  I can see each of these generating a hit on the
> > local dev server standard out.
>
> But you omitted the one that your template is actually resulting in:
>
> /doc/#1
>
> Incidentally, they will all generate a hit if you punch them into your
> browser's URL bar. The # anchor implementation is a browser feature
> not a web server feature. So, the way to test whether a new link is
> being generated is to use your browser like this:
>
> First point your browser to /doc/ to get Django to serve your request.
> Now, click on the anchor link in your browser. You should not see a
> new web server request resulting from that click. Your browser should
> simply pan you down to where you have the element with id=1.
--~--~-~--~~~---~--~~
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: From ASP to Django

2008-06-19 Thread PFL

I had to make a similar argument at my job.  You are going to have to
convince
people who are rightly skeptical, wont appreciate the all the core
technological arguments,
and really only care about time and cost.

So, make a business case, not a technical case. Focus on:

1) tangible business benefits
2) reduce risk

On the benefits side,  I'd take your "speed of development" argument
and
think of specific features that you could add to help their business:
- better user experience, better data collection and analysis, etc
- can you factor out some licensed software costs (SQLServer, etc)
- does the current site support foreign language -- will  they need
that?
- what about hosting? In general I think you could make the case that
hosting
  Django and an opensource platform is easier than ASP

On the risk side, you need to convince them that your 2-week estimate
is valid;
you should provide them with some supporting material that breaks down
the
2 weeks into specific tasks so that they will have more confidence in
it.

They also are probably skeptical about Django's traction. I'd visit
Django Sites (http://www.djangosites.org/) and get a list of retailers
that
use Django to show them they would not be the first to do so.

Also, go to a big job board (HotJobs, Craigslist, etc) and do a search
in your location
jobs listing "Django".  That really helped at my job when my VP saw
how many job listings
were posted because he felt like it was an active market and that he
would be able
to find Django experience in the future.

good luck

On Jun 19, 6:02 am, gnijholt <[EMAIL PROTECTED]> wrote:
> Ok I need some thoughts on the following. For a client, we need to
> redesign their website. The back-end was coded a couple of years ago
> in classic ASP. It's fairly complex, with a webshop, uploading and
> parsing of excel files with new collections of clothing, and stuff
> like that. It took people about six months to build it back then.
>
> Personally, I think now is the moment to also revamp the back-end, but
> I'm having trouble to explain the reasons to non-tech people (bosses
> and the client). I reckon I could build most of the back-end within a
> week or two in Django. The problem is that neither the client nor the
> boss care about the technology, as long as it works. They will not pay
> for an upgrade of the back-end to newer technology, unless I can back
> up this decision with valid points. So why should they switch to
> something like Django? I can come up with technological points, such
> as maintainability (less LoC), speed of development in the future...
>
> Thanks

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



django naming conventions ?

2008-06-25 Thread PFL

After reviewing the code i have written for a non-trivial but still
modest Django app, I realized that my names for Django objects
followed no standard (case, plural, underscores, etc)  - I discovered
this when I wasted at least 30 minutes trying to figure out an error
that was caused by a wrong case name for class in my model (ok, it was
late, I was tired).

I have done some searching but could not find a set of standard naming
conventions that is recommended for Django objects:

- project name
- application name
- class names in models.py
- template names
- names of keys in my results object of render_to_response
- form names in forms.py

does anyone know of one they might point out?

thanks,
Peter Liske

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



Embedding template tags inside of Flatpages content?

2008-06-30 Thread PFL

Is there any way to type template tags into the admin form field for
Flatpages content and have them interpreted as template tags (instead
of text to display) ?

IF this is possible, then the next question would be to define some
python dictionaries inside the flatpage contentthis is all to
enable some very quick mock-ups...

thanks,

-Peter
--~--~-~--~~~---~--~~
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: Class-based views or "Traditional" Views for Django 1.3?

2011-09-14 Thread PFL

Reinout van Rees has posted several articles on using Django class
based views that you might find useful  (posted Aug 23/24 2011 ):

http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-walkthrough.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: removing the source of a OneToOneField relationship

2011-05-05 Thread PFL
Seth,

see:  
http://docs.djangoproject.com/en/1.3/ref/models/instances/#deleting-objects

"Issues a SQL DELETE for the object. This only deletes the object in
the database; the Python instance will still be around, and will still
have data in its fields."

I think you will have to re-query your target object after you delete
a source object.


The delete()
On May 3, 2:05 pm, Seth Gordon  wrote:
> I have one Django model that points to another one with a OneToOneField,
> sort of like this:
>
> class Target(models.model):
>     # stuff
>
> class Source(models.Model):
>     target = models.OneToOneField(Target)
>
> Sometimes, given an object that is an instance of Target, I want to
> navigate to its Source and delete that:
>
> try:
>     some_target.source.delete()
> except ObjectDoesNotExist:
>     ## nothing to delete!
>     pass
>
> But this doesn't work: some_target.source will still exist after the
> delete() operation has been performed.  If I try "some_target.source =
> None", I get an exception, complaining that Target.source does not allow
> null values.  Calling save() and clean_fields() at strategic moments
> doesn't seem to work, either.
>
> What does seem to work is reloading the Target object:
>
> try:
>     some_target.source.delete()
>     some_target = Target.objects.get(pk=some_target.id)
> except Source.DoesNotExist:
>     ## nothing to delete!
>     pass
>
> Is this a bug in Django, or am I misunderstanding how related or cached
> objects are supposed to work?
>
> This is Django 1.2.3, Python 2.6.5, PostgreSQL 8.4.7, all running on
> Ubuntu Linux 10.04.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.