Re: Best way to upload and resize image?

2013-01-13 Thread Nikolas Stevenson-Molnar
This page refers to some pre-built solutions for thumbnails: 
https://code.djangoproject.com/wiki/ThumbNails

And yes, PyCharm is wonderful :)

_Nik

On Jan 13, 2013, at 7:38 PM, frocco  wrote:

> Hi All,
> In the admin, I am using imageField to upload an image.
> I install PIL and am overriding the save to create a thumbnail.
> The problem I am having is the original upload is resized.
> I want to keep the original and thumbnail, so I can allow the users to click 
> and zoom the image.
> 
> Is there a better way to do this in django?
> I thought about adding another imagefield and just resize that one.
> But the user would have to select the same image file twice.
> 
> On another note, I just purchased PyCharm and am finding it pretty nice.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/juMogcAZUdUJ.
> 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.

-- 
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: send_mail reply to (how to?)

2013-01-13 Thread ANKIT BAGARIA
as far as i remember by going through documentation od django on sending
mail send_mail() does not have any parameter called headers.

On 14 January 2013 01:53, Bobby Roberts  wrote:

> i'm trying to set the reply-to as shown here but it's erroring out:
>
> textmessage =
> render_to_string('communications/email/text/contact.html', mydict)
> from_email=request.POST.get('Email','')
> to_email=['whate...@gmail.com']
> subject = 'mysite  Inquiry'
> iheaders =
> {'reply-to':request.POST.get('Email','')}
>
> send_mail(subject,textmessage,from_email,to_email, headers=iheaders)
>
>
> Traceback:
>
> send_mail() got an unexpected keyword argument 'headers'
>
>
>
> What am i doing wrong here?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/COfDjQrhzgEJ.
> 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.
>



-- 
ANKIT BAGARIA

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



Best way to upload and resize image?

2013-01-13 Thread frocco
Hi All,
In the admin, I am using imageField to upload an image.
I install PIL and am overriding the save to create a thumbnail.
The problem I am having is the original upload is resized.
I want to keep the original and thumbnail, so I can allow the users to 
click and zoom the image.

Is there a better way to do this in django?
I thought about adding another imagefield and just resize that one.
But the user would have to select the same image file twice.

On another note, I just purchased PyCharm and am finding it pretty nice.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/juMogcAZUdUJ.
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: How do I display a static image in my index.html file?

2013-01-13 Thread frocco
I see...

Thanks for the explanation.

--Frank

On Friday, January 11, 2013 3:20:40 PM UTC-5, frocco wrote:
>
> Hello,
>
> I am a newbie and cannot figure out how to do a simple image display that 
> I currently do in PHP.
> I want to display a logo on my home page.
>
> I tried google, but am having no luck.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GbOS1X9-E5gJ.
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.



Django/Python vs Grails/Groovy

2013-01-13 Thread tapan pandita
Hey Guys,

We have an initial version of our product ready on Grails. However, before 
we move forward, we want to make a call between using Django or Grails. The 
product is basically an API and some templating. The team comprises of 
people who are comfortable with both frameworks and can easily make the 
switch from one to the other. Based on the research I've done online, I 
feel both frameworks are essentially the same. Groovy is just about as easy 
to develop in as python and ecosystem-wise Java doesn't have any advantage 
over Python (at least as far as the web is concerned). Also, Grails can do 
pretty much everything that Django can do (including schema migrations now 
which people seem to complain about earlier). Personally, I am a django guy 
and haven't developed a lot in Grails (just basic stuff). What would be 
some compelling arguments to switch to Django over grails or should we 
stick with grails?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/PotHWMxugf4J.
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.



Field pre-load hook?

2013-01-13 Thread Matt Barry
Hi,

I'm creating a model from an external database that has some encrypted 
columns.  Initially I was thinking of creating a custom field type:

class EncryptedField(models.Field):
  def db_type(self, connection): 
return 'TEXT'
  def pre_save(self, model, add):
return encrypt(getattr(model, self.attname))

..but it doesn't seem there are any hooks to decrypt the data on the 
loading side.  Am I missing anything, or is there a better way to do this 
sort of thing?

