Re: Django Documentation 1.7 shows "django-admin.py" whereas it should be "django-admin"

2015-03-04 Thread James Schneider
Not technically a bug, although it is a common point of confusion. It
depends on how you installed Django. Both perform the same function on
their respective systems. There's a note with this link on the first page
of the tutorial, although admittedly I believe they should be more explicit
with this issue on the tutorial page.

https://docs.djangoproject.com/en/1.7/faq/troubleshooting/#troubleshooting-django-admin-py

-James
On Mar 4, 2015 10:13 PM, "Deep Sukhwani"  wrote:

> Hi,
>
> I am a newbie to this community and I am not sure how should I submit this
> bug/error in 1st part of Django Tutorial.
>
> Here's the error:
> On page Writing your first Django app, part 1 | Creating a project
>  
> notice
> it says *django-admin.py startproject mysite* whereas it should actually
> be *django-admin startproject mysite*
>
> Note: I am not sure if the documentation here: Problems running
> django-admin
> 
>  relates
> to this issue (Screenshot below):
>
>
> 
>
>
> I am on a Windows 7 64-bit machine, running Django 1.7.5 with Python 2.7.9
> (64-bit). If I run *django-admin.py startproject mysite*, I get following
> response:
>
> Usage: django-admin.py subcommand [options] [args]
>
>
> Options:
>   -v VERBOSITY, --verbosity=VERBOSITY
> Verbosity level; 0=minimal output, 1=normal output
> ,
> 2=verbose output, 3=very verbose output
>   --settings=SETTINGS   The Python path to a settings module, e.g.
> "myproject.settings.main". If this isn't
> provided, the
> DJANGO_SETTINGS_MODULE environment variable will be
> used.
>   --pythonpath=PYTHONPATH
> A directory to add to the Python path, e.g.
> "/home/djangoprojects/myproject".
>   --traceback   Raise on exception
>   --no-colorDon't colorize the command output.
>   --version show program's version number and exit
>   -h, --helpshow this help message and exit
>
>
> Type 'django-admin.py help ' for help on a specific
> subcommand.
>
>
> Available subcommands:
>
>
> [django]
> check
> compilemessages
> createcachetable
> dbshell
> diffsettings
> dumpdata
> flush
> inspectdb
> loaddata
> makemessages
> makemigrations
> migrate
> runfcgi
> runserver
> shell
> sql
> sqlall
> sqlclear
> sqlcustom
> sqldropindexes
> sqlflush
> sqlindexes
> sqlinitialdata
> sqlmigrate
> sqlsequencereset
> squashmigrations
> startapp
> startproject
> syncdb
> test
> testserver
> validate
> Note that only Django core commands are listed as settings are not
> properly configured (error: Requested setting INSTALLED_AP
> PS, but settings are not configured. You must either define the
> environment variable DJANGO_SETTINGS_MODULE or call settings.
> configure() before accessing settings.).
>
> However if I run, *django-admin startproject mysite*, the new mysite
> directory is created along with all the default files
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/78dc0cb3-6269-40ca-9c08-358e9a67d0fd%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUMv7B96igb8eUyudfEc30_rEnGrtGc_8OxQwaLGE%3DYGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Documentation 1.7 shows "django-admin.py" whereas it should be "django-admin"

2015-03-04 Thread Deep Sukhwani
Hi,

I am a newbie to this community and I am not sure how should I submit this 
bug/error in 1st part of Django Tutorial.

Here's the error:
On page Writing your first Django app, part 1 | Creating a project 
 
notice 
it says *django-admin.py startproject mysite* whereas it should actually be 
*django-admin 
startproject mysite*

Note: I am not sure if the documentation here: Problems running django-admin 

 relates 
to this issue (Screenshot below):




I am on a Windows 7 64-bit machine, running Django 1.7.5 with Python 2.7.9 
(64-bit). If I run *django-admin.py startproject mysite*, I get following 
response:

Usage: django-admin.py subcommand [options] [args]


Options:
  -v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, 
the
DJANGO_SETTINGS_MODULE environment variable will be
used.
  --pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
  --traceback   Raise on exception
  --no-colorDon't colorize the command output.
  --version show program's version number and exit
  -h, --helpshow this help message and exit


Type 'django-admin.py help ' for help on a specific subcommand.


Available subcommands:


