Re: saving latitude and longitude values in django

2013-06-05 Thread Derek
Your question seems to be more about using javascript with Django; have a 
look at this Q&A:
http://stackoverflow.com/questions/5735107/basic-django-and-javascript-question
There is also a lonk to a downloadable sample app.

The "getting the values from the map via javascript" is a different kind of 
problem altogether; you'd need to ask about that on a javascript forum.

On Tuesday, 4 June 2013 18:25:17 UTC+2, roopas...@gmail.com wrote:
>
> Vermon D. Cole,How to get the latitude and longitude from javascript(using 
> javascript map) and save it to database in Django.If marker is placed  in 
> any place,it will show/display the longitude and latitude value,need to get 
> that and save in in db.Hope this clear.
>
> Thanks 
>
> On Tuesday, June 4, 2013 9:36:17 PM UTC+5:30, Vernon D. Cole wrote:
>>
>>
>> Saving the values is the easy part.  The format you use depends on what 
>> you want to do with them.  If you are only displaying them to users, 
>> CharField might be okay.  If you are going to do any processing, you should 
>> probably convert them.  My storage is done like this:
>>
>> gpsLatitude = models.FloatField("Latitude", blank=True, null=True,
>>> help_text="degrees, floating point, South is negative")
>>> gpsLongitude = models.FloatField("Longtitude", blank=True, null=True,
>>> help_text="degrees, floating point, West is negative")
>>>
>>
>> Getting the values may be a problem. I do not understand what you mean by 
>> "displayed in map using marker".  Is what you have is a graphical image 
>> with a marker icon somewhere on it?  Or are you using a Google api which  
>> can be asked to give you more information?
>> --
>>
>> On Tuesday, June 4, 2013 1:49:06 PM UTC+1, Sivaram R wrote:
>>>
>>> models.py
>>>
>>> class Geolocation(models.Model):
>>> user = models.ForeignKey(User, null=False)
>>> location_latitude = models.CharField('Latitude', max_length=20, 
>>> null=True, blank=True)
>>> location_longitude = models.CharField('Longitude', max_length=20, 
>>> null=True, blank=True)
>>>
>>> In my application,i am using google map using Javascript.Latitude and 
>>> longitude values are displayed in map using marker,i need to get both 
>>> values from map and save to database using Python.
>>>
>>> 1.I want to know how to get the values from map and save.
>>>
>>> 2.How to right view function and form.
>>>
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Writing your first Django app - Tutorial Question

2013-06-05 Thread Sergiy Khohlov
 you have missed
 from django.utils import timezone


 Also simple question  : How are you adding  this nice  code formatting ?

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Wed, Jun 5, 2013 at 7:48 AM, Mike Dewhirst  wrote:

> On 5/06/2013 9:10am, Tony Guilin wrote:
>
>> In the 
>> https://docs.djangoproject.**com/en/1.5/intro/tutorial01/tutorial
>> under the,
>>
>>
>> Playing with the API
>>
>>
>>
>> section, I'm trying to go through the example in my python shell as
>> described.
>>
>>
>> p = Poll(question="What's new?", pub_date=timezone.now())
>>
>> But I'm unable to get to next command "p.save()" because of the error
>> below.
>>
>> tony@tonymachine:~/django_**projects/mysite$ python manage.py shell
>> Python 2.7.3 (default, Aug 1 2012, 05:16:07)
>> [GCC 4.6.3] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> (InteractiveConsole)
>>  >>> from polls.models import Poll, Choice
>>  >>> Poll.objects.all()
>> []
>>  >>> from django.utils import timezone
>>  >>> p = Poll(question="What's new?", pub_date=timezone.now())
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File
>> "/usr/local/lib/python2.7/**dist-packages/django/db/**
>> models/base.py",
>> line 415, in __init__
>>   raise TypeError("'%s' is an invalid keyword argument for this
>> function" % list(kwargs)[0])
>> TypeError: 'pub_date' is an invalid keyword argument for this function
>>  >>>
>>
>> Any guidance is appreciated.
>>
>
> Have you checked that pub_date is a field in the Poll class in models.py?
>
>
>
>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to 
>> django-users+unsubscribe@**googlegroups.com
>> .
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at 
>> http://groups.google.com/**group/django-users?hl=en
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-users+unsubscribe@**googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/django-users?hl=en
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using SQL or not

2013-06-05 Thread Carsten Reimer

Hi,

although I have the same problem as Avraham with getting a close view on 
your schema I will try to add my 2 cents to your question.


Alex Mandel schrieb:
Unless you have a specific need of a NoSQL feature the fact that you 
have many related tables seems a better use case for SQL relational 
database.


In general I Think Alex is right that one should use NoSQL only if there 
is a special need to do so (like scalability or frequently changing 
schemas, you name it ...).


So what might be the options in a NoSQL-world:

Either a document store or a key-value store.
With both there is no native support for relations. With a document 
store you might use something like nesting related entities but that 
reaches its limits when it comes to m:n-relationships.
With a key-value-store you can of course store relations by storing the 
related object's id under the parent's key. This should also work for 
many-to-many-relationships.

But to me both tools seems to be abused using them this way.

What imho might be an option is a graph-database because by definition 
this is highly normalized and has all the relations already in place.
Maybe you want to have a look at Neo4j (http://www.neo4j.org/) which 
provides you with a property-graph-engine.


There is a library which claims to integrate Neo4j into Django 
(https://github.com/scholrly/neo4django). There are other python 
libraries as well (s. http://www.neo4j.org/develop/python).


I tried py2neo but not enough to finally judge it.

I played with Neo4j using their Webinterface and I liked the idea of 
storing data as graphs very much.


So maybe you find a way to fit your model into a graph structure and can 
find out if your typical queries will be supported by Neo4J.


Feel free to send me your schema and I will try to have a look at it 
with regard to Neo4j (but w/o promising that this might be of much help 
;-) ).


With best regards

Carsten Reimer


--
Carsten Reimer
Web Developer
carsten.rei...@galileo-press.de
Phone +49.228.42150.703

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Phone +49.228.42150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Managing Directors: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: pattern validation in QueryDict.get()

2013-06-05 Thread Sergiy Khohlov
I have not seen any problem with this one
>>> myurl = re.compile('\d{0,5}')
>>> print myurl.match("1235")
<_sre.SRE_Match object at 0xb73e0758>
>>> print myurl.match("12356789")
<_sre.SRE_Match object at 0xb73e0758>
>>> print myurl.match("1235").group()
1235
>>> print myurl.match("12356789").group()
12356
 try to experiment with
'^\d{1,10}$'

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Wed, Jun 5, 2013 at 5:57 AM, CHI Cheng  wrote:

> Seems it should be '^\d+$'.
>
> Nobody likes this idea? Should I submit a ticket and pull request?
>
>
> On Saturday, June 1, 2013 9:48:17 PM UTC+10, CHI Cheng wrote:
>>
>> In url.py, we could use regex to limit string patterns.
>>
>> Is there anything similar for QueryDict.get()?
>>
>> e.g. given
>>
>> q = request.GET.get(key='q', default=10, *pattern=r'\d+'*)  # new
>> parameter pattern
>>
>> If value of q in //*path?q=xxx* does not match the pattern, then give
>> default value.
>>
>> --
>> Chi
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: saving latitude and longitude values in django

2013-06-05 Thread Derek
Also: just came across this mapping example, using Leaflet, and a 
standards-based approach (POST via WFS) to write point data from the map to 
a database:

http://blog.georepublic.info/2012/leaflet-example-with-wfs-t/
https://github.com/Georepublic/leaflet-wfs/blob/master/index.html#L201  
(POST code)


On Wednesday, 5 June 2013 09:37:21 UTC+2, Derek wrote:
>
> Your question seems to be more about using javascript with Django; have a 
> look at this Q&A:
>
> http://stackoverflow.com/questions/5735107/basic-django-and-javascript-question
> There is also a lonk to a downloadable sample app.
>
> The "getting the values from the map via javascript" is a different kind 
> of problem altogether; you'd need to ask about that on a javascript forum.
>
> On Tuesday, 4 June 2013 18:25:17 UTC+2, roopas...@gmail.com wrote:
>>
>> Vermon D. Cole,How to get the latitude and longitude from 
>> javascript(using javascript map) and save it to database in Django.If 
>> marker is placed  in any place,it will show/display the longitude and 
>> latitude value,need to get that and save in in db.Hope this clear.
>>
>> Thanks 
>>
>> On Tuesday, June 4, 2013 9:36:17 PM UTC+5:30, Vernon D. Cole wrote:
>>>
>>>
>>> Saving the values is the easy part.  The format you use depends on what 
>>> you want to do with them.  If you are only displaying them to users, 
>>> CharField might be okay.  If you are going to do any processing, you should 
>>> probably convert them.  My storage is done like this:
>>>
>>> gpsLatitude = models.FloatField("Latitude", blank=True, null=True,
 help_text="degrees, floating point, South is negative")
 gpsLongitude = models.FloatField("Longtitude", blank=True, 
 null=True,
 help_text="degrees, floating point, West is negative")

>>>
>>> Getting the values may be a problem. I do not understand what you mean 
>>> by "displayed in map using marker".  Is what you have is a graphical image 
>>> with a marker icon somewhere on it?  Or are you using a Google api which  
>>> can be asked to give you more information?
>>> --
>>>
>>> On Tuesday, June 4, 2013 1:49:06 PM UTC+1, Sivaram R wrote:

 models.py

 class Geolocation(models.Model):
 user = models.ForeignKey(User, null=False)
 location_latitude = models.CharField('Latitude', max_length=20, 
 null=True, blank=True)
 location_longitude = models.CharField('Longitude', max_length=20, 
 null=True, blank=True)

 In my application,i am using google map using Javascript.Latitude and 
 longitude values are displayed in map using marker,i need to get both 
 values from map and save to database using Python.

 1.I want to know how to get the values from map and save.

 2.How to right view function and form.





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django's database system

2013-06-05 Thread heni yemun
Hi,
I'm starting to develop some python program to address some database needs- 
this is for desktop usage not on the web. So i was wondering if django's 
database system can be integrated to my program instead of writing the 
routing python database access api. I like django's easy interface. THANK 
YOU!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Add a file download link that work only after login

2013-06-05 Thread A T.Khan
Hello everyone,

I am relatively new on Django, in fact I got to know about it through 
Openstack Dashboard which works using Django. anyway I got a question and I 
been looking for it for a month now without getting any good results, I 
finally decided to ask some of the experts here. If I am violating any 
rules by posting it or if someone has already answered it, please tell me. 
I hope this community is friendly enough to oversee this.

I have already a Django setup running (you guessed it devstack), and it 
works fine. I have done plenty of editing already. But now I want to add a 
download button on a page, and by clicking to it, a file should be 
downloaded. Seems simple enough, but right now what I have done is adding 

{% trans 
"Downloadl" %}

 in one of the files. This works perfectly ... however this link works but 
It is simple html encoding, and it works even when I am not logged in, 
bypassing the entire purpose of file security. I have tried to embed the 
code in some py files but then it gives me debug error.

So I will be really grateful if someone can guide me what to do here. All I 
want is to add a download button/link on a page and a file to be 
downloaded. I tried staticfiles and media_url methods, not the result I 
want. Please help me that where I need to make changes in which 
configuration files and how will it work.

Thanks in Advance 

Best of Regards,
AT

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Can´t get Django Administration page to show

2013-06-05 Thread Oliver Hilmarsson
I´m finished part 1 in django 
tutorial https://docs.djangoproject.com/en/dev/intro/tutorial01/ 

Everything worked great, but starting in part 2 I can´t get the admin page 
to show up.  I always just get the initial "It worked! Congratulations on 
your first Django-powered page" page when I go 
to http://127.0.0.1:8000/admin/

Any help would be great, thanks



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: linux or windows

2013-06-05 Thread Fabiano Trentin
Hi everyone,
 
I would recommend to install Django on Ubuntu 12.04.2 and with a Oracle VM 
Virtualbox in your Windows OS.
Check this tutorial post: *
http://faptrentin.blogspot.com.br/2013/06/geodjango-on-ubuntu-12042.html*
 
Good luck.

Em sábado, 1 de junho de 2013 13h24min19s UTC-3, Kakar escreveu:

> Thanks!
>
>
> On Sat, Jun 1, 2013 at 9:04 PM, Artem Zinoviev 
> 
> > wrote:
>
>> Django is a python. And nothing more... if you want be a python developer 
>> linux is must have. Of course you can develop in windows and play with you 
>> code some times... But a lot of python package don`t work in windows. if 
>> you want meet new problem every day - windows is your choice :)
>>
>> пятница, 31 мая 2013 г., 14:11:23 UTC+3 пользователь Kakar написал:
>>
>>> Hi!
>>> I know this question is one absurd question, but just out of curiosity, 
>>> is it important to use linux other than the windows, related to django. 
>>> Cause i'm in windows, and if it is, then i was thinking to use Ubuntu. 
>>> Please advise.
>>>  
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django's database system

2013-06-05 Thread mulianto
Hi Heni, 

Do you mean django database system is refer to the ORM django provide?

You can use and tie with your desktop APP by using django REST service . 

With the REST service provided by django, any APP can Benefit it like mobile 
APP, desktop APP, web APP, third party APP via your REST api .

Regards, 

Mulianto

Sent from my iPhone

On 5 Jun 2013, at 18:29, heni yemun  wrote:

> Hi,
> I'm starting to develop some python program to address some database needs- 
> this is for desktop usage not on the web. So i was wondering if django's 
> database system can be integrated to my program instead of writing the 
> routing python database access api. I like django's easy interface. THANK YOU!
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there any good tutorial on how to daemonize celery?

2013-06-05 Thread Mike
Have you tried supervisord?  I installed supervisord from my linux distro 
on my server and put a config file in the conf.d directory.  Its working 
fine.


On Tuesday, June 4, 2013 12:17:16 PM UTC+2, Manu wrote:
>
> Hi all,
>
> I have had no success so far with daemonizing celery on my server. I 
> raised two stack overflow questions and have received only a few answers. 
> Could someone please point me to a solid tutorial or blog post on how to 
> make it work. I'm using celery with django in a virtual environment.
>
> Btw, the links to those two questions
> 1. 
> http://stackoverflow.com/questions/16896686/daemonizing-celery-process-celeryd-multi-not-found
> 2. 
> http://stackoverflow.com/questions/16915034/is-there-a-simple-manage-py-command-that-i-run-with-django-celery-to-daemonize-c
>
> Thanks in advance for your time! 
>
> Regards,
> Manu
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there any good tutorial on how to daemonize celery?

2013-06-05 Thread manuga...@gmail.com
Thanks for the reply Mike. I've been trying to setup supervisord for 4
hours now. Just for this celery. I don't know where I'm going wrong. Looks
like nobody else is having a problem.

On 5 June 2013 19:13, Mike  wrote:

> Have you tried supervisord?  I installed supervisord from my linux distro
> on my server and put a config file in the conf.d directory.  Its working
> fine.
>
>
> On Tuesday, June 4, 2013 12:17:16 PM UTC+2, Manu wrote:
>>
>> Hi all,
>>
>> I have had no success so far with daemonizing celery on my server. I
>> raised two stack overflow questions and have received only a few answers.
>> Could someone please point me to a solid tutorial or blog post on how to
>> make it work. I'm using celery with django in a virtual environment.
>>
>> Btw, the links to those two questions
>> 1. http://stackoverflow.com/**questions/16896686/**
>> daemonizing-celery-process-**celeryd-multi-not-found
>> 2. http://stackoverflow.com/**questions/16915034/is-there-a-**
>> simple-manage-py-command-that-**i-run-with-django-celery-to-**daemonize-c
>>
>> Thanks in advance for your time!
>>
>> Regards,
>> Manu
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/F0dH6WdwFBA/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Manu Ganji,
Mobile: +91-8500719336.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can´t get Django Administration page to show

2013-06-05 Thread Sithembewena Lloyd Dube
Hi Oliver,

please provide more information. Did you follow all steps, such as: add
your app/s to INSTALLED_APPS in your settings file, run the manage.py
syncdb command, create an admin.py file where you register your model/s,
comment out the lines that activate your admin site in urls.py?


On Wed, Jun 5, 2013 at 1:47 PM, Oliver Hilmarsson <
oliver.hilmars...@gmail.com> wrote:

> I´m finished part 1 in django tutorial
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> Everything worked great, but starting in part 2 I can´t get the admin page
> to show up.  I always just get the initial "It worked! Congratulations on
> your first Django-powered page" page when I go to
> http://127.0.0.1:8000/admin/
>
> Any help would be great, thanks
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards,
Sithu Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Best Pratice To Implement User Types

2013-06-05 Thread coded kid
Thanks! do you think Django group is the best for this? should I leave 
asssign a group to every user who signed up through django registration? 

On Tuesday, 4 June 2013 12:12:24 UTC+1, Frank Bieniek wrote:
>
> Hi, 
> the user stays the same, but he becomes member of the PaidMember Group, 
> (Access handling) 
> and he gets a monthly payment record history entry. 
>
> Think about role changes, becomes PaidMember, leaves PaidMember, becomes 
> FreeUser, leaves FreeUser. 
>
> So you have to think about the role change transitions 
> and the access limitations every usergroup has. 
>
> A user has a PaymentHistory, with several PaymentEntries. And the last 
> PaymentEntry knows the related group Membership. 
>
> Just my 2 cents. 
> Frank 
>
>
>
>
> Am 04.06.2013 08:51, schrieb coded kid: 
> > I'm building a django project and I want to have free users and 
> > premium users. I've been hitting my head on the best way to implement 
> > this. Users will be able to login through the same login page and 
> > redirect to different pages after logging in based on their user type. 
> > 
> > My main challenge is the best way to implement paid subscription for 
> > users so after paying, expiration date and redirection of users. 
> > Should I make use of the Userprofile model to implement premium users 
> > or write a standalone  model for handling premium users? Kindly 
> > explain on the best way to go about this. Thanks! 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/django-users?hl=en. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




User Registration Tutorial

2013-06-05 Thread Nafiul Islam
Hi! Is there a good tutorial on how to make a user-registration system 
using django? Any tips would be highly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Add a file download link that work only after login

2013-06-05 Thread Bill Freeman
The easiest thing, which you may or may not find to be adequate, is to use
an "if" tag in the template to do one of:
  Not render the button if you are not logged in, or
  Render a button that has the correct link if you are logged in but links
to a "you must log in" page if you are not, or
  Render the correct button if you are logged in, but render a dummy
disabled button if you are not

I must point out that security is limited, since a logged in user could
capture the link to share with anyone, but he could also simply share the
file after download, so there can only be security if you can trust ALL of
your logged in users.

Django's template system, and what you must do to have access to the user
object in the template, and how to test whether it is anonymous or
authenticated are well covered in the documentation and/or discussed in the
mailing list archives.

Bill


On Wed, Jun 5, 2013 at 6:44 AM, A T.Khan  wrote:

> Hello everyone,
>
> I am relatively new on Django, in fact I got to know about it through
> Openstack Dashboard which works using Django. anyway I got a question and I
> been looking for it for a month now without getting any good results, I
> finally decided to ask some of the experts here. If I am violating any
> rules by posting it or if someone has already answered it, please tell me.
> I hope this community is friendly enough to oversee this.
>
> I have already a Django setup running (you guessed it devstack), and it
> works fine. I have done plenty of editing already. But now I want to add a
> download button on a page, and by clicking to it, a file should be
> downloaded. Seems simple enough, but right now what I have done is adding
>
> {% trans
> "Downloadl" %}
>
>  in one of the files. This works perfectly ... however this link works but
> It is simple html encoding, and it works even when I am not logged in,
> bypassing the entire purpose of file security. I have tried to embed the
> code in some py files but then it gives me debug error.
>
> So I will be really grateful if someone can guide me what to do here. All
> I want is to add a download button/link on a page and a file to be
> downloaded. I tried staticfiles and media_url methods, not the result I
> want. Please help me that where I need to make changes in which
> configuration files and how will it work.
>
> Thanks in Advance
>
> Best of Regards,
> AT
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there any good tutorial on how to daemonize celery?

2013-06-05 Thread Mike
Thats why I installed it using the package provided in my Ubuntu linux 
server.  Then I used the template .conf file (I think from the celery 
documentation) and customized it for my project.  I did have some trouble 
to get it running the first time but I think there is a delay between when 
you restart supervisord and when the daemons it controls restart.  In fact, 
I don't use the 'restart' command to restart supervisord, I use to 'stop' 
and then confirm that the celery processes have stopped by using 'ps'. 
 then I use '/etc/init.d/supervisord start' to start it up again.

Is your worker running fine when you execute:
python manage.py celery worker
?

Are you using a virtualenv?


On Wednesday, June 5, 2013 3:53:48 PM UTC+2, Manu wrote:
>
> Thanks for the reply Mike. I've been trying to setup supervisord for 4 
> hours now. Just for this celery. I don't know where I'm going wrong. Looks 
> like nobody else is having a problem.
>
> On 5 June 2013 19:13, Mike > wrote:
>
>> Have you tried supervisord?  I installed supervisord from my linux distro 
>> on my server and put a config file in the conf.d directory.  Its working 
>> fine.
>>
>>
>> On Tuesday, June 4, 2013 12:17:16 PM UTC+2, Manu wrote:
>>>
>>> Hi all,
>>>
>>> I have had no success so far with daemonizing celery on my server. I 
>>> raised two stack overflow questions and have received only a few answers. 
>>> Could someone please point me to a solid tutorial or blog post on how to 
>>> make it work. I'm using celery with django in a virtual environment.
>>>
>>> Btw, the links to those two questions
>>> 1. http://stackoverflow.com/**questions/16896686/**
>>> daemonizing-celery-process-**celeryd-multi-not-found
>>> 2. http://stackoverflow.com/**questions/16915034/is-there-a-**
>>> simple-manage-py-command-that-**i-run-with-django-celery-to-**
>>> daemonize-c
>>>
>>> Thanks in advance for your time! 
>>>
>>> Regards,
>>> Manu
>>>
>>  -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/F0dH6WdwFBA/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Manu Ganji,
> Mobile: +91-8500719336.
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: User Registration Tutorial

2013-06-05 Thread Jonathan Baker
This isn't a formal tutorial of the django-registration app, but the
documentation is great and integrating app is as simple as any other
third-party Django app:

Code: https://bitbucket.org/ubernostrum/django-registration
Docs: https://django-registration.readthedocs.org/en/latest/


On Wed, Jun 5, 2013 at 9:01 AM, Nafiul Islam wrote:

> Hi! Is there a good tutorial on how to make a user-registration system
> using django? Any tips would be highly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: User Registration Tutorial

2013-06-05 Thread Nafiul Islam
Thanks Jon, I appreciate it.

On Wednesday, June 5, 2013 9:09:16 PM UTC+6, jondbaker wrote:
>
> This isn't a formal tutorial of the django-registration app, but the 
> documentation is great and integrating app is as simple as any other 
> third-party Django app:
>
> Code: https://bitbucket.org/ubernostrum/django-registration
> Docs: https://django-registration.readthedocs.org/en/latest/
>
>
> On Wed, Jun 5, 2013 at 9:01 AM, Nafiul Islam 
> > wrote:
>
>> Hi! Is there a good tutorial on how to make a user-registration system 
>> using django? Any tips would be highly appreciated. 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Jonathan D. Baker
> Developer
> http://jonathandbaker.com
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: User Registration Tutorial

2013-06-05 Thread Jonathan Baker
You're welcome. Also of use are projects such as the following that include
the templates you'll need for django-registration:
https://github.com/macdhuibh/django-registration-templates


On Wed, Jun 5, 2013 at 9:28 AM, Nafiul Islam wrote:

> Thanks Jon, I appreciate it.
>
>
> On Wednesday, June 5, 2013 9:09:16 PM UTC+6, jondbaker wrote:
>
>> This isn't a formal tutorial of the django-registration app, but the
>> documentation is great and integrating app is as simple as any other
>> third-party Django app:
>>
>> Code: 
>> https://bitbucket.org/**ubernostrum/django-**registration
>> Docs: 
>> https://django-**registration.readthedocs.org/**en/latest/
>>
>>
>> On Wed, Jun 5, 2013 at 9:01 AM, Nafiul Islam  wrote:
>>
>>> Hi! Is there a good tutorial on how to make a user-registration system
>>> using django? Any tips would be highly appreciated.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> Jonathan D. Baker
>> Developer
>> http://jonathandbaker.com
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there any good tutorial on how to daemonize celery?

2013-06-05 Thread manuga...@gmail.com
Mike,

Please find my replies below.

On 5 June 2013 20:27, Mike  wrote:

> Thats why I installed it using the package provided in my Ubuntu linux
> server.  Then I used the template .conf file (I think from the celery
> documentation) and customized it for my project.  I did have some trouble
> to get it running the first time but I think there is a delay between when
> you restart supervisord and when the daemons it controls restart.  In fact,
> I don't use the 'restart' command to restart supervisord, I use to 'stop'
> and then confirm that the celery processes have stopped by using 'ps'.
>  then I use '/etc/init.d/supervisord start' to start it up again.
>

Ok, I'll look into that.

>
> Is your worker running fine when you execute:
> python manage.py celery worker
> ?
>
 I'm getting an error that it's unable to import some of the files in my
django project. This, even when I run after activating my virtual
environment.

>
> Are you using a virtualenv?
>
> Yeah as I said above, I'm using a virtualenv.

>
>
>



-- 
Manu Ganji,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Validation of generic relation from a GenericInlineModelAdmin

2013-06-05 Thread Calin Don
Hi,

I don't know if this is a bug or expected behavior, but when I'm trying to
create a new generic relation object from a GenericInlineModelAdmin form,
the object's validation methods (eg. clean or validate_unique) don't have
object_id and content_type fields set.

When the generic relation object, already exists object_id and content_type
are properly set.

Here is the sample code:

models.py:
class Article(models.Model):
title = models.CharField(max_length=32)
body = models.TextField()

class TaggedItem(models.Model):
tag = models.SlugField()
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')

def clean(self, exclude=None):
pass

admin.py:
class InlineTags(generic.GenericTabularInline):
model = TaggedItem

class ArticleAdmin(admin.ModelAdmin):
inlines = [InlineTags]

admin.site.register(Article, ArticleAdmin)

Now if you go to Articles admin and add a tag, in the clean method of
TaggedItem self.object_id and self.content_type are set to None. If the tag
is being edited they are set accordingly.

I tried on both django 1.4.x and 1.5.x.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there any good tutorial on how to daemonize celery?

2013-06-05 Thread Mike


On Wednesday, June 5, 2013 5:42:39 PM UTC+2, Manu wrote:
>
> Mike,
>
> Please find my replies below.
>
> On 5 June 2013 20:27, Mike > wrote:
>
>> Thats why I installed it using the package provided in my Ubuntu linux 
>> server.  Then I used the template .conf file (I think from the celery 
>> documentation) and customized it for my project.  I did have some trouble 
>> to get it running the first time but I think there is a delay between when 
>> you restart supervisord and when the daemons it controls restart.  In fact, 
>> I don't use the 'restart' command to restart supervisord, I use to 'stop' 
>> and then confirm that the celery processes have stopped by using 'ps'. 
>>  then I use '/etc/init.d/supervisord start' to start it up again.
>>
>
> Ok, I'll look into that. 
>
>>
>> Is your worker running fine when you execute:
>> python manage.py celery worker
>> ?
>>
>  I'm getting an error that it's unable to import some of the files in my 
> django project. This, even when I run after activating my virtual 
> environment.
>
>>
>>
>> In your SO question you say that you have set up  /etc/default/celeryd 
but you don't need this for running celery in a Django project.  In your 
settings.py file you should have this:

import djcelery
djcelery.setup_loader()
BROKER_URL = 'amqp://guest:guest@localhost:5672//'
(BROKER_URL should be set to whatever broker you're using)

your INSTALLED_APPS should also have 'djcelery'

get the command 'python manage.py celery worker' working first, before you 
mess around with supervisor or init scripts.  If you can't run a worker on 
the command line it probably won't work in a daemon either.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Something similar to a WAMP stack for Django?

2013-06-05 Thread Nafiul Islam
Hi!

Is there something similar to a WAMP stack for django and python 
development, like there is for PHP? It gives you a better way of emulating 
how a real server would work.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Something similar to a WAMP stack for Django?

2013-06-05 Thread Jonas Geiregat

On 05 Jun 2013, at 18:07, Nafiul Islam wrote:

> Hi!
> 
> Is there something similar to a WAMP stack for django and python development, 
> like there is for PHP? It gives you a better way of emulating how a real 
> server would work.

There is: http://bitnami.com/stack/django 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can´t get Django Administration page to show

2013-06-05 Thread Oliver Hilmarsson
Thanks, Sithu, I didn´t uncomment the lines in urls.py.  It´s working now 
:o)

Regards,
Óliver

On Wednesday, June 5, 2013 11:47:49 AM UTC, Oliver Hilmarsson wrote:
>
> I´m finished part 1 in django tutorial 
> https://docs.djangoproject.com/en/dev/intro/tutorial01/ 
>
> Everything worked great, but starting in part 2 I can´t get the admin page 
> to show up.  I always just get the initial "It worked! Congratulations on 
> your first Django-powered page" page when I go to 
> http://127.0.0.1:8000/admin/
>
> Any help would be great, thanks
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Javascript translation catalogs in the CDN

2013-06-05 Thread Daniel Izquierdo
Hi,

I want to put my javascript translation catalogs in a CDN, considering the 
following points:

* In all the calls my app does to javascript_catalog(), the only thing 
which can influence the result is the active language. So there is exactly 
one possible javascript catalog per language I support.

* I know the django admin has its own calls to javascript_catalog(), I 
don't care about not keeping those in the CDN.

* My app always knows its own current version, and the active language for 
a request. Therefore, I could just reference, from my templates, a file in 
the CDN that has the app version and active language in the filename and 
then always get the correct version, if only that file was available.

My hacky way to support this is, I wrote a small static files finder that 
simply produces one file per supported language by calling the 
javascript_catalog view offline, while running collectstatic. And when 
deploying I can sync those to the CDN along with the rest of the static 
files. I know static files finders are considered a private interface, I'm 
fine with knowing this and maintaining this part of my code whenever I 
update Django and in the worst case I can always fall back to the normal 
way of doing things. I've tried it and it works well so far.

So... is this a dumb idea?

Daniel Izquierdo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django's database system

2013-06-05 Thread Nikolas Stevenson-Molnar
Have you had a look at SQLAlchemy? http://www.sqlalchemy.org/

_Nik

On 6/5/2013 3:29 AM, heni yemun wrote:
> Hi,
> I'm starting to develop some python program to address some database
> needs- this is for desktop usage not on the web. So i was wondering if
> django's database system can be integrated to my program instead of
> writing the routing python database access api. I like django's easy
> interface. THANK YOU!
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Add a file download link that work only after login

2013-06-05 Thread Avraham Serour
maybe you could use something like this:
https://docs.djangoproject.com/en/1.1/howto/apache-auth/


On Wed, Jun 5, 2013 at 6:02 PM, Bill Freeman  wrote:

> The easiest thing, which you may or may not find to be adequate, is to use
> an "if" tag in the template to do one of:
>   Not render the button if you are not logged in, or
>   Render a button that has the correct link if you are logged in but links
> to a "you must log in" page if you are not, or
>   Render the correct button if you are logged in, but render a dummy
> disabled button if you are not
>
> I must point out that security is limited, since a logged in user could
> capture the link to share with anyone, but he could also simply share the
> file after download, so there can only be security if you can trust ALL of
> your logged in users.
>
> Django's template system, and what you must do to have access to the user
> object in the template, and how to test whether it is anonymous or
> authenticated are well covered in the documentation and/or discussed in the
> mailing list archives.
>
> Bill
>
>
> On Wed, Jun 5, 2013 at 6:44 AM, A T.Khan  wrote:
>
>> Hello everyone,
>>
>> I am relatively new on Django, in fact I got to know about it through
>> Openstack Dashboard which works using Django. anyway I got a question and I
>> been looking for it for a month now without getting any good results, I
>> finally decided to ask some of the experts here. If I am violating any
>> rules by posting it or if someone has already answered it, please tell me.
>> I hope this community is friendly enough to oversee this.
>>
>> I have already a Django setup running (you guessed it devstack), and it
>> works fine. I have done plenty of editing already. But now I want to add a
>> download button on a page, and by clicking to it, a file should be
>> downloaded. Seems simple enough, but right now what I have done is adding
>>
>> {% trans
>> "Downloadl" %}
>>
>>  in one of the files. This works perfectly ... however this link works
>> but It is simple html encoding, and it works even when I am not logged in,
>> bypassing the entire purpose of file security. I have tried to embed the
>> code in some py files but then it gives me debug error.
>>
>> So I will be really grateful if someone can guide me what to do here. All
>> I want is to add a download button/link on a page and a file to be
>> downloaded. I tried staticfiles and media_url methods, not the result I
>> want. Please help me that where I need to make changes in which
>> configuration files and how will it work.
>>
>> Thanks in Advance
>>
>> Best of Regards,
>> AT
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Add a file download link that work only after login

2013-06-05 Thread Mike Doroshenko II

Maybe a view with something like

def priv_file(request):
if request.user.is_anonymous:
return render_to_response("goaway.html")
else:
path = "Path to file"
data = open(path)
type = "whatever"
return HttpResonse(data, content_type=type)


A T.Khan wrote:

Hello everyone,

I am relatively new on Django, in fact I got to know about it through 
Openstack Dashboard which works using Django. anyway I got a question 
and I been looking for it for a month now without getting any good 
results, I finally decided to ask some of the experts here. If I am 
violating any rules by posting it or if someone has already answered 
it, please tell me. I hope this community is friendly enough to 
oversee this.


I have already a Django setup running (you guessed it devstack), and 
it works fine. I have done plenty of editing already. But now I want 
to add a download button on a page, and by clicking to it, a file 
should be downloaded. Seems simple enough, but right now what I have 
done is adding


{% trans 
"Downloadl" %}


 in one of the files. This works perfectly ... however this link works 
but It is simple html encoding, and it works even when I am not logged 
in, bypassing the entire purpose of file security. I have tried to 
embed the code in some py files but then it gives me debug error.


So I will be really grateful if someone can guide me what to do here. 
All I want is to add a download button/link on a page and a file to be 
downloaded. I tried staticfiles and media_url methods, not the result 
I want. Please help me that where I need to make changes in which 
configuration files and how will it work.


Thanks in Advance

Best of Regards,
AT
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


--
Mike Doroshenko, Junior Sys Admin
TecKnoQuest Inc.
mi...@tecknoquest.com
www.tecknoquest.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can´t get Django Administration page to show

2013-06-05 Thread Sithembewena Lloyd Dube
You're welcome, Oliver :-)

Regards,
Sithu


On Wed, Jun 5, 2013 at 6:51 PM, Oliver Hilmarsson <
oliver.hilmars...@gmail.com> wrote:

> Thanks, Sithu, I didn´t uncomment the lines in urls.py.  It´s working now
> :o)
>
> Regards,
> Óliver
>
>
> On Wednesday, June 5, 2013 11:47:49 AM UTC, Oliver Hilmarsson wrote:
>>
>> I´m finished part 1 in django tutorial https://docs.**
>> djangoproject.com/en/dev/**intro/tutorial01/
>>
>>
>> Everything worked great, but starting in part 2 I can´t get the admin
>> page to show up.  I always just get the initial "It worked! Congratulations
>> on your first Django-powered page" page when I go to
>> http://127.0.0.1:8000/**admin/ 
>>
>> Any help would be great, thanks
>>
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards,
Sithu Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django foreing keys joins

2013-06-05 Thread Àlex Pérez
Can someone tell me why the or in that query:
print Counter.on_medicos.filter(loc__isnull=True).only("id").query

""SELECT `web_counter`.`id` FROM `web_counter` LEFT OUTER JOIN
`locations_localidad` ON (`web_counter`.`loc` = `locations_localidad`.`id`)
WHERE (`web_counter`.`mode` = 1  AND `locations_localidad`.`id` IS NULL)"""

The orm is making a JOIN?? i can't understant!

The foreignkey loc is nullable and blank, i don't understant why making a
filter the orm is performing the join and making an exclude the ORM is not
performing the JOIN...

print Counter.on_medicos.exclude(loc__isnull=True).only("id").query
SELECT `web_counter`.`id` FROM `web_counter` WHERE (`web_counter`.`mode` =
1  AND NOT (`web_counter`.`loc` IS NULL))

Thank's!

-- 
Alex Perez
alex.pe...@bebabum.com

 *bebabum* be successful

c/ Còrsega 301-303, Àtic 2
08008 Barcelona
http://www.bebabum.com
http://www.facebook.com/bebabum
http://twitter.com/bebabum

This message is intended exclusively for its addressee and may contain
information that is confidential and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any
dissemination, copy or disclosure of this communication is strictly
prohibited by law.

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario
indicado,
queda notificado que la utilización, divulgación y/o copia sin autorización
está prohibida en virtud de la legislación vigente.

Le informamos que los datos personales que facilite/ha facilitado pasarán a
formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
por finalidad gestionar las relaciones con usted.
Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección
de e-mail l...@bebabum.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Understanding an existing big web application written in Django

2013-06-05 Thread sidddd


I am a beginner in web dev and I built few small Django web apps like 
blogging application etc. Now I am in a fix as I need to understand a big 
web app written in Django and I dont know where to start.

Can anyone suggest me how to understand an existing Django code, I mean 
where should I start looking at ? Is there a software which will show a MVC 
visual of the code?

Thanks in Advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Understanding an existing big web application written in Django

2013-06-05 Thread Siddharth Shah
I think you can definitely learn 
from:http://dangoldin.com/2013/05/07/eighteen-months-of-django/. 

Lots of pointers and tips. My suggestion would be pick up a popular site 
Hacker News, AirBnB, Kickstarter etc and try to write a clone. 

Thank you, 
Sidharth

On Thursday, June 6, 2013 5:53:06 AM UTC+5:30, si wrote:
>
> I am a beginner in web dev and I built few small Django web apps like 
> blogging application etc. Now I am in a fix as I need to understand a big 
> web app written in Django and I dont know where to start.
>
> Can anyone suggest me how to understand an existing Django code, I mean 
> where should I start looking at ? Is there a software which will show a MVC 
> visual of the code?
>
> Thanks in Advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Understanding an existing big web application written in Django

2013-06-05 Thread Sergiy Khohlov
What is mean big application ?
1) Write an idea
2) Write a plan
3) Write requirements
4) Rewrite all above few times

 and  you are PM and developer now.

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Thu, Jun 6, 2013 at 5:17 AM, Siddharth Shah  wrote:

> I think you can definitely learn from:
> http://dangoldin.com/2013/05/07/eighteen-months-of-django/.
>
> Lots of pointers and tips. My suggestion would be pick up a popular site
> Hacker News, AirBnB, Kickstarter etc and try to write a clone.
>
> Thank you,
> Sidharth
>
> On Thursday, June 6, 2013 5:53:06 AM UTC+5:30, si wrote:
>>
>> I am a beginner in web dev and I built few small Django web apps like
>> blogging application etc. Now I am in a fix as I need to understand a big
>> web app written in Django and I dont know where to start.
>>
>> Can anyone suggest me how to understand an existing Django code, I mean
>> where should I start looking at ? Is there a software which will show a MVC
>> visual of the code?
>>
>> Thanks in Advance.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Understanding an existing big web application written in Django

2013-06-05 Thread Mario Gudelj
I always start from urls.py. Then proceed to views. Then inside views you
can see which modules and templates are used and so on. But the URLs are
the starting point...

_M


On 6 June 2013 14:50, Sergiy Khohlov  wrote:

> What is mean big application ?
> 1) Write an idea
> 2) Write a plan
> 3) Write requirements
> 4) Rewrite all above few times
>
>  and  you are PM and developer now.
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Thu, Jun 6, 2013 at 5:17 AM, Siddharth Shah  wrote:
>
>> I think you can definitely learn from:
>> http://dangoldin.com/2013/05/07/eighteen-months-of-django/.
>>
>> Lots of pointers and tips. My suggestion would be pick up a popular site
>> Hacker News, AirBnB, Kickstarter etc and try to write a clone.
>>
>> Thank you,
>> Sidharth
>>
>> On Thursday, June 6, 2013 5:53:06 AM UTC+5:30, si wrote:
>>>
>>> I am a beginner in web dev and I built few small Django web apps like
>>> blogging application etc. Now I am in a fix as I need to understand a big
>>> web app written in Django and I dont know where to start.
>>>
>>> Can anyone suggest me how to understand an existing Django code, I mean
>>> where should I start looking at ? Is there a software which will show a MVC
>>> visual of the code?
>>>
>>> Thanks in Advance.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Add a file download link that work only after login

2013-06-05 Thread Felipe Coelho
2013/6/5 A T.Khan 

> I have already a Django setup running (you guessed it devstack), and it
> works fine. I have done plenty of editing already. But now I want to add a
> download button on a page, and by clicking to it, a file should be
> downloaded. Seems simple enough, but right now what I have done is adding
>
> {% trans
> "Downloadl" %}
>
>  in one of the files. This works perfectly ... however this link works but
> It is simple html encoding, and it works even when I am not logged in,
> bypassing the entire purpose of file security. I have tried to embed the
> code in some py files but then it gives me debug error.
>

Note that while Django can perform really well, serving *files* is a job
best left to the webserver itself. Take a look at django-sendfiles [1].
With it, you can use Django to test whether the user has permission to
actually download the file, and then let the webserver serve the file
transparently to the end user.

[1] https://github.com/johnsensible/django-sendfile

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.