Thanks,
Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LYnZIyIzbfYJ.
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.



how to use media, images not showing

2013-01-13 Thread frocco
Hello,

In my model, I have
image_path = models.FileField(max_length=128, upload_to='staff')

in index.html I have 


In settings I have
DIR = os.path.abspath(os.path.dirname(__name__))
MEDIA_ROOT = os.path.join(DIR,'media')
MEDIA_URL = 'http://127.0.0.1/media/'

media_url prints out as http://127.0.0.1/media/

store
   media
  staff
  inage1.jpg...

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/cjexEuGa4jkJ.
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.



"Principle of least privilege" in accessing a DB from an app

2013-01-13 Thread Isaac Perez
Hi guys,

I'm creating a new app and I'd like to know how would be the best way to 
implement the principle of least privilege.
At the moment the DB has 5 users:

   - 1 is the root user for the DB (which I don't want it to be used by the 
   webapp)
   - 1 has read access to the data fields
   - 1 has write access to the data fields
   - 1 has read access to the users table
   - 1  has write access to the users table

What I intend to achieve is that if in any occasion we've got a sql 
injection for whatever the reason, the access to the DB from the app form 
will be as limited as possible.

If using python directly I would create a DB connection for each 
functionality so they use the right DB user and have the right permissions.

In Django, though, as you have to configure the default DB access in the 
settings and it has to sync, etc... I'm not sure what will be the best way 
to implement that splitting of privileges.

I've configured the 5 connections in the settings but not sure how to best 
use them for the different functions of authenticate, read and write from 
the DB.

Any ideas?


Thanks,
Isaac

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JHYEv19RHOYJ.
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: How do I display a static image in my index.html file?

2013-01-13 Thread Mike Dewhirst

On 14/01/2013 2:18am, frocco wrote:

I finally got this working.

Why is it necessary to run collectstatic?
in PHP, I would just point to the images.


Consider that you might have a number of apps in your project. As an 
experienced Django dev you would probably keep your separate apps nicely 
segregated so they can be re-used in multiple projects without any 
integration overhead. That means the static files for such apps really 
must stay with the apps - or management and deployment gets too hard.


So your project has a few apps and each has its own static files. When 
you deploy all you need to do is add the app static dir to the 
settings.STATICFILES_DIRS list and run collectstatic.


Apache or whatever webserver you use only needs a simple directive to 
serve them from STATIC_ROOT.


It is very nice.



Thanks for your help, I am really enjoying django.

On Saturday, January 12, 2013 5:41:12 PM UTC-5, @jeffblack360 wrote:

Directory structure please?

FWIW, you have django.contrib.staticfiles defined twice.

Did you read the howto doc on static files?

@jeffblack360

On Jan 12, 2013, at 2:17 PM, frocco 
wrote:




  Page not found (404)

Request Method: GET
Request URL:http://127.0.0.1:8000/static/img/auto.jpg


Using the URLconf defined in |ntw.urls|, Django tried these
URL patterns, in this order:

 1. ^staff/$
 2. ^static/img/$
 3. ^static/$
 4. ^admin/doc/
 5. ^admin/

The current URL, |static/img/auto.jpg|, didn't match any of these.

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/3Qt8rkRKSrcJ
.
To post to this group, send email to django...@googlegroups.com
.
To unsubscribe from this group, send email to
django-users...@googlegroups.com .
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
.


--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/3UmqFDipFRQJ.
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.


--
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: How do I display a static image in my index.html file?

2013-01-13 Thread frocco
I finally got this working.

Why is it necessary to run collectstatic?
in PHP, I would just point to the images.

Thanks for your help, I am really enjoying django.