[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlinitialdata
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
syncdb
test
testserver
validate
Note that only Django core commands are listed as settings are not properly 
configured (error: Requested setting INSTALLED_AP
PS, but settings are not configured. You must either define the environment 
variable DJANGO_SETTINGS_MODULE or call settings.
configure() before accessing settings.).

However if I run, *django-admin startproject mysite*, the new mysite 
directory is created along with all the default files

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/78dc0cb3-6269-40ca-9c08-358e9a67d0fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prefetching a single item

2015-03-04 Thread Simon Charette
I agree it's a bit devious, it took me a couple of minutes to figure out it 
would work for this particular use case.

Ideally there would a kwarg to Prefect that does the limiting 
automatically, something like:

SELECT train.id, s.* FROM train LATERAL JOIN (
SELECT * FROM seat WHERE seat.train_id = train.id LIMIT 5
) s ON TRUE
WHERE train.id IN (1,2,3)

Le mercredi 4 mars 2015 16:27:16 UTC-5, cool-RR a écrit :
>
> Thanks Simon! That worked.
>
> I would say it's a bit devious though, and it was nice if there was a 
> method that didn't use `distinct`, which has its own issues. (And can't be 
> used for any number of items other than 1 in this case.) 
>
> On Tue, Mar 3, 2015 at 7:15 AM, Simon Charette  > wrote:
>
>> Can your seats be part of multiple trains?
>>
>> Is there a reason you defined a ManyToMany from Train to Seat instead of 
>> a ForeignKey from Seat to Train?
>>
>> If your schema was defined as the latter the following could probably 
>> work (given you only want the first Seat of each Train object):
>>
>> trains = 
>> Train.objects.prefetch_related(first_seats=Seat.objects.order_by('train', 
>> 'order').distinct('train'))
>> for train in trains:
>> first_seat = train.first_seats[0]
>>
>> Else given you've explicitly defined a TrainSeat model to handle the 
>> through relationship to store the order:
>>
>> class TrainSeat(models.Model):
>> train = models.ForeignKey(Train, related_name='train_seats')
>> seat = models.ForeignKey(Seat)
>> order = models.PositiveIntegerField()
>>
>> trains = 
>> Train.objects.prefetch_related(first_train_seats=Prefetch('train_seats', 
>> TrainSeat.objects.select_related('seat').order_by('train', 
>> 'order').distinct('train'))
>> for train in trains:
>> first_seat = train.first_train_seats[0].seat
>>
>> Hope it helps.
>>
>> Simon
>>
>> Le lundi 2 mars 2015 17:23:29 UTC-5, cool-RR a écrit :
>>>
>>> Hi,
>>>
>>> Say that I have a model Train and it has a ManyToMany to model Seat. I'm 
>>> looking at a queryset of Train and I want to do a prefetch_related on it, 
>>> but I don't want to get all the Seat objects; I want only the first Seat 
>>> object for each Train object.  Is this possible with prefetch_related 
>>> and/or Prefetch? How? 
>>>
>>> To clarify: My goal here is to save on querysets while still being able 
>>> to retrieve the first Seat object in each `train.seats`.
>>>
>>>
>>> Thanks,
>>> Ram.
>>>
>>  -- 
>> 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/-wwfdhi0qXU/unsubscribe.
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b3fcf574-9024-46f9-9499-c6e67d2e3a4b%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/26bf43c0-88e0-4b0a-b959-e52901aecc61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django CMS 3.0.12 Released!

2015-03-04 Thread Martin Koistinen
*Django CMS 3.0.12 Released!*

This quick-cycle release fixes a regression discovered by a user shortly 
after the release of 3.0.11.


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3697886e-ad7b-4515-8759-f440c4b16daf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


getting tuples from http request.GET

2015-03-04 Thread Sunil Sawant
Hi Guys,

Pretty new to Django, but used it blindly and works wonders. But here is a 
situation I am blocked at now for a new project

I request.GET the following URL

https://mydesktop.com/validator?hostname1=host1.example.com,location1=ca,ip1=2.2.2.2,hostname2=host2.example.com,location2=wa,ip2=3.3.3.3

Am using request.GET I want to get the output in a tuple or hash form as:

[{host1.example.com:[ca,2.2.2.2]},{host2.example.com:[wa,3.3.3.3]}]



Once I have this data I can process it further.
Please help





-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a6bd8dad-23fa-43f4-a3b2-c6cc8efafc7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Data migration using RunPython

2015-03-04 Thread Murthy Sandeep
I am working on a data migration for my Django app to populate
the main table in the db with data that will form the mainstay of
the app - this is persistent/permanent data that may added to but
never deleted.

My reference is the Django 1.7 documentation and in particular an
example on page

https://docs.djangoproject.com/en/1.7/ref/migration-operations/#django.db.migrations.operations.RunPython

with a custom method called forward_funcs:

def forwards_func(apps, schema_editor):

# We get the model from the versioned app registry;
# if we directly import it, it'll be the wrong version


Country = apps.get_model("myapp", "Country")
db_alias = schema_editor.connection.alias
Country.objects.using(db_alias).bulk_create([
Country(name="USA", code="us"),
Country(name="France", code="fr"),])

I was wondering if someone could please explain what is happening
here and how this method works - is the argument  to bulk_create a
list of namedtuple objects called Country or are these Country model
objects?

Also could someone please explain what db_alias is?

Sandeep


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79F2F719-8483-46A6-8DC2-94E6C937CAA8%40sandeepmurthy.is.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: File Upload, Download and Search Files

2015-03-04 Thread Vijay Khemlani
You can save files as part of models, for example using FileFields

https://docs.djangoproject.com/en/1.7/ref/models/fields/#filefield

Or you can handle them manually, for example using default_storage

https://docs.djangoproject.com/en/1.7/topics/files/

Regarding File Search, I don't know, never had to do that before.

On Mon, Mar 2, 2015 at 4:10 PM, New@Django  wrote:

> Hi!
>
> I am just starting to use Django. I would like to know if anyone could
> point me in the direction for having the following capability:
>
> - File Storage System (Upload, Download, Delete)
>
> - File Search
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/184fa1dc-b6d3-4b17-8f4e-dace66240c7f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1R4g5-nMr2cF98DYfJJrZdwtOs7yKDU1G1tSeBcshZmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django doesnt wait for my time.sleep

2015-03-04 Thread Vijay Khemlani
Also, why would matplotlib return without having finished its job?

On Wed, Mar 4, 2015 at 2:58 PM, Bill Freeman  wrote:

> Sleeping in a web server, which potentially has many users, is considered
> bad form, even if it works.  A better place for such time outs is in
> JavaScript in the browser.  Some designs use a view that the JavaScript (or
> user) can poll to determine when the resource is available.
>
> On Wed, Mar 4, 2015 at 12:03 PM, dk  wrote:
>
>> i am using matplotlib to generate a plot/graph,  even do that python is
>> generating the file and saving it so I can use it later on in my web page,
>> django show the page before the process finish,
>> so I decided to put a time.sleep(3)  so it wait 3 sec while all this
>> happen, but doesn't respect that =(
>>
>> any ideas why that might happen or a workaround?
>>
>> I usually get in my web page an old plot so I have to click refresh on
>> the page to get the new actual one =(.
>> thank.s
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/536faca6-2abb-4df6-b97d-414cc199e8d4%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAB%2BAj0tB_YaTxL1Q_daosy7MLXpfDsspWCtMX8zO8W%3DgALVFfA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei2N_Gnq2vHbPS6y2PER0amxSoBXH%2BOL6wz1Rb-C4KbrjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-04 Thread Andrew Farrell
One thing to keep in mind is that there are more fields using primarily
python than using primarily ruby. A company that that does primarily
scientific computing in python may not advertise jobs in Django or Flask.
However, when they need to build a web interface for something, they will
reach for Django or Flask and so familiarity with that is useful.

On Wed, Mar 4, 2015 at 4:55 PM, Javier Guerra Giraldez 
wrote:

> On Wed, Mar 4, 2015 at 5:40 PM, François Schiettecatte
>  wrote:
> > commit to learning a new one every couple of years (or more often if you
> can).
>
> this.
>
> even if I write Python as a requisite when hiring, I expect any new
> recruit to be able to pick languages as needed.  Of course, that
> doesn't mean we're jumping all around, just that the languages must be
> tools not barriers.
>
> --
> Javier
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFkDaoQxLm3s49B73%3D4g5zNQv65und0xvRS%3DgizDWWAw3MdVDQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2By5TLZ_zr198SnCVK-YSgxo_83n9RpViH%3DJA5jC1Sk4sN7WVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-04 Thread Javier Guerra Giraldez
On Wed, Mar 4, 2015 at 5:40 PM, François Schiettecatte
 wrote:
> commit to learning a new one every couple of years (or more often if you can).

this.

even if I write Python as a requisite when hiring, I expect any new
recruit to be able to pick languages as needed.  Of course, that
doesn't mean we're jumping all around, just that the languages must be
tools not barriers.

-- 
Javier

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoQxLm3s49B73%3D4g5zNQv65und0xvRS%3DgizDWWAw3MdVDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-04 Thread François Schiettecatte
If the question is What Do I Invest In? Then the answer is to learn enough 
tools to be able to develop a full stack (JavaScript, HTML, Django, Python, 
MySQL/Postgres/Other), and expect that you will be learning new things all the 
time. I picked Django because I settled for Python rather than Ruby when I 
wanted to move off of Perl (having done a lot of C and Java along the way). 
Learning Python not only opened up Django but also Flask (and a lot more 
besides), but I learned enough Ruby to able to develop with i. And what you use 
now may not be what you use in 5 years time. It is good to have two or three 
languages (not including JavaScript) under your belt and commit to learning a 
new one every couple of years (or more often if you can).

François

> On Mar 4, 2015, at 4:36 PM, Avraham Serour  wrote:
> 
> so what is the question?
> 
> On Tue, Mar 3, 2015 at 2:34 AM, Ismael Ezequiel  
> wrote:
> I'm confused what "framework" choice for web development, I love Python. as 
> is the future for Django, I spend a lot time studying Django. I see more jobs 
> for Ruby on Rails than Django :/
> 
> Sorry my english.
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/6515c506-3d18-40b4-814e-3df576e5c1e2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAFWa6t%2BGCTRVDR4100j7M0FpMVqaZZHN1Ay3x0m4sMVzQN06wA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/F823ED65-4E8A-4F88-BF0A-4F3E1A27E4AE%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixing a poorly written Django website (no unit tests)

2015-03-04 Thread Mike Dewhirst

On 4/03/2015 11:01 PM, Some Developer wrote:

Hi,

I've been working on a Django website for about 2 months on and off and
am nearing the end of development work where I can start thinking about
making it look pretty and the after that deploy to production.

I've been doing lots of manual testing and I'm sure that the website
works correctly but due to the need to get the website in production
ASAP and my lack of unit testing experience with Django (I'm still not
entirely sure what the point of unit testing a 2 or 3 line Django view
is when you can clearly see if it is correct or not) I've neglected
automated testing.

While I'm still going to go ahead and launch the site in production as
soon as it is deployed I want to go back and add in all the unit tests
that are missing. How would you tackle this problem?


Use Coverage. https://pypi.python.org/pypi/coverage/3.7.1

Best thing since sliced bread ...



Most of the code is pretty simple but there are ecommerce elements that
I have tested extensively by running my code through the Python
debugger. These must always work.

I'm a bit ashamed that it has got this far but I'm mainly a C developer
and unit testing isn't pushed quite so hard there (even though it should
be).

Any help 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F77F91.3080408%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Test, RunPython, Datamigrations with Django 1.7.5

2015-03-04 Thread sam
Well, answer is here: 
https://docs.djangoproject.com/en/1.7/topics/testing/overview/#rollback-emulation
Need to use serialized_rollback = True in TransactionTestCase

Le mercredi 4 mars 2015 18:24:34 UTC+1, sam a écrit :
>
> Hello, 
>
> I have an issue trying to run tests.
> My application use a migration to have default fixtures (created using 
> migrations.RunPython from a migration file). 
> The problem is when I launch manage.py test, the fixtures from the 
> migration are created on the "production" database and not on the test_* 
> database.
>
> Is there a way to solve this issue ? Is this a known issue or nobody has 
> this problem ?
>
> Here is the migration
>
> # -*- coding: utf-8 -*-
> from __future__ import unicode_literals
>
> from django.db import models, migrations
>
>
> def create_bars(apps, schema_editor):
> Bar = apps.get_model("foo", "Bar")
> db_alias = schema_editor.connection.alias
> Bar.objects.using(db_alias).bulk_create([
> Bar(label="AAA"),
> Bar(label="BBB")
> ])
>
> class Migration(migrations.Migration):
>
> dependencies = [
> ('foo', '0001_initial'),
> ]
>
> operations = [
> migrations.RunPython(create_bars),
> ]
>
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/71ae45b7-3f74-4e93-ae3c-0935da4c7742%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Future for Django, Jobs, Confused :/

2015-03-04 Thread Avraham Serour
so what is the question?

On Tue, Mar 3, 2015 at 2:34 AM, Ismael Ezequiel 
wrote:

> I'm confused what "framework" choice for web development, I love Python.
> as is the future for Django, I spend a lot time studying Django. I see more
> jobs for Ruby on Rails than Django :/
>
> Sorry my english.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6515c506-3d18-40b4-814e-3df576e5c1e2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6t%2BGCTRVDR4100j7M0FpMVqaZZHN1Ay3x0m4sMVzQN06wA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django CMS 3.0.11 Released!

2015-03-04 Thread Martin Koistinen
*Django CMS 3.0.11 Released!*

This is mostly a bug-fix release, but there's at least one very interesting 
thing added: better support for using the same application in multiple 
apphooks! Using this combined with aldryn-apphooks-config () you can use a 
single app in multiple places in your project, each with their own, 
independent configurations and even CMSAttachMenus.

Full release notes here: 
http://django-cms.readthedocs.org/en/3.0.11/upgrade/3.0.11.html

Many thanks to the community for posting issues, PRs and suggestions!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1621a250-3c95-411e-877e-b72ba5c0b956%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't run django!

2015-03-04 Thread Bill Blanchard
Can we see a sanitized version of your settings file?  My guess is there's
probably a typo in there somewhere.

On Mon, Mar 2, 2015 at 10:44 AM, David Zahedi  wrote:

> Hi there,
>
> I am using python 2.7 and django 1.75; when I run "manage.py runserver" I
> get the following error:
>
> CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
> An exception has occurred, use %tb to see the full traceback.
>
>
> My DEBUG is True.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ea41d3e8-4d93-4076-8df8-a099360d13aa%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP7uEDL%3D1oemnuqzF5N-rxV1ODMNhsq-wZGsw3g7KRcqvt-p9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Rolling back to practice on old bugs

2015-03-04 Thread Javis Sullivan
I am following this tutorial here 
 "Writing your 
first Django patch" and while it directs me to rollback to this 
39f5bc7fc3a4bb43ed8a1358b17fe0521a1a63ac 

 commit, 
when I do so I am not able to run the runtests.py script. I guess the 
directory structure or something has changed along the way, I assume. As I 
am getting the error below:

Traceback (most recent call last):
  File "runtests.py", line 327, in 
options.failfast, args)
  File "runtests.py", line 153, django_tests