On Saturday, January 12, 2013 5:41:12 PM UTC-5, @jeffblack360 wrote:
>
> Directory structure please?
>
> FWIW, you have django.contrib.staticfiles defined twice.
>
> Did you read the howto doc on static files?
>
> @jeffblack360
>
> On Jan 12, 2013, at 2:17 PM, frocco  
> wrote:
>
>
>> Page not found (404)Request Method:GETRequest URL:
>> http://127.0.0.1:8000/static/img/auto.jpg
>>
>> Using the URLconf defined in ntw.urls, Django tried these URL patterns, 
>> in this order:
>>
>>1. ^staff/$
>>2. ^static/img/$
>>3. ^static/$
>>4. ^admin/doc/
>>5. ^admin/
>>
>> The current URL, static/img/auto.jpg, didn't match any of these.
>>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/3Qt8rkRKSrcJ.
> To post to this group, send email to django...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> django-users...@googlegroups.com .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3UmqFDipFRQJ.
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: How do I display a static image in my index.html file?

2013-01-13 Thread frocco
ntw
   staff
views.py
   templates
staff
   index.html
static
   img
  image1.jpg

I did read the docs, but am having a hard time understanding how to do this.
Sorry.

Thank you
On Saturday, January 12, 2013 5:41:12 PM UTC-5, @jeffblack360 wrote:
>
> Directory structure please?
>
> FWIW, you have django.contrib.staticfiles defined twice.
>
> Did you read the howto doc on static files?
>
> @jeffblack360
>
> On Jan 12, 2013, at 2:17 PM, frocco  
> wrote:
>
>
>> Page not found (404)Request Method:GETRequest URL:
>> http://127.0.0.1:8000/static/img/auto.jpg
>>
>> Using the URLconf defined in ntw.urls, Django tried these URL patterns, 
>> in this order:
>>
>>1. ^staff/$
>>2. ^static/img/$
>>3. ^static/$
>>4. ^admin/doc/
>>5. ^admin/
>>
>> The current URL, static/img/auto.jpg, didn't match any of these.
>>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/3Qt8rkRKSrcJ.
> To post to this group, send email to django...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> django-users...@googlegroups.com .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/mhpX9fs6sPQJ.
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: Status of open sourced Django Book?

2013-01-13 Thread Russell Keith-Magee
On Mon, Jan 14, 2013 at 1:13 AM, Skip Montanaro wrote:

> I was encouraged to see that the Django Book authors had open-sourced the
> book.  I cloned the git repo and built it.  I've been working my way
> through the online book and thought the open source content might have some
> updates, but after comparing a couple chapters (intro and Chapter 11), it
> seems that perhaps nothing has been updated.
>
> Did I just make too small a comparison?  Are the various versions' release
> notes the only places to find summaries of what's changed since the book
> was written (for 1.1)?
>

Essentially, yes. To the best of my knowledge, there haven't been any major
changes to the Django Book since it was originally published. One of the
reasons for releasing the book as open source was to allow (and encourage)
the community to submit updates. I'm pretty certain that there weren't that
many updates prior to the book source being put on GitHub, so the Github
commit history will show you all the changes that have been made.

If you do go through the release notes for 1.1,  1.2, 1.3 and 1.4, you
shouldn't find *that* many backwards incompatibilities. Off the top of my
head, I can only think of a few items that would make a significant
difference to the content of the Django book:

 * Import syntax at the top of urls.py
 * Quoting syntax in {% url %} tags
 * The method of installing admin urls
 * Allowing for CSRF in forms

There have been other backwards incompatibilities, but they tend to be
fairly esoteric edge cases; there have also been lots of additional
features, which means the current content of the Django book may not
reflect best practice (e.g., the syntax of {% if %} clauses in templates).
However, as a project, we've been strict about backwards compatibility, so
there shouldn't be much that doesn't work *at all*.

That said, we would certainly welcome any contributions to help get the
Django Book up to date, reflecting current best practice, and ironing out
the incompatibilities that have emerged over time.

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



Re: How do I call a query set from views.py

2013-01-13 Thread frocco
Thank you...