state = setup(verbosity, test_labels)
  File "runtests.py", line 111, in setup
from django.db.models.loading import get_apps, load_app
ImportError: No module named 'django.db.models.loading'



I poked around to see if I could find the loadings module but it is not 
longer there. Should I just practice on a recent bug? Because runtests.py 
does fine when the git head is located at the most recent commit. 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5a06bb98-9194-4586-a323-101e730d2f8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prefetching a single item

2015-03-04 Thread Ram Rachum
Thanks Simon! That worked.

I would say it's a bit devious though, and it was nice if there was a
method that didn't use `distinct`, which has its own issues. (And can't be
used for any number of items other than 1 in this case.)

On Tue, Mar 3, 2015 at 7:15 AM, Simon Charette  wrote:

> Can your seats be part of multiple trains?
>
> Is there a reason you defined a ManyToMany from Train to Seat instead of a
> ForeignKey from Seat to Train?
>
> If your schema was defined as the latter the following could probably work
> (given you only want the first Seat of each Train object):
>
> trains =
> Train.objects.prefetch_related(first_seats=Seat.objects.order_by('train',
> 'order').distinct('train'))
> for train in trains:
> first_seat = train.first_seats[0]
>
> Else given you've explicitly defined a TrainSeat model to handle the
> through relationship to store the order:
>
> class TrainSeat(models.Model):
> train = models.ForeignKey(Train, related_name='train_seats')
> seat = models.ForeignKey(Seat)
> order = models.PositiveIntegerField()
>
> trains =
> Train.objects.prefetch_related(first_train_seats=Prefetch('train_seats',
> TrainSeat.objects.select_related('seat').order_by('train',
> 'order').distinct('train'))
> for train in trains:
> first_seat = train.first_train_seats[0].seat
>
> Hope it helps.
>
> Simon
>
> Le lundi 2 mars 2015 17:23:29 UTC-5, cool-RR a écrit :
>>
>> Hi,
>>
>> Say that I have a model Train and it has a ManyToMany to model Seat. I'm
>> looking at a queryset of Train and I want to do a prefetch_related on it,
>> but I don't want to get all the Seat objects; I want only the first Seat
>> object for each Train object.  Is this possible with prefetch_related
>> and/or Prefetch? How?
>>
>> To clarify: My goal here is to save on querysets while still being able
>> to retrieve the first Seat object in each `train.seats`.
>>
>>
>> Thanks,
>> Ram.
>>
>  --
> 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/-wwfdhi0qXU/unsubscribe.
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b3fcf574-9024-46f9-9499-c6e67d2e3a4b%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANXboVbDj%2B0tqufFoj37aZ8m%3Do59y6%2BM2vxT%3DQxEWRvTAL403Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [1.7] Django Admin - Secondary, extended user-admin

2015-03-04 Thread Thomas Rega
https://github.com/jpulgarin/django-tokenapi ?

2015-03-02 17:47 GMT+01:00 Flemming Hansen :
> Hi all,
>
> I need to set up a passwordless login system using tokens, and I need to
> manage it from the admin backend.
>
> Simplified, the tokens need to be set for a user (one user, one authenticate
> token, many authorize tokens).
> In the site admin interface I need "User tokens" to be its own "ModelAdmin",
> that is, in addition to the default "Users"-admin section, I need a "User
> tokens"-admin section.
>
> My problem is how to do this?
>
> Any suggestions welcome.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b920c6e9-14fa-403e-85f4-ffde34af7501%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFgu0xjkCKon-jSHLVfACTbxqou4Z4-2U4YJgfvJZ3v%3D9pi1Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't run django!

2015-03-04 Thread Andrew Farrell
You might see if DEBUG is being set to False in an unexpected location by
using the silver searcher  (also on windows
)
to quickly search for a string in a directory tree.

$ ag DEBUG

within your app should tell you all of the places it is being set.

On Mon, Mar 2, 2015 at 9:44 AM, David Zahedi  wrote:

> Hi there,
>
> I am using python 2.7 and django 1.75; when I run "manage.py runserver" I
> get the following error:
>
> CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
> An exception has occurred, use %tb to see the full traceback.
>
>
> My DEBUG is True.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ea41d3e8-4d93-4076-8df8-a099360d13aa%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2By5TLaXtgX14F%3DTov%2BY%3Du3ut0W-B9TNv4bTqJZA3EmKVR97cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't run django!

2015-03-04 Thread James Schneider
Is there a possibility of having more than one settings file? If so, ensure
that your manage.py is pointing at the right settings file. The output of
'manage.py runserver' should also show the dotted path of the settings file
that it is using just before that error is displayed (I believe).

You can also verify that your DEBUG value is being correctly parsed by
running 'manage.py diffsettings'. One of the lines of output should be
'DEBUG = True' since DEBUG defaults to False. If it isn't there, then your
DEBUG setting is somehow set to True (or may be missing from your
settings.py file). If you are on a Linux host shell, you can run 'python
manage.py diffsettings | grep DEBUG' to filter the lines containing DEBUG
or on Windows 'manage.py diffsettings | find "DEBUG" '.

-James

On Mon, Mar 2, 2015 at 7:44 AM, David Zahedi  wrote:

> Hi there,
>
> I am using python 2.7 and django 1.75; when I run "manage.py runserver" I
> get the following error:
>
> CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
> An exception has occurred, use %tb to see the full traceback.
>
>
> My DEBUG is True.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ea41d3e8-4d93-4076-8df8-a099360d13aa%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXjYa_4bdETK4PYFRKvhbo9zXoq9%3D3uzP%3DkcRxpX0Acvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom lookup field for text comparison in Django 1.6

2015-03-04 Thread Simon Charette
Hi Jorgue,

As you already know there's no officially supported API to create custom 
lookups in Django < 1.7

However it's possible to get something working by monkey patching 
WhereNode.make_atom.

Here's an example GIST 
 that expose a 
decent API to add custom lookups.

>From importing the lookups module you should be able to register your 
custom lookup this way:

def db_prepare_customcomparison(value, connection, prepared):
return [value.replace(' ', '').lower()]

lookups.register(
'customcomparison',
'replace(lower(%s), " ", "") = %%s',
db_prepare=db_prepare_customcomparison,
)

Note that you should use this code at your own risk since it's messing with 
Django's internal and I would strongly advise you to move to 1.7 instead 
since 1.6 is approaching end of support.

Simon

Le mercredi 4 mars 2015 14:15:32 UTC-5, Jorge Arévalo a écrit :
>
> Hello,
>
> I'm trying to emulate a non-spaces-all-lower text comparison filter in 
> Django 1.6.x. In other words, I want the equivalent to this query
>
> select * from myapp_mymodel where replace(lower(str), " ", "") = 
> ''
> Being my model something like this
>
> from django.db import models
> class MyModel(models.Model):
> num = models.IntegerField()
> str = models.CharField(max_length=16)
>
>
> In my mind, this can be implemented with a custom lookup like this:
>
> MyModel.objects.filter(str__customcomparison='spaces and UPPERCASE will 
> not be taken into account')
>
> I know Django 1.7 allows custom lookups creation, but can't make Django 
> 1.6 work like this. I've tried implementing a custom QuerySet and a custom 
> Manager for MyModel. In the custom QuerySet, I override the method 
> _filter_or_exclude. 
>
> Am I in the right path? Any suggestion?
>
> Many 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/931f930b-01c2-48c7-a760-63cb51052781%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Daniel França
... And you can compare
On Wed 4 Mar 2015 at 20:33 Daniel França  wrote:

> 4. Have you tried https://www.djangopackages.com/ ?
> It has some sections with grids that shows several information about each
> one
> On Wed 4 Mar 2015 at 20:30 Avraham Serour  wrote:
>
>> 1 -  built in
>> 2 - buit in
>> 3 - I like all-auth
>> 4 - pypi
>> 5 - go for python 3, unless you need some library that only supports
>> python 2
>> always use the last minor version of django, keep an eye for django 1.8
>> it should be out soon
>>
>> On Wed, Mar 4, 2015 at 6:10 AM, Jatin Ganhotra 
>> wrote:
>>
>>> Hi, I have done web development with Ruby on Rails and now I'm learning
>>> to use Django for a web application, where I facing some issues finding the
>>> best libraries/ packages available.
>>>
>>> What are the best packages/apps in Django available for the following:
>>>
>>> 1. User authentication - Rails offers Devise which provides all
>>> authentication out-of-the-box, such as sign up/ sign-in/ forgot password
>>> emails / sending activation emails / web-http authentication etc. What's
>>> the best one for Django?
>>>
>>> 2. User authorization - Rails offers Cancan, where using a simple
>>> declarative syntax, you can assign read/modify permissions to various
>>> methods for administrators/ users etc. What's the best one for Django?
>>>
>>> 3. Facebook sign-up - I found django-facebook and python-social-auth as
>>> the 2 major packages out there, but I'm not sure which one is the better?
>>> Is there any other better package out there that I couldn't find? Or which
>>> one of the 2 is better?
>>>
>>> 4. Listing of all available & best packages - I searched through the
>>> available packages listing, but they are not ordered based on # of active
>>> users or most popular package etc. So, I have to sift through all of them.
>>> Does Django have a listing similar to ruby-toolbox for Ruby & Rails
>>> packages?
>>>
>>> 5. Django and Python version - Should I use Python 3 or Python 2 would
>>> be fine? Better question - Should I use Django 1.7 or latest version 1.7.5?
>>> Are the changes in the latest version considerable enough to start using
>>> 1.7.5?
>>>
>>> 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.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/1deb975e-7edb-4f5a-bfa7-9b9e3ffe455f%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> 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.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAFWa6tLgkJdwwCZ0R0DPpraAVNwnu5zsB3hkwJsDSEud2QvJ%2Bg%
>> 40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACPst9KS8usRc6%2Bog9uGdp%2BtC51jkG072D33wR4pqPc9OBn3fQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Daniel França
4. Have you tried https://www.djangopackages.com/ ?
It has some sections with grids that shows several information about each
one
On Wed 4 Mar 2015 at 20:30 Avraham Serour  wrote:

> 1 -  built in
> 2 - buit in
> 3 - I like all-auth
> 4 - pypi
> 5 - go for python 3, unless you need some library that only supports
> python 2
> always use the last minor version of django, keep an eye for django 1.8 it
> should be out soon
>
> On Wed, Mar 4, 2015 at 6:10 AM, Jatin Ganhotra 
> wrote:
>
>> Hi, I have done web development with Ruby on Rails and now I'm learning
>> to use Django for a web application, where I facing some issues finding the
>> best libraries/ packages available.
>>
>> What are the best packages/apps in Django available for the following:
>>
>> 1. User authentication - Rails offers Devise which provides all
>> authentication out-of-the-box, such as sign up/ sign-in/ forgot password
>> emails / sending activation emails / web-http authentication etc. What's
>> the best one for Django?
>>
>> 2. User authorization - Rails offers Cancan, where using a simple
>> declarative syntax, you can assign read/modify permissions to various
>> methods for administrators/ users etc. What's the best one for Django?
>>
>> 3. Facebook sign-up - I found django-facebook and python-social-auth as
>> the 2 major packages out there, but I'm not sure which one is the better?
>> Is there any other better package out there that I couldn't find? Or which
>> one of the 2 is better?
>>
>> 4. Listing of all available & best packages - I searched through the
>> available packages listing, but they are not ordered based on # of active
>> users or most popular package etc. So, I have to sift through all of them.
>> Does Django have a listing similar to ruby-toolbox for Ruby & Rails
>> packages?
>>
>> 5. Django and Python version - Should I use Python 3 or Python 2 would be
>> fine? Better question - Should I use Django 1.7 or latest version 1.7.5?
>> Are the changes in the latest version considerable enough to start using
>> 1.7.5?
>>
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/1deb975e-7edb-4f5a-bfa7-9b9e3ffe455f%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWa6tLgkJdwwCZ0R0DPpraAVNwnu5zsB3hkwJsDSEud2QvJ%2Bg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACPst9JwksuW7%3DCox%3Dj0FrgMqQ755ytbp5S%3DMtFVpZCfMbP%2BTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Avraham Serour
1 -  built in
2 - buit in
3 - I like all-auth
4 - pypi
5 - go for python 3, unless you need some library that only supports python
2
always use the last minor version of django, keep an eye for django 1.8 it
should be out soon

On Wed, Mar 4, 2015 at 6:10 AM, Jatin Ganhotra 
wrote:

> Hi, I have done web development with Ruby on Rails and now I'm learning to
> use Django for a web application, where I facing some issues finding the
> best libraries/ packages available.
>
> What are the best packages/apps in Django available for the following:
>
> 1. User authentication - Rails offers Devise which provides all
> authentication out-of-the-box, such as sign up/ sign-in/ forgot password
> emails / sending activation emails / web-http authentication etc. What's
> the best one for Django?
>
> 2. User authorization - Rails offers Cancan, where using a simple
> declarative syntax, you can assign read/modify permissions to various
> methods for administrators/ users etc. What's the best one for Django?
>
> 3. Facebook sign-up - I found django-facebook and python-social-auth as
> the 2 major packages out there, but I'm not sure which one is the better?
> Is there any other better package out there that I couldn't find? Or which
> one of the 2 is better?
>
> 4. Listing of all available & best packages - I searched through the
> available packages listing, but they are not ordered based on # of active
> users or most popular package etc. So, I have to sift through all of them.
> Does Django have a listing similar to ruby-toolbox for Ruby & Rails
> packages?
>
> 5. Django and Python version - Should I use Python 3 or Python 2 would be
> fine? Better question - Should I use Django 1.7 or latest version 1.7.5?
> Are the changes in the latest version considerable enough to start using
> 1.7.5?
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1deb975e-7edb-4f5a-bfa7-9b9e3ffe455f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tLgkJdwwCZ0R0DPpraAVNwnu5zsB3hkwJsDSEud2QvJ%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Andreas Kuhne
Hi,

I'll give you answers to the questions I know, the others you'll have to
wait for others more knowledgable.

1. User authentication, django has django.contrib.auth built in. Checkout
https://docs.djangoproject.com/en/1.7/topics/auth/
2. User authorization, also in the auth package. You can customize it any
way you want.
3-4: Don't know. I usually go for the packages that are currently still
being developed. Also django specific versions are usually easier to
integrate than a python version.
5. You should ALWAYS use the latest released version if you are running in
production. The minor version upgrades usually don't break anything when
upgrading, however going from 1.7 to 1.8 can change somethings and can be a
handful. Also, if possible I would go for python 3. HOWEVER having said
that, sometimes some of the pip packages that you want to run won't work,
so you'll have to check if the packages you want to use are python 3
compatible. More and more packages are ok nowadays, so it would be worth
trying to use python 3.

Regards,

Andréas

2015-03-04 5:10 GMT+01:00 Jatin Ganhotra :

> Hi, I have done web development with Ruby on Rails and now I'm learning to
> use Django for a web application, where I facing some issues finding the
> best libraries/ packages available.
>
> What are the best packages/apps in Django available for the following:
>
> 1. User authentication - Rails offers Devise which provides all
> authentication out-of-the-box, such as sign up/ sign-in/ forgot password
> emails / sending activation emails / web-http authentication etc. What's
> the best one for Django?
>
> 2. User authorization - Rails offers Cancan, where using a simple
> declarative syntax, you can assign read/modify permissions to various
> methods for administrators/ users etc. What's the best one for Django?
>
> 3. Facebook sign-up - I found django-facebook and python-social-auth as
> the 2 major packages out there, but I'm not sure which one is the better?
> Is there any other better package out there that I couldn't find? Or which
> one of the 2 is better?
>
> 4. Listing of all available & best packages - I searched through the
> available packages listing, but they are not ordered based on # of active
> users or most popular package etc. So, I have to sift through all of them.
> Does Django have a listing similar to ruby-toolbox for Ruby & Rails
> packages?
>
> 5. Django and Python version - Should I use Python 3 or Python 2 would be
> fine? Better question - Should I use Django 1.7 or latest version 1.7.5?
> Are the changes in the latest version considerable enough to start using
> 1.7.5?
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1deb975e-7edb-4f5a-bfa7-9b9e3ffe455f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbkVvppRV47VM6tunFwWv9oj8JbRVr-PwEQLk%3Diwi1D4hA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Jatin Ganhotra
Hi, I have done web development with Ruby on Rails and now I'm learning to 
use Django for a web application, where I facing some issues finding the 
best libraries/ packages available.

What are the best packages/apps in Django available for the following:

1. User authentication - Rails offers Devise which provides all 
authentication out-of-the-box, such as sign up/ sign-in/ forgot password 
emails / sending activation emails / web-http authentication etc. What's 
the best one for Django?

2. User authorization - Rails offers Cancan, where using a simple 
declarative syntax, you can assign read/modify permissions to various 
methods for administrators/ users etc. What's the best one for Django?

3. Facebook sign-up - I found django-facebook and python-social-auth as the 
2 major packages out there, but I'm not sure which one is the better? Is 
there any other better package out there that I couldn't find? Or which one 
of the 2 is better?

4. Listing of all available & best packages - I searched through the 
available packages listing, but they are not ordered based on # of active 
users or most popular package etc. So, I have to sift through all of them. 
Does Django have a listing similar to ruby-toolbox for Ruby & Rails 
packages?

5. Django and Python version - Should I use Python 3 or Python 2 would be 
fine? Better question - Should I use Django 1.7 or latest version 1.7.5? 
Are the changes in the latest version considerable enough to start using 
1.7.5?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1deb975e-7edb-4f5a-bfa7-9b9e3ffe455f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.7 tutorial part 4, url

2015-03-04 Thread Daniel Altschuler
I ran into the following problem with the tutorial.

When I'm at http://127.0.0.1:8000/polls/1/, I get the expected page:

What's up? Not much
 The sky


However when I try to vote I get the error 

Page not found (404)Request Method:POSTRequest URL:
http://127.0.0.1:8000/polls/1/vote/

No Question matches the given query.

You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.

After some time I found that something is wrong with the urls. My 
polls/urls.py file was:

-
from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
# ex: /polls/
url(r'^$', views.index, name='index'),
# ex: /polls/5/
url(r'^(?P\d+)/$', views.detail, name='detail'),

url(r'^(?P\S+)/$', views.search, name='search'),
# ex: /polls/5/results/
url(r'^(?P\d+)/results/$', views.results, name='results'),
# ex: /polls/5/vote/
url(r'^(?P\d+)/vote/$', views.vote, name='vote'),
)
--

If I remove the "/" after "vote", then everything works. I had the same 
error when attempting to view the results, so I also
removed the "/" after results. My urls.py now looks like

...
# ex: /polls/5/results
url(r'^(?P\d+)/results$', views.results, name='results'),
# ex: /polls/5/vote
url(r'^(?P\d+)/vote$', views.vote, name='vote'),
   ...

Can someone explain me what is going on? thanks.

Note that the file mysite/urls.py is:

--
from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
# ex: /polls/
url(r'^$', views.index, name='index'),
# ex: /polls/5/
url(r'^(?P\d+)/$', views.detail, name='detail'),

url(r'^(?P\S+)/$', views.search, name='search'),
# ex: /polls/5/results
url(r'^(?P\d+)/results$', views.results, name='results'),
# ex: /polls/5/vote
url(r'^(?P\d+)/vote$', views.vote, name='vote'),
)


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f7a2a12-0e14-48a6-a70a-358deb5f7899%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form In modal

2015-03-04 Thread luis zarate
Fast solution:
In Javascritp you can do this:

element = document.getElementById("myinput");
window.open("http://127.0.0.1:8000/consulta/?consulta="+element.value,
"MsgWindow", "width=200, height=100");


but continue reading


Are you use ajax?
If the answer is not, then see https://github.com/yceruto/django-ajax.

A concept problem is there, modal is a interface view (in the browser) and
your method refresh the page (It is a GET Request).

I don't know what kind of framework you are using, but in general you can
do something like this:



Operadora  Tipo
CLAROMOVEL



$("#mymodal").modal();




for more information see
http://getbootstrap.com/javascript/#modals
http://jqueryui.com/dialog/

PD: You can do better implementation if you are using django ajax



2015-02-26 13:08 GMT-06:00 Emerson Luiz :

> Hi,
>
> I have the following problem:
>
> I need to set up a form, that when the OK button is clicked, it passes a
> parameter and open a modal with the result.
> Today the query works as follows:
>
> http://127.0.0.1:8000/consulta/?consulta=31
>
> The 31 is the parameter.
>
> return:
>
> Operadora  TipoCLAROMOVEL
>
>
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9f8e5cbb-45a0-464d-9047-6ccfdc0a4757%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyMbtAjJH30MYDMe4S1M%2Bdfo7w7gGB8SSc%3DrJBqaZFxaNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