On Sunday, January 13, 2013 1:29:15 PM UTC-5, frocco wrote:
>
>
> in models.py
>
> def get_categories(self):
> return self.objects.filter('category_class <> "sales'
>
> in views.py
>
> data = Category.get_categories()
>  context = Context({'title': 'Search', 'form': form, 'data': data})
> return render_to_response('index.html', context)
> this is not working.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/kNRjIyffZQwJ.
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: Project Structure - Lots of scattered custom views

2013-01-13 Thread Sanjay Bhangar
On Sat, Jan 12, 2013 at 12:04 AM, chad petzoldt  wrote:
> Sanjay, you were hitting things pretty close. I think that making sure slug
> names match up to real *static* locations is the key. I am hosting with
> Apache, and I thought about using some configurations to cheat a little bit,
> and get some of the static-files burden off of Django and let Apache resolve
> any requests that point to actual files on disk (with some security in
> mind).
>
> What about a view that can determine if it should be pointing at a file on
> disk, and if so, do a custom Http_Response, and read the actually binary
> contents from disk by hand. Im just curious on this one; it could be an
> alternative means of file storage and recognition. I understand this may
> have some performance implications, but this is not going to break Django,
> correct? Is this bad Django etiquette?
>

Yea, hooking up slug-name to folder-name is brittle - if you're just
reading the binary contents of files and serving them, you could do it
in a django view, but you're probably better off doing it directly
through apache - there's no reason to use Django for something its not
good as :) - I think this really depends on how much these 'static'
html pages you're serving need other components of your django app -
if they're completely separate, then they're probably better off being
served simply as static files through apache :)

What I have done in the past is read template files off disk through
some name in the URL .. so like http://foo.com/home looks into a
directory, looks for home.html, and renders the template .. if you do
need to nest these static html files of yours into a django template
that has some other logic, I think this is a perfectly fine logic to
use and has worked well for me .. if you just need to serve the binary
files off disk though, you're probably better off just using apache to
serve them ...

Hope that makes sense / helps ..
-Sanjay


> Amirouche, a different way to describe what I am trying to achieve might be
> this: I would like to bypass the admin as much as possible when it comes to
> these "Articles". But when rendered, all of these articles do need at least
> a small HTML wrapper, and probably some kind of of global template that
> helps with navigation. If I could handle navigation without the admin, i
> would be very excited, but it does seem that I will need to use the admin
> for at least this purpose. The navigation would probably help render
> hierarchical  "menus" for use as templates within the Articles. I would like
> to keep this navigation as light as possible.
>
> Thanks for the feedback.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/ja-o_pBFAT4J.
>
> 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.

-- 
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: Generating HTML code

2013-01-13 Thread Arnold Krille
On Sat, 12 Jan 2013 05:43:40 -0800 (PST) Matteo Suppo
 wrote:
> I use http://foundation.zurb.com/ or
> http://twitter.github.com/bootstrap/
> 
> They don't generate html but they help build pages faster.

And then there are jetstrap.com and boottheme.com which help creating
your bootstrap theme and page. And give you html and bootstrap.css or
variables.less to integrate into your project.

Have fun,

Arnold


signature.asc
Description: PGP signature


Re: Project Structure - Lots of scattered custom views

2013-01-13 Thread Lachlan Musicman
It had occurred to me that Django wasn't the right tool for this job -
not everything is a nail :)

cheers
L.

On Sun, Jan 13, 2013 at 10:21 PM, Amirouche
 wrote:
> I don't see where Django makes things easier for you at all. Why no just use
> static files and include a menu via Javascript and serve all the thing like
> static files instead of using Django ?
>



--
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

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



send_mail reply to (how to?)

2013-01-13 Thread Bobby Roberts
i'm trying to set the reply-to as shown here but it's erroring out:

textmessage = 
render_to_string('communications/email/text/contact.html', mydict)
from_email=request.POST.get('Email','')
to_email=['whate...@gmail.com']
subject = 'mysite  Inquiry'
iheaders = 
{'reply-to':request.POST.get('Email','')}

send_mail(subject,textmessage,from_email,to_email, headers=iheaders)


Traceback:  

send_mail() got an unexpected keyword argument 'headers'



What am i doing wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/COfDjQrhzgEJ.
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: HTML Source on Browser Rendering