File Upload, Download and Search Files

2015-03-04 Thread New@Django
Hi!

I am just starting to use Django. I would like to know if anyone could 
point me in the direction for having the following capability:

- File Storage System (Upload, Download, Delete)

- File Search

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/184fa1dc-b6d3-4b17-8f4e-dace66240c7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using proxy kind of Table in Admin Interface

2015-03-04 Thread luis zarate
Maybe you can use get_queryset in the admin class and replace the query
manager

ref:
https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_queryset

https://docs.djangoproject.com/en/1.7/topics/db/managers/

you can do something like this:

def get_queryset(self, request):
"""
Returns a QuerySet of all model instances that can be edited by the
admin site. This is used by changelist_view.
"""
if request.user.is_superuser:
qs = self.model.superuser_manager.get_queryset()
else:
qs = self.model._default_manager.get_queryset()

ordering = self.get_ordering(request)
if ordering:
qs = qs.order_by(*ordering)
return qs

2015-03-01 17:06 GMT-06:00 Rootz :

> Question.
> How would one go about designing the django table(s) so that I can assign
> each user account/group a different Model Manager using the same table in
> the Django admin interface?
>
> After doing some reading the closest that comes to this is the Proxy Model
> but I tried adding the proxy model manually into the django admin and got
> an error while loading it.
>
> My goal is to create one table that returns a custom QuerySet unique to a
> user group or user account. Adding to this I would like for this to be
> visible in the admin interface. Can you guide me as to how can achieve this.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cd13f5ab-633e-4361-a621-cfc11d5d01a5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyNCYpSs0quBUVPSiTgUsApP9tD_F0JwnwLxwiuSpyM8nQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django(1.7) admin - separate user-profile section

2015-03-04 Thread Flemming Hansen
Hi all,

I need to make a `passwordless` token system, and want to have a "Home › 
Passwordless › User tokens" in the Admin section. For the "User tokens" 
`list_display` I need all the "Users". (I do _not_ want to display the 
token information on the regular "User"-admin as just an extended 
"profile".) 

Any ideas on how to go about doing this?

So far I have this skeleton in `passwordless/model.py`, but I probably need 
some magic in `passwordless/admin.py` to list all the users with links to a 
custom token-manager form with custom widgets (create-token button, delete 
token button etc)...

from django.db import models
import jwt

class UserTokens(models.Model):
class Meta:
verbose_name = "User tokens"
verbose_name_plural = "User tokens"

user = models.OneToOneField(User)


class TokenBase(models.Model):
class Meta:
abstract = True

token = models.CharField(max_length=1000)
created_ts = models.DateTimeField('Date created')
expires_ts = models.DateTimeField('Date expired')

def __str__(self):
return self.user.email


class AuthenticateToken(TokenBase):
manager = models.OneToOneField(UserTokens)

def validate(self, token):
pass


class AuthorizeToken(TokenBase):   
manager = models.ForeignKey(UserTokens)
revoked_ts = models.DateTimeField('Date revoked')

def validate(self, token):
pass  


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a5bd42c5-bb3d-4a84-a50d-2d24fb5b0261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Populating Django app db with JSON data

2015-03-04 Thread Murthy Sandeep
Hi

thanks for the info.

The docs also say that RunPython runs “custom Python code
in a historical context”.  What does that mean exactly?  It seems
related to the apps and schema_editor arguments passed to
the custom method that will be called by RunPython - is this something
like a snapshot of the app model that is stored when I do `python manage.py 
migrate`?

Sandeep