2013-01-13 Thread Peter of the Norse
You're looking at the wrong thing. The  tags were added by your browser. 
Chrome and Firefox show cleaned up HTML in firebug/web inspector. In the case 
of a bad MIME type, it treats it as text, and wraps everything in HTML for 
displaying. When people say to check the Content-Type header, you should look 
in the network tab.

On Jan 9, 2013, at 1:57 AM, Ryoichiro Kamiya wrote:

> It's been resolved. The following mimetype property in views.py added the 
>  tags.
> 
> return render_to_response('prayer/service_index.html', datadict, 
> mimetype="application/json; charset=utf-8")
> 
> Thanks,
> Ryo
> 
> On Wednesday, January 9, 2013 11:07:14 AM UTC+9, Ryoichiro Kamiya wrote:
> Thanks all for seeing this thread.
> 
> With further experiment, the result shows the HTML source with  tag even 
> after emptying the contents of the Django template file. When I tested it in 
> various browsers, the browser automatically added basic HTML structure with 
>  tag on top of my contents. I compared the line endings and encoding 
> with another page that working correctly, but couldn't find any difference.
> 
> I'll mark this as closed as it seemed not an issue resulting from Django.
> Everyone, thanks for replying to my question. Have a nice day!
> 
> Regards,
> Ryo
> 
> On Tuesday, January 8, 2013 2:31:16 PM UTC+9, djangobie wrote:
> Than  is the issues, as it 'll display the content (inside it) as it is 
> .. making it preformated.
> can't guess how you got your code wrapped in it in the first place.
> 
> Thanks
> 
> On Tuesday, January 8, 2013 6:29:53 AM UTC+5, Ryoichiro Kamiya wrote:
> Thanks jjmutumi, stauros!
> 
> I am not using "autoescape" tag in my template. Thanks.
> 
> I am just checking the source on the back of HTML source displayed with 
> Firebug as jmutumi suggested.
> It seemed an auto-inserted  tag before & after the source. (Please find 
> the attached. thanks)
> 
> Any ideas how this can be added?
> 
> Ryo
> 
> On Monday, January 7, 2013 5:22:30 AM UTC+9, stauros wrote:
> Hello,
> maybe any "autoescape"  template tags on the wrong spot?
> 
> 
> On Sun, Jan 6, 2013 at 9:46 PM, Joseph Mutumi  wrote:
> Hello,
> 
> I think you should also check the 'Content-Type' being received client-side
> in the HTTP headers. You can use something curl or Firebug.
> 
> 
> On Sun, Jan 6, 2013 at 1:40 PM, Ryoichiro Kamiya  
> wrote:
> Hi,
> 
> I'm testing Django template rendering in development environment, but one of 
> the page shows HTML source (after all Django tag executed) instead of HTML.
> 
> 1. Content Type
> The first thing I check is the Content Type but it's correctly set up (and 
> it's in header template and shared with other pages that show contents 
> correctly.
> 
> 
> 
> 
> 
> When I copied & pasted to another template and it works.
> 
> 2. Browser
> I checked it in another browser (i.e. Chrome) but it returned the same result.
> 
> 3. Reboot runserver
> also it didn't change the output.
> 
> Is there anything else I should check?
> Thanks in advance.
> 
> Regards,
> Ryo
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/FyjKgMAxm0YJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> Stavros
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/52PmLUnVVSIJ.
> 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.

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



Re: How do I call a query set from views.py

2013-01-13 Thread Amirouche Boubekki
Héllo frocco,


2013/1/13 frocco 