> On 2 Mar 2015, at 19:37, aRkadeFR  wrote:
> 
> Hello,
> 
> Indeed, the data migration is the best way. Check out
> the documentation here:
> https://docs.djangoproject.com/en/1.7/ref/migration-operations/#django.db.migrations.operations.RunPython
> 
> You write your function that will be called by the RunPython
> and will load your JSON.
> Migration are ordered, your first migration will create the
> tables and the second (your data migration) will load your
> JSON.
> 
> To create an empty migration:
> ./manage.py makemigrations  --empty
> 
> You can rename to a useful descriptive name the migration
> file.
> 
> Have a good one
> 
> 
> On 03/02/2015 08:16 AM, Sandeep Murthy wrote:
>> Hi
>> 
>> I've tried to get the answer to this question (which is a bit open-ended) on 
>> stackoverflow without much success, which
>> is basically this: what is the recommended approach to populating a 
>> pre-existing Django app database table (generated
>> from a model and which is currently empty) with JSON data?
>> 
>> There seem to be several alternatives given in the Django documentation 
>> (Django 1.7 manual) which include (1) fixtures,
>> (2) SQL scripts, (3) data migrations.  Of these I am a bit confused by the 
>> advice in the manual which suggests that (1)
>> and (2) are only useful for loading initial data.  That's not what I want to 
>> do.  The data that the app needs is going to be
>> persistent and permanent because the app is intended to be a web query tool 
>> for a large dataset that is currently in the
>> form of several JSON files, each containing on average thousands of JSON 
>> objects, each object representing an entry
>> corresponding to a table entry in a relational db.  The data is not going to 
>> be re-loaded or change after entry, and there
>> is no user facility for changing the data.
>> 
>> The table has been created using the makemigrations and migrate tools, but 
>> is empty.  I just need to populate the
>> table with the JSON data.  It seems that I need to write a custom data 
>> migration script that will insert the data into the
>> table via the interpreter, and then I need to run python manage.py migrate.  
>> Is this the case, and if so, are there
>> are examples that I could use?
>> 
>> Thanks in advance for any suggestions.
>> 
>> SM
>> --
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/db5919c5-ace4-4556-b90e-aa47baa26552%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/54F42164.6040505%40arkade.info.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/279E5DB5-57C9-4A85-9EDA-3A9159BE8925%40sandeepmurthy.is.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Future for Django, Jobs, Confused :/

2015-03-04 Thread Ismael Ezequiel
I'm confused what "framework" choice for web development, I love Python. as 
is the future for Django, I spend a lot time studying Django. I see more 
jobs for Ruby on Rails than Django :/

Sorry my english.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6515c506-3d18-40b4-814e-3df576e5c1e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can't run django!

2015-03-04 Thread David Zahedi
Hi there, 

I am using python 2.7 and django 1.75; when I run "manage.py runserver" I 
get the following error: 

CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
An exception has occurred, use %tb to see the full traceback.


My DEBUG is True. 

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ea41d3e8-4d93-4076-8df8-a099360d13aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[1.7] Django Admin - Secondary, extended user-admin

2015-03-04 Thread Flemming Hansen
Hi all,

I need to set up a passwordless login system using tokens, and I need to 
manage it from the admin backend.

Simplified, the tokens need to be set for a user (one user, one 
authenticate token, many authorize tokens).
In the site admin interface I need "User tokens" to be its own 
"ModelAdmin", that is, in addition to the default "Users"-admin section, I 
need a "User tokens"-admin section.

My problem is how to do this?

Any suggestions welcome.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b920c6e9-14fa-403e-85f4-ffde34af7501%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom lookup field for text comparison in Django 1.6

2015-03-04 Thread Jorge Arévalo
Hello,

I'm trying to emulate a non-spaces-all-lower text comparison filter in 
Django 1.6.x. In other words, I want the equivalent to this query

select * from myapp_mymodel where replace(lower(str), " ", "") = 
''
Being my model something like this

from django.db import models
class MyModel(models.Model):
num = models.IntegerField()
str = models.CharField(max_length=16)


In my mind, this can be implemented with a custom lookup like this:

MyModel.objects.filter(str__customcomparison='spaces and UPPERCASE will not 
be taken into account')

I know Django 1.7 allows custom lookups creation, but can't make Django 1.6 
work like this. I've tried implementing a custom QuerySet and a custom 
Manager for MyModel. In the custom QuerySet, I override the method 
_filter_or_exclude. 

Am I in the right path? Any suggestion?

Many 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/041d82a9-531d-4817-a66d-5326f7996d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Free Django Video Tutorials

2015-03-04 Thread Deep Sukhwani
Thanks Mike,

Just starting with introduction tutorials.

Very helpful..

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f3170e26-3e81-4eed-a01e-1559258ce3a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django doesnt wait for my time.sleep

2015-03-04 Thread Bill Freeman
Sleeping in a web server, which potentially has many users, is considered
bad form, even if it works.  A better place for such time outs is in
JavaScript in the browser.  Some designs use a view that the JavaScript (or
user) can poll to determine when the resource is available.

On Wed, Mar 4, 2015 at 12:03 PM, dk  wrote:

> i am using matplotlib to generate a plot/graph,  even do that python is
> generating the file and saving it so I can use it later on in my web page,
> django show the page before the process finish,
> so I decided to put a time.sleep(3)  so it wait 3 sec while all this
> happen, but doesn't respect that =(
>
> any ideas why that might happen or a workaround?
>
> I usually get in my web page an old plot so I have to click refresh on the
> page to get the new actual one =(.
> thank.s
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/536faca6-2abb-4df6-b97d-414cc199e8d4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0tB_YaTxL1Q_daosy7MLXpfDsspWCtMX8zO8W%3DgALVFfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django doesnt wait for my time.sleep

2015-03-04 Thread Erik Cederstrand

> Den 04/03/2015 kl. 18.03 skrev dk :
> 
> i am using matplotlib to generate a plot/graph,  even do that python is 
> generating the file and saving it so I can use it later on in my web page, 
> django show the page before the process finish,
> so I decided to put a time.sleep(3)  so it wait 3 sec while all this happen, 
> but doesn't respect that =(
> 
> any ideas why that might happen or a workaround?  

Please post the relevant code. Without that, it's really just quesswork.

Erik

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1D63985E-0B2B-4D2E-B25C-8C347349%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Test, RunPython, Datamigrations with Django 1.7.5

2015-03-04 Thread sam
Hello, 

I have an issue trying to run tests.
My application use a migration to have default fixtures (created using 
migrations.RunPython from a migration file). 
The problem is when I launch manage.py test, the fixtures from the 
migration are created on the "production" database and not on the test_* 
database.

Is there a way to solve this issue ? Is this a known issue or nobody has 
this problem ?

Here is the migration

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


def create_bars(apps, schema_editor):
Bar = apps.get_model("foo", "Bar")
db_alias = schema_editor.connection.alias
Bar.objects.using(db_alias).bulk_create([
Bar(label="AAA"),
Bar(label="BBB")
])

class Migration(migrations.Migration):

dependencies = [
('foo', '0001_initial'),
]

operations = [
migrations.RunPython(create_bars),
]


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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/748acda0-18dc-45e8-b79b-923b394d80dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django doesnt wait for my time.sleep

2015-03-04 Thread dk
i am using matplotlib to generate a plot/graph,  even do that python is 
generating the file and saving it so I can use it later on in my web page, 
django show the page before the process finish, 
so I decided to put a time.sleep(3)  so it wait 3 sec while all this 
happen, but doesn't respect that =(

any ideas why that might happen or a workaround?   

I usually get in my web page an old plot so I have to click refresh on the 
page to get the new actual one =(.
thank.s

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/536faca6-2abb-4df6-b97d-414cc199e8d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fatal Error in initializing sys standard streams

2015-03-04 Thread sriraag paawan

Hello Guys,

I am new to Django.. i am using Django 1.7.4 and Python 3.4

I was about to complete Django tutorial part-5 about tests but a Fatal 
Error caused me trouble.. I am attaching an image file which contains 
detail view of my problem... Please anyone could figure it out and solve 
it..

Thank You in Advance

<https://lh3.googleusercontent.com/-AWF1e83nc44/VPcufVnO7FI/AW4/jcPR86p02ZA/s1600/capture-20150304-213134.png>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0db0b5e6-2943-4277-9e40-cc91633f1719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixing a poorly written Django website (no unit tests)

2015-03-04 Thread Dan Gentry
No need to test the Django provided logic, but I like to write a few tests 
for each view that check the permissions, urls, updates, etc.  More of a 
functional test than a unit test.  I find that when these tests fail it is 
usually something changed somewhere else in the app.  For example, a change 
to a model that alters validation of an update.

In the case of your ecommerce code, complete tests can make your process of 
testing much faster compared to manual debugging work, plus they will test 
all areas of the code the same way every time.  Less chance for omission or 
error.  Confidence in the code goes up.

On Wednesday, March 4, 2015 at 7:03:14 AM UTC-5, Some Developer wrote:
>
> Hi, 
>
> I've been working on a Django website for about 2 months on and off and 
> am nearing the end of development work where I can start thinking about 
> making it look pretty and the after that deploy to production. 
>
> I've been doing lots of manual testing and I'm sure that the website 
> works correctly but due to the need to get the website in production 
> ASAP and my lack of unit testing experience with Django (I'm still not 
> entirely sure what the point of unit testing a 2 or 3 line Django view 
> is when you can clearly see if it is correct or not) I've neglected 
> automated testing. 
>
> While I'm still going to go ahead and launch the site in production as 
> soon as it is deployed I want to go back and add in all the unit tests 
> that are missing. How would you tackle this problem? 
>
> Most of the code is pretty simple but there are ecommerce elements that 
> I have tested extensively by running my code through the Python 
> debugger. These must always work. 
>
> I'm a bit ashamed that it has got this far but I'm mainly a C developer 
> and unit testing isn't pushed quite so hard there (even though it should 
> be). 
>
> Any help 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bcfa95ac-8116-427d-bad0-25dc535161b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to deal with not translated strings in html

2015-03-04 Thread Jaap van Wingerde
Op 2015-03-03T17:41:21 UTC schreef Jaap van Wingerde
 in the message ,
mid:20150303174121.024af...@jaap.custard.shrl.nl the following text. 

> ../locale/en/LC_MESSAGES/django.po:
> 
> ...
> #: template.html:4
> msgid "jaar"
> msgstr "year"
> 
> #: templates.html:4
> msgid "maand"
> msgstr ""
> ...
> 
> ../templates/template.html:
> 
> {% load i18n %} lang="{{ LANGUAGE_CODE }}">
> ...
> {% trans "jaar" %}{% trans "maand" %}
> ...
> 
> resulting html:
> 
>  lang="en">
> ...
> yearmaand
> ...
> 
> better html:
> 
>  lang="en">
> ...
> yearmaand
> ...
> 
> How can i get the better html?

A solution with handwork:
 
#: templates.html:4
msgid "maand"
msgstr "maand"

Can this be done automagical?



-- 

Jaap van Wingerde
e-mail: 1234567...@vanwingerde.nl

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150304145226.0615f5ff%40jaap.custard.shrl.nl.
For more options, visit https://groups.google.com/d/optout.


pgp5fhGuyf4YR.pgp
Description: OpenPGP digital signature


Re: Fixing a poorly written Django website (no unit tests)

2015-03-04 Thread Avraham Serour
Manual testing takes time and are prone to errors because they are done by
humans, automatic testing means that when changing something in the code
you can just run the tests, you don't need to run the server, open the
browser, click, click and see if something seems out of order, then open
the js console to see if it throws any error, then add some console.log,
then remove them and so on...

It is actually hard to understand why you would need testing for something
small, but as with every project, you'll need to add features and the code
will grow slowly with time, before you realize you already have something
big

On Wed, Mar 4, 2015 at 2:01 PM, Some Developer 
wrote:

> Hi,
>
> I've been working on a Django website for about 2 months on and off and am
> nearing the end of development work where I can start thinking about making
> it look pretty and the after that deploy to production.
>
> I've been doing lots of manual testing and I'm sure that the website works
> correctly but due to the need to get the website in production ASAP and my
> lack of unit testing experience with Django (I'm still not entirely sure
> what the point of unit testing a 2 or 3 line Django view is when you can
> clearly see if it is correct or not) I've neglected automated testing.
>
> While I'm still going to go ahead and launch the site in production as
> soon as it is deployed I want to go back and add in all the unit tests that
> are missing. How would you tackle this problem?
>
> Most of the code is pretty simple but there are ecommerce elements that I
> have tested extensively by running my code through the Python debugger.
> These must always work.
>
> I'm a bit ashamed that it has got this far but I'm mainly a C developer
> and unit testing isn't pushed quite so hard there (even though it should
> be).
>
> Any help 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.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/54F6F431.2080800%40googlemail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tL3vbmC0L_Cb-Nsj0AXR1y__Ba_sCLOAKx1TJD8s%3DH%3DtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Fixing a poorly written Django website (no unit tests)

2015-03-04 Thread Some Developer

Hi,

I've been working on a Django website for about 2 months on and off and 
am nearing the end of development work where I can start thinking about 
making it look pretty and the after that deploy to production.


I've been doing lots of manual testing and I'm sure that the website 
works correctly but due to the need to get the website in production 
ASAP and my lack of unit testing experience with Django (I'm still not 
entirely sure what the point of unit testing a 2 or 3 line Django view 
is when you can clearly see if it is correct or not) I've neglected 
automated testing.


While I'm still going to go ahead and launch the site in production as 
soon as it is deployed I want to go back and add in all the unit tests 
that are missing. How would you tackle this problem?


Most of the code is pretty simple but there are ecommerce elements that 
I have tested extensively by running my code through the Python 
debugger. These must always work.


I'm a bit ashamed that it has got this far but I'm mainly a C developer 
and unit testing isn't pushed quite so hard there (even though it should 
be).


Any help 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F6F431.2080800%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: icons let the template or resolve in the view?

2015-03-04 Thread aRkadeFR

If I get your request right, you want to display icons on each row
of your table.

In my projects, I'm using a font face. It's easy to use, scalable,
and you don't need any {% static %} templatetags in your templates.

Personnaly using icomoon to manage my icons.
https://icomoon.io/app/

Then you generate your font and include it in your html :)

Hope I helped you


On 03/03/2015 07:17 PM, dk wrote:
I will be populating a table with information of computers and I would 
like to display an icon in front of each line of the table. might 
change depending of the machine,  should I let the view handle that 
with and if then and later on use static to resolve the file path?

or should I make that if then and resolve the path by myself in the view?


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a3fb3f1-1c24-4fa0-a7ed-4b21a2c99430%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54F6CF2E.2060605%40arkade.info.
For more options, visit https://groups.google.com/d/optout.