>
> in models.py
>
> def get_categories(self):
> return self.objects.filter('category_class <> "sales'
>

Use classmethod
decoratorto
achieve that, like this:

@classmethod
def get_categories(cls):
return cls.objects.filter(category_class='sales')

I replaced self by cls since the first argument is now the class. Also the
filter query is not correct, you have to use
exclude
.

Mind the fact that this is not very django way of doing queries, using
class methods or similar DAO pattern is not the most often used method to
do querying with ORMs (AFAIK). Most of the time queries are inlined in the
view or other code like this:

def view(request):
queryset = Category.objects.exclude(category_class='sales')
context = Context({'title': 'Search', 'form': form, 'data': data})
return render_to_response('index.html', context)

If you use very often this queryset you might want to create a manager for
it, read the documentation regarding
managers
.


>
> in views.py
>
> data = Category.get_categories()
>  context = Context({'title': 'Search', 'form': form, 'data': data})
> return render_to_response('index.html', context)
> this is not working.
>
>

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



How do I call a query set from views.py

2013-01-13 Thread frocco

in models.py

def get_categories(self):
return self.objects.filter('category_class <> "sales'

in views.py

data = Category.get_categories()
 context = Context({'title': 'Search', 'form': form, 'data': data})
return render_to_response('index.html', context)
this is not working.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/tE7Y4BAK8bsJ.
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.



Status of open sourced Django Book?

2013-01-13 Thread Skip Montanaro
I was encouraged to see that the Django Book authors had open-sourced the 
book.  I cloned the git repo and built it.  I've been working my way 
through the online book and thought the open source content might have some 
updates, but after comparing a couple chapters (intro and Chapter 11), it 
seems that perhaps nothing has been updated.

Did I just make too small a comparison?  Are the various versions' release 
notes the only places to find summaries of what's changed since the book 
was written (for 1.1)?

Thanks,

Skip Montanaro

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IEwXTib2UMkJ.
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: NEED HELP ON RUNNING DJANGO ON XAMPP 1.7 UNDER WIN 8

2013-01-13 Thread Damián Pérez
Try something like this. 

(work so good with me, i have win 7, virtualhost in wamp and wsgi.

*apache - httpd:*

*modules:*

LoadModule wsgi_module modules/mod_wsgi.so

*virtual host*


ServerAdmin root@localhost
DocumentRoot "D:/htdocs"
ServerName localhost
#RewriteEngine on
 WSGIScriptAlias / "D:/htdocs/django/django/wsgi.py"
Alias /static/ "D:/htdocs/django/django/static/"
 
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all


best regards




El sábado, 12 de enero de 2013 12:27:11 UTC-6, Kanai Lomayani escribió:
>
> I have managed to install mod_wsgi on apache and django when i try to 
> access the django address I get this error 
> *[Sat Jan 12 20:29:59 2013] [error] [client 127.0.0.1] client denied by 
> server configuration: C:/xampp/locksmith/locksmith/django.wsgi*
> my scriptalias : *WSGIScriptAlias /locksmith/ 
> "C:/xampp/locksmith/django.wsgi"*
> *
> *
> Please i need your help i have searched all day long with no results
>
> --Kanai
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/eEmHwskVpUAJ.
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: Django Calendar App Just Like Google Calendar

2013-01-13 Thread Iñigo Medina

On Sun, Jan 13, 2013 at 12:44:27PM +1100, Mario Gudelj wrote:
> It was straight forward. Tastypie makes it really easy to talk json to
> backbone and plotting the appointments in fullcalendar was even easier. You
> can have the basic functinality in couple of days. More challenging are the
> recurring appointments but python's rrule was great help there.

I'm going to code a kind of calendar too. I'm still thinking on a good approach
for the recurring appointments at the data model level. Are you using any app
for that? Or did you define your own data model?

Iñigo

> On 13 Jan, 2013 9:01 AM, "william ratcliff" 
> wrote:
> 
> > How did you find the integration?
> >
> > William
> >
> >
> > On Sat, Jan 12, 2013 at 4:52 PM, Mario Gudelj wrote:
> >
> >> I don't think there is one. I looked for one few months ago and ended up
> >> building one from scratch with fullcaledar.js, backbone and tastypie
> >>  On 12 Jan, 2013 6:00 PM, "Kashif Ali"  wrote:
> >>
> >>> Hello Guys,
> >>>
> >>> Is there any django app available that is a replica of google calendar?
> >>> I have checked django-scheduler, django-swingtime and couple of more but
> >>> the hardest part with these apps/projects is the limited documentation.
> >>> Can anybody please guide me what app can serve my purpose?
> >>>
> >>> Thanks,
> >>> Kashif
> >>>
> >>> --
> >>> 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.
> >>>
> >>  --
> >> 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.
> >>
> >
> >  --
> > 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.
> >
> 
> -- 
> 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.
> 

-- 
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: Django Roles/Permissions

2013-01-13 Thread Iñigo Medina

On Sat, Jan 12, 2013 at 04:39:45PM -0800, Chung Wu wrote:
> Hi there,
> 
> I am having difficulty figuring out how to structure the following problem:
> 
> Users have different roles/groups:
> 
> Admin, Manager, Author
> 
> Admins can edit every user, can view list of all users, delete all users
> Manager can edit all users who are not admins or managers, ""
> Author, can only edit themselves, view themselves
> 
> Users are associated with Posts
> 
> The posts would follow the same logc
> 
> Authors can only see posts they have created, Edit them etc
> 
> Is there a generic way to do this?
> 
> Currently I have views that list all users, post etc but how would I 
> integrate roles/permissions to filter the lists, prevent the user for 
> editing others etc.

You can code that by your own, creating an app for managing permissions whose
model is related to User model. Permissions model might contain the different
types of roles and the possible actions to.

Anyway, you already have Django Guardian, as said above. It allows you to
define easily permissions for a model (adding them to *Meta* class) and assign
them for any user/group.

Iñigo

> 
> Hope you can point me in the right direction
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/OUSzdMwTvroJ.
> 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.
> 

-- 
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: Django Roles/Permissions

2013-01-13 Thread Amirouche
Héllo Chung,

Did you have a look at https://github.com/lukaszb/django-guardian#usage it 
adds user permissions for objects, I don't know how it works with a Django 
1.5 though.

Regards

On Sunday, January 13, 2013 1:39:45 AM UTC+1, Chung Wu wrote:
>
> Hi there,
>
> I am having difficulty figuring out how to structure the following problem:
>
> Users have different roles/groups:
>
> Admin, Manager, Author
>
> Admins can edit every user, can view list of all users, delete all users
> Manager can edit all users who are not admins or managers, ""
> Author, can only edit themselves, view themselves
>
> Users are associated with Posts
>
> The posts would follow the same logc
>
> Authors can only see posts they have created, Edit them etc
>
> Is there a generic way to do this?
>
> Currently I have views that list all users, post etc but how would I 
> integrate roles/permissions to filter the lists, prevent the user for 
> editing others etc.
>
> Hope you can point me in the right direction
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ChcNGgHMIlUJ.
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: Project Structure - Lots of scattered custom views

2013-01-13 Thread Amirouche
Héllo again,

I don't see where Django makes things easier for you at all. Why no just 
use static files and include a menu via Javascript and serve all the thing 
like static files instead of using Django ?

Regards

On Friday, January 11, 2013 7:34:00 PM UTC+1, chad petzoldt wrote:
>
> Sanjay, you were hitting things pretty close. I think that making sure 
> slug names match up to real *static* locations is the key. I am hosting 
> with Apache, and I thought about using some configurations to cheat a 
> little bit, and get some of the static-files burden off of Django and let 
> Apache resolve any requests that point to actual files on disk (with some 
> security in mind).
>
> What about a view that can determine if it should be pointing at a file on 
> disk, and if so, do a custom Http_Response, and read the actually binary 
> contents from disk by hand. Im just curious on this one; it could be an 
> alternative means of file storage and recognition. I understand this may 
> have some performance implications, but this is not going to break Django, 
> correct? Is this bad Django etiquette?
>
> Amirouche, a different way to describe what I am trying to achieve might 
> be this: I would like to bypass the admin as much as possible when it comes 
> to these "Articles". But when rendered, all of these articles do need at 
> least a small HTML wrapper, and probably some kind of of global template 
> that helps with navigation. If I could handle navigation without the admin, 
> i would be very excited, but it does seem that I will need to use the admin 
> for at least this purpose. The navigation would probably help render 
> hierarchical  "menus" for use as templates within the Articles. I would 
> like to keep this navigation as light as possible.
>
> Thanks for the feedback.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/THu33epzI2gJ.
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.