Re: Running django on demand via my PyQt4 Standalone app

2016-10-24 Thread Gergely Polonkai
Hello,

I think installing Django purely for its ORM is a huge overkill. Why not,
for example, SQLAlchemy? Or Qt's own DB layer (I'm making an educated guess
here; if GTK has one, maybe Qt has its own, too.)

If you actually want to use the web framework functionality, though, that's
another story, but that requires a web view in your desktop app. I'm not
sure that's the way I'd go unless the web front-end is already working (in
which case why bother making a desktop app?)

Best,
Gergely

On Mon, Oct 24, 2016, 23:14 Vinicius Assef  wrote:

> On 24 October 2016 at 16:30, Avraham Serour  wrote:
> >
> > Django is a webframework, but it is not an all or nothing thing, you
> don't
> > need to use everything, you may just use the ORM, define your models,
> import
> > them from your application.
>
> This is an interesting scenario, Avraham.
>
> I can't imagine how settings.py would be called to configure database
> stuff. Could you?
>
> It made me curious about that.
>
> --
> Vinicius Assef
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFmXjSCZua21SHr9GWTLvAU1iAqfqN70rG7Jq07o98Y_zQU89w%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULVi1-REynw_9f1yCKrkERyipb_yer8Sz9RROp_j7N20A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Lynda.com

2016-10-13 Thread Gergely Polonkai
Hello,

assuming you created the models.py file and filled it with model classes,
the only thing I can think of is you haven't added your own app to the
INSTALLED_APPS variable in settings.py

Hope that helps.

Best,
Gergely

On Fri, Oct 14, 2016, 03:37 Paul Handley  wrote:

> I am taking the Django and Python course on Lynda.com I have been
> following along, as the presenter shows me how to do it. I have downloaded
> and installed Python and Django; created my first project and first app.
> When I the presenter showed how to make a first "migration" by typing
> "python manage.py makemigrations" his computer terminal showed success in
> that a file called "initial.py was created. When I tried this at my
> terminal all I got was "No changes detected" I looked in file explorer to
> see if the file was created anyway, it wasn't.
>
> If I have done everything correctly( and I have) why is this not working?
>
> Thanks,
> Paul
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/26810988-cbb9-4798-9b5b-f8fa7cfff90f%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUKh95ZQ-VoWxZ4zQV-Wn%3DQYihzRx_2%2BkyhcSNhkPMjy8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to populate a JqGrid in Django with data obtained from a query (queryset)

2016-09-25 Thread Gergely Polonkai
Hello,

do you already know how to do it without Django, e.g with a static dataset?
Because, from the HTML page's view, you will exactly do that.

I don't know JqGrid, but I assume it needs an array of objects, like

gridData = [
{
firstColumn: 1,
secondColumn: "data"
},
{
firstColumn: 2,
secondColumn:" other data"
}
];

Generate this array from your querysets inside a 

Re: How can I send a password recovery e-mail to a Customer/User in Django?

2016-09-25 Thread Gergely Polonkai
Hello,

the trick is not in the email sending, but in resetting the password.

Assuming you don't use any user managing apps (as you didn't state it), you
will have to implement some parts, but the built-in auth module[1] already
covers a lot of this.

Best,
Gergely

[1]
https://docs.djangoproject.com/en/1.9/topics/auth/default/#using-the-views

On Sun, Sep 25, 2016, 23:17 João Rodrigues  wrote:

> I am working on a small online shop with Django 1.9 and I have a Customers
> page.
>
> Note: This is the back-end site. Only for me...
>
>
> 
>
>
> Clicking on the green lock icon should send a password recovery e-mail to
> the e-mail address of the Customer of that row.
>
> We assume that I can easily fetch the e-mail address of the targeted
> Customer, and that there is no need to check if the e-mail address is
> valid, because it is already in the system.
>
> How could I achieve the action of sending a password recovery e-mail to
> that user?
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/688c1a12-a7c2-4817-8c26-34ce59ab5c35%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUKHmFvqy3U%3D0RZrPZYJWo18dP6k2CyLtkHnfmw19%2B4XVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread Gergely Polonkai
That file is an SQLite database, which is a binary format. It should look
like this.

I know it is confusing, because of that bunch of SMS statements, but it's
OK that way. If you want to interact with it, use the sqlite3 command, or
an SQLite GUI.

On Sun, Sep 25, 2016, 14:17 kbman99  wrote:

> Just getting started with django and having an issue with the migrate.py
> script. It generates a db.SQLite3 file which is filled with a lot of
> garbage characters. It's in UTF-8 encoding, but looks like this.
>
> 
> I've deleted the file and redone the migrate a few times but it's always
> like this.
>
> Any help appreciated!
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2980ce12-c366-454b-844a-c625e7520977%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BLjg8hzYKKEKEdec9kWdWS1bfXSCdX0qsO0oxcppVX5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I am searching: How to make drop down list in django

2016-09-01 Thread Gergely Polonkai
This very much depends on what exactly want to do, but in general, it
doesn’t really Django’s job. Can you produce the desired result in a plain
HTML file? If not, you should visit an HTML/CSS tutorial; if yes, you
should define your problem a bit better, otherwise we won’t be able to help
you.

 ezt írta (időpont: 2016. szept. 1., Cs, 13:17):

> I trying for last 7 days to search this topic but could not find :(
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a22b7506-9a82-4e1b-8835-b170774ec03a%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2Bm_65mMwud1_xxZn1uKNj_oR-vfUyh%2Bc%3D9xP-C5XRrZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ti possible CommaSeparatedIpField

2016-08-31 Thread Gergely Polonkai
Hello,

although it is possible, I'd go with an IP field and generate a list of
them, comma separated, at run time. This will make it easier to search and
manage the list.

Best,

Gergely

On Wed, Aug 31, 2016, 00:29 Jorge Cadena  wrote:

> Hi
>
> I have a idea CommaSeparatedIpField, it possible ?
>
> this for validacion IP ACL list in FreeSWITCH.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9d5d8359-ce30-41c8-8d88-2733b32ad76d%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJvNiyC7QZ1NFjYkx97i1tB7%3D7QKGwu49PVsfaWr%2BZg7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Strange failing test

2016-08-24 Thread Gergely Polonkai
That’s indeed great news. Too bad I’m rooted with 1.9 for a while, as 1.10
doesn’t play nice with Python 2.7.8. I hope I can upgrade both Python and
Django to as recent as possible soon. Thank you for the info anyways!

Tim Graham <timogra...@gmail.com> ezt írta (időpont: 2016. aug. 24., Sze,
16:59):

> You'll be glad to know that's fixed in Django 1.10:
> https://github.com/django/django/commit/e0837f2cb12de5e95e621d19b186b0da43bcdee2
>
>
> On Wednesday, August 24, 2016 at 10:27:37 AM UTC-4, Gergely Polonkai wrote:
>
>> It just turned out that value_list(…, flat=True) returns a QuerySet, not
>> a list. So expected_json couldn’t be equal to the actual result. It took a
>> bit of debugging as repr() displays [1, 2, 3], not QuerySet(1, 2, 3) or
>> something.
>>
>> Derek <game...@gmail.com> ezt írta (időpont: 2016. aug. 24., Sze, 16:03):
>>
> Assuming that the long function you have embedded inside your dictionary
>>> simply generates a list i.e.
>>>cloned_build.groupings.get(group=group1)
>>>.field_values
>>>.exclude(template=approvable_template)
>>>.values_list('id', flat=True)[:]
>>>
>>> results in:
>>>[1,2,3]
>>>
>>> Then some examples of possible tests:
>>>
>>>
>>> expected_json = {
>>> 'status': 'ok',
>>> 'invalid-fields': {},
>>> 'updated-fields': [1,2,3]
>>> }
>>> actual_json = {
>>> 'invalid-fields': {},
>>> 'status': 'ok',
>>> 'updated-fields': [1,2,3]
>>> }
>>> invalid_json = {
>>> 'invalid-fields': {},
>>> 'status': 'ok',
>>> 'updated-fields': [2,3]
>>> }
>>>
>>> assert cmp(expected_json, actual_json) == 0  # same
>>> assert cmp(expected_json, invalid_json) == -1  # different
>>>
>>> Hope this helps.  For more background & discussion, see:
>>>
>>>
>>> http://stackoverflow.com/questions/4527942/comparing-two-dictionaries-in-python
>>>
>>>
>>>
>>> On Wednesday, 24 August 2016 12:11:18 UTC+2, Gergely Polonkai wrote:
>>>>
>>>> Hello,
>>>>
>>>> I have a test that fetches some JSON data from my API and compares it
>>>> with the expected result, which is generated like this:
>>>>
>>>> expected_json = {
>>>> 'status': 'ok',
>>>> 'invalid-fields': {},
>>>> 'updated-fields': cloned_build.groupings.get(group=group1)
>>>> .field_values
>>>> .exclude(template=approvable_template)
>>>> .values_list('id', flat=True)[:],
>>>> }
>>>>
>>>> At the end, I get this error:
>>>>
>>>> AssertionError: {u'status': u'ok', u'invalid-fields': {},
>>>> u'updated-fields': [13, 14, 15]} != {u'status': u'ok', u'invalid-fields':
>>>> {}, u'updated-fields': [13, 14, 15]}
>>>>   {u'invalid-fields': {}, u'status': u'ok', u'updated-fields': [13, 14,
>>>> 15]}
>>>>
>>>>
>>>> It seems the two dicts are equal, but assertEquals thinks they are not.
>>>> Am I missing something here?
>>>>
>>>> Best,
>>>> Gergely
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>
>>
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/ac51f934-5320-45c1-8dc8-aca658fde881%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/ac51f934-5320-45c1-8dc8-aca658fde881%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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.

Re: Strange failing test

2016-08-24 Thread Gergely Polonkai
It just turned out that value_list(…, flat=True) returns a QuerySet, not a
list. So expected_json couldn’t be equal to the actual result. It took a
bit of debugging as repr() displays [1, 2, 3], not QuerySet(1, 2, 3) or
something.

Derek <gamesb...@gmail.com> ezt írta (időpont: 2016. aug. 24., Sze, 16:03):

> Assuming that the long function you have embedded inside your dictionary
> simply generates a list i.e.
>cloned_build.groupings.get(group=group1)
>.field_values
>.exclude(template=approvable_template)
>.values_list('id', flat=True)[:]
>
> results in:
>[1,2,3]
>
> Then some examples of possible tests:
>
>
> expected_json = {
> 'status': 'ok',
> 'invalid-fields': {},
> 'updated-fields': [1,2,3]
> }
> actual_json = {
> 'invalid-fields': {},
> 'status': 'ok',
> 'updated-fields': [1,2,3]
> }
> invalid_json = {
> 'invalid-fields': {},
> 'status': 'ok',
> 'updated-fields': [2,3]
> }
>
> assert cmp(expected_json, actual_json) == 0  # same
> assert cmp(expected_json, invalid_json) == -1  # different
>
> Hope this helps.  For more background & discussion, see:
>
>
> http://stackoverflow.com/questions/4527942/comparing-two-dictionaries-in-python
>
>
>
> On Wednesday, 24 August 2016 12:11:18 UTC+2, Gergely Polonkai wrote:
>>
>> Hello,
>>
>> I have a test that fetches some JSON data from my API and compares it
>> with the expected result, which is generated like this:
>>
>> expected_json = {
>> 'status': 'ok',
>> 'invalid-fields': {},
>> 'updated-fields': cloned_build.groupings.get(group=group1)
>> .field_values
>> .exclude(template=approvable_template)
>> .values_list('id', flat=True)[:],
>> }
>>
>> At the end, I get this error:
>>
>> AssertionError: {u'status': u'ok', u'invalid-fields': {},
>> u'updated-fields': [13, 14, 15]} != {u'status': u'ok', u'invalid-fields':
>> {}, u'updated-fields': [13, 14, 15]}
>>   {u'invalid-fields': {}, u'status': u'ok', u'updated-fields': [13, 14,
>> 15]}
>>
>>
>> It seems the two dicts are equal, but assertEquals thinks they are not.
>> Am I missing something here?
>>
>> Best,
>> Gergely
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ac51f934-5320-45c1-8dc8-aca658fde881%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ac51f934-5320-45c1-8dc8-aca658fde881%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJ%2BuQRjSvEJebVtvKV1Srzzhq3WhSWHpAvhsNi39hm90w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Strange failing test

2016-08-24 Thread Gergely Polonkai
Hello,

I have a test that fetches some JSON data from my API and compares it with
the expected result, which is generated like this:

expected_json = {
'status': 'ok',
'invalid-fields': {},
'updated-fields': cloned_build.groupings.get(group=group1)
.field_values
.exclude(template=approvable_template)
.values_list('id', flat=True)[:],
}

At the end, I get this error:

AssertionError: {u'status': u'ok', u'invalid-fields': {},
u'updated-fields': [13, 14, 15]} != {u'status': u'ok', u'invalid-fields':
{}, u'updated-fields': [13, 14, 15]}
  {u'invalid-fields': {}, u'status': u'ok', u'updated-fields': [13, 14, 15]}


It seems the two dicts are equal, but assertEquals thinks they are not. Am
I missing something here?

Best,
Gergely

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


Re: Using version control with django

2016-08-23 Thread Gergely Polonkai
Hello,

the fact you develop alone doesn't make SVN a better choice than Git,
Mercurial, or any other distributed version control. But as you already
made your choice, here are my two cents.

You should put all the stuff under trunk/, so it becomes trunk/manage.py,
trunk/crm/, etc. If you are developing for multiple customers, the branches
and tags directory may come in handy later. Also, it's nothing but naming
convention: you can call these directories dog/, Pete/, and ananas/. But
that’s more for a Subversion user list, not Django.

On the other hand, you definitely should choose a distributed version
control if you are working alone. For example, Git, Mercurial and Fossil
repositories are self contained, which means the whole development history
is located right where you work. If you decide to publish (or just backup)
your work, all you need to do is to add a new remote. With SVN, it's hard
to publish somewhere else than before (read: it’s a real PITA to migrate
SVN history from one server to another).

Best,
Gergely

On Tue, Aug 23, 2016, 21:42 Rich Shepard  wrote:

>I want to track django projects with subversion. (Single developer,
> local,
> so svn is better suited than the distributed git and mercurial.) I'd like
> advice on how to lay this out vis-a-vis the django layout.
>
>Project overall root is ~/development/crm-project. This directory
> contains:
>
> Makefile  README  crm-project/  docs/  manage.py*  requirements.txt
>
>The top-level project directory is the same-named crm-project, and this
> contains:
>
> __init__.py   __pycache__/  settings.py   urls.py
> __init__.pyc  crm/  settings.pyc  wsgi.py
>
>The app directory is crm/.
>
>So, where should I place trunk/, tags/, and branches/ be created? If
> they're in the overall project root (~/development/crm-project/) should I
> then move that directory's contents into the newly made trunk/
> subdirectory?
>
>I find nothing in my web searches for using svn with django. Perhaps my
> web foo is insufficient.
>
> Rich
>

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


Re: Unable to get tests to work

2016-08-17 Thread Gergely Polonkai
Hello,

this “refreshes.backups.tests” thing bothers me a lot. Could you show us
your directory structure, please?

Best,
Gergely

On Wed, Aug 17, 2016, 23:03 Matt  wrote:

> Ok a step forward. When I spell out the tests it works:
>
> https://dpaste.de/2MXf
>
> But when I run test without arguments, it fails out:
>
> https://dpaste.de/cgTH
>
> There is more than the backups app here, but I plan to replicate out the
> fix when I get it.
>
> On Wednesday, August 17, 2016 at 2:34:45 PM UTC-6, Fred Stluka wrote:
>
>> Matt,
>>
>> Oops!  Right.  I just noticed that in the dpaste.
>>
>> My next guess is you may need to change the name "good_index_text"
>> to something that starts with "test_" to get it to be recognized as a
>> test.
>>
>> Or maybe something to do with "refreshes"?  The test trace shows
>> it trying to run testcase "refreshes.backups.tests", but in the manual
>> import you did from the python shell, you only import "backups.tests"
>>
>> --Fred
>> --
>>
> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> --
>>
>> On 8/17/16 4:27 PM, Matt wrote:
>>
> Sorry for the typo, but I have already do that way. I have the output in
>> the the first link.
>>
>> On Wednesday, August 17, 2016 at 2:24:19 PM UTC-6, Fred Stluka wrote:
>>>
>>> Matt,
>>>
>>> Drop the "s" from "tests":
>>>
>>> ./manage.py test backups
>>>
>>> --Fred
>>> --
>>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>>> Open Source: Without walls and fences, we need no Windows or Gates.
>>> --
>>>
>>> On 8/17/16 4:17 PM, Matt wrote:
>>>
>>> When I'm trying to get tests to work it simply states that its unable to
>>> import .tests. I'm not sure what I'm missing here. Here is some output
>>> please let me know if you need more:
>>>
>>> ./manage.py tests backups
>>> https://dpaste.de/4U9C
>>>
>>> The test file:
>>> https://dpaste.de/bBZt
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/89d6fac7-0848-4e35-8b4a-62d24178c3aa%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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/04fcacea-15d0-42af-afe5-424c2d1df86f%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/404f7e22-6f34-4c0d-bfdd-f277f6fb7543%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUKXpd-MKGXNDyNTSXiBcKQ-u7r1VF2wQCKKBq1PFCz4BQ%40mail.gmail.com.
For more options, visit 

Re: Migrations for forms fields

2016-08-16 Thread Gergely Polonkai
Hello,

rename migrations in your head to database migrations, or even model to
database migrations.

The migration process takes all your models and applies all the changes in
them to your database (usually an SQL instance in the wild).

Forms, on the other hand, are just that: forms, that can get some input
from somewhere. Although they can be used to interact with models (in fact,
there is ModelForm designed specifically for this case), they are not
models, thus, migrations don't apply to them.

Hope that makes the picture clear.

Best,
Gergely

On Tue, Aug 16, 2016, 00:56 Pranjal Tale  wrote:

> Hello!
> I was writing my models with forms.Forms and after writing when i run
> "python manage.py makemigrations app_label" it shows the error as "app not
> deceted".
>
> And at at same time when i build some models with models.Model and when i
> run the same command so all the migrations get implemented.
>
> It is so that for forms based models migrations are not applied
> If not i am unable to find the bug
> Please Help
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f2b8c7cb-4e9c-4543-a80c-65d5bee3d935%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUK-iZkH3u_KSYkT%2B%2BO2e2%3D8ckzBk6KegSC0uQeYTwv-5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: TypeError: $.get is not a function

2016-07-25 Thread Gergely Polonkai
This sounds to be a JavaScript problem, which is not part of Django in any
ways.

My idea, however, is that you don’t import another JS file that contains
the $ function (probably jQuery or Prototype?)



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-07-25 12:31 GMT+02:00 ajay <riderkuld...@gmail.com>:

> //In scirpt
>
> $('#suggest').keyup(function ()
> {
>var query = $('#suggest').value;
>
>  $.get("/search/", {suggest:query},function( data ){
>  $("#list").html( {% for item in search_list %}
> ''+{{ item }}+ ''
> {% endfor %} )
>
>
> });
>
>
>
> In body
>
>
> 
> 
> 
>
>
> am i doing something wrong
>
> plz 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f874db3a-1e19-4cef-9deb-9beed11159d2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f874db3a-1e19-4cef-9deb-9beed11159d2%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BHq2a7Xs7U5tqcfFF%2BZ2CzyQMTiMtetjkbxym5SJuczQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: When need return the HttpResponseBadRequest and why?

2016-07-04 Thread Gergely Polonkai
400 Bad Request is responded if the client sends a… um… Bad Request?

Jokes aside, it may represent many things. Web servers may send 400 if the
HTTP request is malformed. Applications, such as a Django app, may send 400
if the request cannot be processed, e.g. when a required header is missing
or (with REST APIs) if a JSON field is not present or contains an invalid
value.

Best,
Gergely
On Jul 4, 2016 19:44, "Seti Volkylany"  wrote:

.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/7f2bfae4-66d1-44c6-9255-4f862d42d43b%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULSY21SaY-4ZO2SqKPqzGMq4gPzizW4BsqB_i1hMHKQug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using the Eclipse mysite>django>custom command(manage.py$(custom_command)) function

2016-06-26 Thread Gergely Polonkai
Hello,

that message tells you everything. As there is no tty (ie. a terminal that
can read user input and write some output), createsuperuser won’t run.

I don’t know eclipse, but if you can force it to run commands within a tty,
you won. Otherwise you will have to use the command line.

Well, except you can start an interactive Python shell from within Eclipse.
In this case, you can import your User model, and create users with that,
as if it was your app’s code.

Best,
Gergely
On Jun 26, 2016 00:51, "Gary Roach"  wrote:

> i did as you suggested and tried it with runserver. It worked. I tried the
> same thing with createsuperuser and got the errror: Superuser creation
> skipped due to not running in a TTY.
>
> Since I am setting up the sqlite dbms, does it make any difference if I
> run the thing inside Eclipse vs cd to mysite.manage.py and run things
> from the system monitor command line?
>
> Gary R.
>
> On 06/25/2016 01:55 PM, Ilya Boka wrote:
>
>> Click add. Enter your command( Ex: "runserver"). Click OK. Double
>> click to run this.
>>
>> On Sat, Jun 25, 2016 at 10:07 PM, Gary Roach 
>> wrote:
>>
>>> Hi all:
>>>
>>> OS Debian Stretch
>>> KDE Desktop
>>>
>>> I am using Eclipse Neon with the PyDev plugin for developing a django
>>> application. At present I am running through the djangoproject
>>> tutorial.The
>>> tutorial has me run:
>>>  python manage.py createsuperuser
>>> I want to run this within Eclipse and not the system command line. Right
>>> clicking on the project title and following the sub menus I get to the:
>>>  mysite>django>custom command(manage.py$(custom_command))
>>> function. I
>>> can't seem to figure  out how to use this. It is the only thing I could
>>> find
>>> that looks like it is meant to replace the system command line.
>>>
>>> In general, any time I have to use manage.py and there is not a specific
>>> menu item for the process, I'm awash.
>>>
>>> Any elucidation on this point will be sincerely appreciated.
>>>
>>> Gary R.
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>>
>>> https://groups.google.com/d/msgid/django-users/d9eba089-965f-46cf-7c38-f97af2d17aa8%40verizon.net
>>> .
>>> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/88d4a6cf-19d7-6d54-b1da-320a55641ebc%40verizon.net
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2B21Rxn9drubBJ2aZ3dMC3SMYLjYyP4pmtKnki%2BDdCpfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to use view function in another function of view in django

2016-06-15 Thread Gergely Polonkai
Just like this. Unless you have a specific use case you forgot to share in
your mail.

Views are mere functions that get called with a request az a parameter. You
shouldn’t treat them as special/holy/uncallable.

Best,
Gergely
On Jun 15, 2016 19:56, "hossein"  wrote:

> def base(request):
> j=Job.objects.all()
> a=Ab.objects.all()
> return render(request,'base.html',{'j':j, 'a':a})
>
> def index(request):
> base(request)
> x=X.objects.all()
> return render(request, 'index.html',{'x':x})
>
> def list(request):
> base(request)
> z=Z.objects.all()
> return render(request, 'list.html',{'z':z})
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3cc2651c-35df-4eaf-bab6-b1ae936f73d4%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULw3kggNH5%3DerHjm5iY6yFkjwEknLL8V9Cpa1N9RX2Cww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about Deploying django for production using apache and mod_wsgi.

2016-05-26 Thread Gergely Polonkai
On May 26, 2016 20:12, "Bruce Whealton" 
wrote:
>
> Hello all,
> I have a few questions of which I am not finding answers.
> 1) If I export my development db (Postgresql) and then import it into
production database,
> won't I be pulling in a very weak password that I used for development?
I guess I can
> just change that.

Yes you can, and yes, you will. I usually start prod with an empn]ty DB, I
consider that safer.

> 2) Should I export all the content and structure from my development
server to my
> production server?  Or should I just create the database connection and
then run migrations and
> then create the data content on the production server?  Obviously, my
development server has
> minimal content.

See my previous answer. If your dev data is production-ready, I don’t see
the downside though.

>
> 3) Should I just upload the other packages that I installed with pip on
my development server or
> should I instead run pip install on the production server to get all the
packages needed on the
> production server?

If you use virtualenv, you should use pip install. I suggest creating a
requirements.txt file (you can create one with pip freeze) and update it
regularly.

>
> 4) Is it a best practice ( continuing from #3) to create a requirement
file and use that to install
> with pip all the packages, as opposed to uploading the packages from
development to production?
> Note: I am developing on Ubuntu but deploying to Centos.

See previous answer.

>
> 5) I suppose, even if I had a Centos development environment, I would
still want to install the required
> packages on the production server instead of just uploading everything.
>
> Regarding #5, I am liking Python better than what I have used for some
time, PHP based application
> development.  However, for the longest time, things were much simpler
with php in that most php code is
> just text and so there isn't the notion of "installing" a package.  One
could expect things to work fine
> if one just uploaded the site from development to production (perhaps
certain new OO features are changing
> this situation for php sites, e.g. the use of autoloaders but that's
another topic).

PHP has its package system, too, it is called composer. It also has binary
modules (although they require much more effort on the server side)

>
> 6) Is there anything else, in addition to the top level assets (with
js/css) that I would want apache to serve directly
> versus going through mod_wsgi?  It seems like I read something to this
effect relating to parts of the admin,
> that need to be served directly by apache.  I could be wrong.

Take a look at the collectstatic management command. Also, if you use
django-compress, e.g. for less,sass, css/js minimizing), you need to run
that.

>
> Thanks in advance for any help,
> Bruce

Also, you may want to check this page[1] for other possible caveats and
best practises.

[1] https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

>
> P.S. If anyone wants to develop a course on udemy.com on a python
framework, please don't develop with
> sqlite3 since we won't use that in production and please discuss
deployment on a server besides
> something like pythonanywhere.com.  The issues of setting things up on
one's own vps server are not
> trivial at all.  (smile).
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/50b71c19-10a1-4610-8050-191bde7facda%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULd2mqRCuY72euyZR0xiUCT2wWNKWBYF78qLsWP7KbFww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I am not able to run the following code

2016-05-26 Thread Gergely Polonkai
I don’t see any error here; what is the error message you see?



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-05-26 10:16 GMT+02:00 Madhusudhana H V <hvmadhusudh...@gmail.com>:

> I am trying to execute the following code. But I am getting error at step 2, 
> namely ">>> t = template.Template('My name is {{ name }}.')"
> Kindly help me out of this.
>
> >>> from django import template>>> t = template.Template('My name is {{ name 
> >>> }}.')>>> c = template.Context({'name': 'Adrian'})>>> print t.render(c)My 
> >>> name is Adrian.>>> c = template.Context({'name': 'Fred'})>>> print 
> >>> t.render(c)My name is Fred.
>
> Thanks and Regards,
> Madhusudhana H V
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1da7713e-5019-4a96-b026-30ff4ecc13bf%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1da7713e-5019-4a96-b026-30ff4ecc13bf%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJ0kXk8x0cp1g8vCbSUge4G8Dbt0v18BH9ivZF9Qm9OEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: UserProfile Pattern (extending User model); Migrations; New fields/columns on models.

2016-05-23 Thread Gergely Polonkai
Hello,

did you run manage.py migrate?

When you add a ForeignKey or OneToOne to a model, what actually gets stored
in the DB is the ID of the referenced object (in this case, a
auth.models.User). So the user_id column should be created for you during
the next makemigrations+migrate combo.

On a side note, giving a plural name to your models is bad practise,
especially if you use the builtin admin site.

Best,
Gergely
On May 23, 2016 18:42, "McKinley"  wrote:

> I have a Users table inside of a postgresql database in which auth_user
> also lives. I want the Users objects to have a OneToOne to the auth_user
> model. I added a line to my models.py under my Users class:
>
> user = models.OneToOneField(User, unique=True)
>
> There are probably other things wrong, because at this point my basic
> template returns this traceback:
>
> Exception Type: ProgrammingError at /scripts/users/
> Exception Value: column users.user_id does not exist
> LINE 1: SELECT "users"."id", "users"."user_id", "users"."email", "us..
>
>  I know my Users table doesn't have the user_id column. I do not know how
> to add it. Do Django users prefer to write a migration for this? Migrations
> themselves are not detecting any changes per app at all so I am completely
> flummoxed on how to add this column properly. I was going to manually do it
> in postgres, but I didn't know how to make it conform to the corresponding
> field in auth_user. Thank you for your 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3e89ccba-dcb9-42ef-b084-c6cc4b7d6891%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULk4THu13xFBfP2je0XDBPgMCe-aBXjNxna%3DYkaf0Q_ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complicated relationships

2016-05-23 Thread Gergely Polonkai
I would make Restaurant.dishes a @property that returns all dishes the
restaurant's chefs can make:

return Dish.objects.filter(chef__restaurant=self)
On May 23, 2016 14:46, "Jani Tiainen"  wrote:

> Something like
>
> Chef:
>   # Nothing special here, reverse relations will be done automatically
>
> Dish:
>chef = ForeignKey(Chef)
>
> Restaurant:
>chefs = ManyToMany(Chef)
>dishes = ManyToMany(Dish)
>
>
> Of course, you need to build something to make sure that restaurant
> doesn't serve dishes that it's chefs can't make.
>
>
> On 23.05.2016 15:19, Mlati Mudan wrote:
>
> I read the django documentation for a simple many-to-many relationship and
> I get it, but I'm stuck with this kind of complexity.
>
> Each restaurant employs many chefs and serves many dishes.
> Each chef can work for many restaurants and prepare many dishes.
> Each dish can only be prepared by a single chef but it can be on the menu
> of many restaurants.
>
> How do I connect these models: dish, chef, restaurant?
>
>
>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/01e504a5-bbc6-4cee-96e2-158a2803d5b7%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5742FBA4.5010901%40gmail.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULCJXyxtuzu%3D9Kns27qxkdwLYuFXGW1cDypktDafz8VcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: is there any django app for opendata

2016-05-20 Thread Gergely Polonkai
Hello,

what exactly want to achieve? I mean, Open data is not a standard data
format you can implement, it’s just the way you make that data accessible.
The biggest challenge in this, I think, is keeping the integrity of the
data, so everyone sees the same thing at any point in time.

Best,
Gergely



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-05-20 0:59 GMT+02:00 Luis Zárate <luisz...@gmail.com>:

> Hi,
>
> I interested in opendata and open government so I am looking for tools to
> build a platform for a local government.
>
> I really like django, I like to build system with it so I want to
> implement something useful that help to create and transparent and eficient
> for free
>
> Do you have some recommendation ?
>
> Thanks
>
>
> --
> "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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG%2B5VyPWH5ap%2BhVRb3C%3Dhtvh406it7ngCROCdzpV87yh0fioMw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAG%2B5VyPWH5ap%2BhVRb3C%3Dhtvh406it7ngCROCdzpV87yh0fioMw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULgY0Ex95MqusxA1bGWceQ3cxshoNosR7%3Dkmbw_RvWYDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all columns as a list

2016-05-20 Thread Gergely Polonkai
Hello,

Django can’t do this out of the box, but see this post[1] for a possible
solution with dicts.

You might also want to look at serialization[2]; it might help you a bit,
but again, it’s primarily for dicts, not lists.

On the other hand, I started wondering why you need this, do you care to
share the use case?

Cheers,
Gergely

[1] http://stackoverflow.com/a/29088221/1305139
[2] https://docs.djangoproject.com/en/1.9/topics/serialization/
On May 20, 2016 00:13, "Larry Martell"  wrote:

> This is probably very simple, but I just can't figure out how to do it.
>
> I want to get all the columns in some rows as a list. I know I could
> use values_list and flat=True and list all the columns, but is that
> the only way?
>
> I want to do something like this:
>
> rows = FOO.objects.filter(bar='baz')
>
> and get a list of lists instead a list of FOO objects.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY7EZtbmLqLgggZnnBspKbvOucPDki1i28zD3jtjGp%3DWFQ%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJBs87C9ayBxEyfWo4AX%2BFrB0Do%2BrNeNTtX7OKQyoxr%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Delete all migration files

2016-05-13 Thread Gergely Polonkai
Hello,

Michal is right, except…

If you have only one server running your code, there is no real need to
keep your unsquashed migrations; do a squash, and remove everything else.

If, however, your app's source is public, imagine the following scenario:

You publish your app with 3 migration files. I install it and migrate. Then
you create 2 more, but later decide to squash all 5 into one (resulting in
a 0001_0005 migration file) and remove the old ones. Now I hear about the
cool new feature you just built in and want to use it. I upgrade the app,
run migrate… and Django will miss the 0004 and 0005 files.

If I create an empty migration with the same name of your 0004 (I can check
it in the squashed migration file), then run makemigration, I'll get the
same result as you (I have to rename 0005 again, of course). However, if
you had a RunPython step in your 0004, I will know nothing about it, and
may destroy my data (of course not, I have backups).

=

I have some Django projects in production, and we always keep migration
files. We also have most of them squashed just in case (it speeds up
testing a lot).

I hope I helped :)

Best,
Gergely

On May 13, 2016 07:42, "Michal Petrucha" 
wrote:
>
> On Thu, May 12, 2016 at 08:11:42PM -0700, Noumia Ngangoum wrote:
> > Yeah Eugene, I know that, that's how I do now.
> > I was looking for a one-liner command or something.
>
> There is no one-liner, because you are not supposed to remove all
> migrations. The entire point of migrations is that once you crate
> them, you keep them together with your code.
>
> Occasionally you might want to squash your migrations, in case the
> migration history becomes too long and takes too much time to process
> one-by-one, but even when you do that, you do not simply remove all
> migrations and reset the migrations table.
>
> Cheers,
>
> Michal
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/20160513054234.GC435%40konk.org
.
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULN2j8evGURO2NPZJaF5%2BjFJbjKuO7tHUU%2B7-Ro3bkrnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best way to switch from mysql to postgres?

2016-05-11 Thread Gergely Polonkai
Hello,

this depends on a lot of factors, like the anatomy of your models and
signals. I have a model which is is not administered, but every time I
create a user, a new row is added by a signal. This way, loading such a
dump is impossible without some modifications to these signals.

All in all, it would be really helpful if you show us you actual errors.
Without that it is impossible to decide if it is possible in your situation.

Best,
Gergely
On May 11, 2016 21:16, "anton"  wrote:

hi,

I have a django (1.8.13) project running
on windows 7 64 bit + python 2.7.10 (32bit).

Actually it runs with mysql (precise: mariadb)
and I tried the following:

1. commandline:> manage.py dumpdata -o dumpdata.json

2. then I switch the engine to postgres in my django settings file
  (the empty postgres is already prepared)

3. commandline:> manage.py loaddata dumpdata.json

Unfortunately it runs into an error.

Before I put here all the details, first one question:

Is this way supposed to work?

Or how would you do it?

Thanks

 Anton

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/nh00dn%24hj7%241%40ger.gmane.org
.
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUL-ONCSSz%2BMXZ7hzJVP5c9ZLpAy9HK28s-GB3y-FnuUzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ubuntu+nginx+django urlpatterns 404 not found

2016-05-11 Thread Gergely Polonkai
If your 404 pages are white with DEBUG=True, then the problem lies within
the web server config. Could you show us the working apache config, too?
i tried
and still return 404 not found

Sai K於 2016年5月10日星期二 UTC+8下午7時36分57秒寫道:
>
> Can you change the url for board some thing like : *url(r'^board$',
> 'board') , lets try.*
>
> On Sunday, May 8, 2016 at 7:10:40 PM UTC+5:30, minom du wrote:
>>
>> Hello ,every body.
>> attachment is my code
>>
>> i set the urls.py below
>> urlpatterns += patterns('bullet.views.noticeview',
>> (r'^$', 'notice'),
>> (r'^board', 'board'),
>> )
>>
>> the urlpatterns ^$ work fine
>> but ^board not work ,it show 404 not found
>>
>> i have some code like this but work on windows+apache
>> it work fine
>>
>> now i move it to ubuntu+nginx
>> then it not work
>>
>> anyone can tell me how fix it ,please
>> thank you very much
>>
> --
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/3d41a71a-480e-49e4-ae49-5fe59d39929a%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJYAsL_BB80mk7F%3D41HTfLASw2m96UgOEkVaHS0fNC%3D5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ubuntu+nginx+django urlpatterns 404 not found

2016-05-09 Thread Gergely Polonkai
On May 9, 2016 10:06, "minom du" <mino...@gmail.com> wrote:
>
> sorry,my english is not good
> my urls.py is
> from django.conf.urls import include, url, patterns
> from django.contrib import admin
>
> urlpatterns = [
> url(r'^admin/', include(admin.site.urls)),
> ]
>
> urlpatterns += patterns('bullet.views.noticeview',
> (r'^$', 'notice'),
> (r'^board', 'board'),
> )

patterns is going away soon, so try this instead:

urlpatterns = [
url(r'^admin/', include(admin.sites.urls)),
url(r'^$', 'notice'),
url(r'^board', 'board'),
]

My guess is that it will solve your problem. If not, come back to us with
the results!

>
> and this is my views code
> def notice(request):
> logger = logging.getLogger('school')
> logger.info("ko ")
> board_list=board.objects.using("default").all()
> return render_to_response('index.html',locals())
>
> def board(request):
> t = loader.get_template("index.html")
> response_data = {}
> response_data["result"] = "Y"
> board_list=board.objects.using("default").all()
> response_data["content_html"] =
t.render(Context({'board_list':board_list}))
> return HttpResponse(json.dumps(response_data),
content_type="application/json")
>
> when i run localhost:82 it will run notice and goto index.html
> but when i run localhost:82/board
> it will return 404 not found
>
> and i try to change the code def board to this
> def board(request):
> logger = logging.getLogger('school')
> logger.info("ko ")
> board_list=board.objects.using("default").all()
> return render_to_response('index.html',locals())
>
> just same of notice
> it still return 404 not found
>
> the environment is ubuntu+nginx+django 1.8.13
>
>
> and i try build it on the environment windows2008+apache+django1.8.7
> both notice and board can work fine(windows use port:83)
>
>
>
> so i don't understand why ubuntu+nginx will return 404 not found
>
>
>
>
>
>
>
>
> Gergely Polonkai於 2016年5月9日星期一 UTC+8上午1時36分49秒寫道:
>>
>> What do you mean it doesn't work? What error message you get? Are you
sure it is provided by Django and not the webserver?
>>
>> Also, GMail is marking your message as a possible malware; consider
pasting your urls.py inline instead of an attachment.
>>>
>>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c23eb219-a5ba-4353-b938-79c478783921%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULEoaSONiBXRmhYFXZ7wiN2BOL_qyJ52MT%2B-o76LQxXXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ubuntu+nginx+django urlpatterns 404 not found

2016-05-08 Thread Gergely Polonkai
What do you mean it doesn't work? What error message you get? Are you sure
it is provided by Django and not the webserver?

Also, GMail is marking your message as a possible malware; consider pasting
your urls.py inline instead of an attachment.
On May 8, 2016 15:39, "minom du"  wrote:

> Hello ,every body.
> attachment is my code
>
> i set the urls.py below
> urlpatterns += patterns('bullet.views.noticeview',
> (r'^$', 'notice'),
> (r'^board', 'board'),
> )
>
> the urlpatterns ^$ work fine
> but ^board not work ,it show 404 not found
>
> i have some code like this but work on windows+apache
> it work fine
>
> now i move it to ubuntu+nginx
> then it not work
>
> anyone can tell me how fix it ,please
> thank you very much
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/48902712-26b6-4f3a-b465-ab4699f4dbfb%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULjH3QfyWGUVU7JqNxdkT71rp4yKKYGqnZLM8h%3DNuWp5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help Replicating a Django App Repo

2016-05-08 Thread Gergely Polonkai
Hello,

1. Clone the repo (success)
2. Install pip requirements (mention using virtualenv, but don't make it a
requirement; pip install -r requirements.txt in a venv succeeded)
3. Set the SECRET_KEY environment variable (I think you shouldn't make
creating secret.sh a requirement, just suggest it; setting env variables in
a production environment may be very different, like editing the server's
configuration files)
4. Set up your database and set the password (where? In settings.py?
There's no env variable for that here, and if you don't run PgSQL locally,
it is very likely you *will* have a password)
4. Run python manage.py migrate (succeeded both with SQLite3 and PostgreSQL)

All in all: works for me ☺

One suggestion: unless you do some raw SQL magic, you should not make a
specific database a hard requirement. Your app seems to work well with
SQLite (long time performance is a different story, though).

Best wishes!

Gergely

PS: add some tests. python manage.py test feels lonely without them 
On May 8, 2016 00:28, "Erin A"  wrote:

> Hello,
>
> I am a junior software engineer and am quite new to Django. I built this
> app  and am working on a
> README to explain to others how to fork, clone and setup the app on their
> own machines. I've gotten stuck while trying to re-create the steps.
>
> This is the order in which I've drawn up the steps:
>
> 1. Fork and clone the repo
> 2. Source a virtual environment
> 3. Pip install requirements.txt
> 4. Obtain access_token and secret_key and store in secrets.sh
> 5. Setup a Postgres DB, create user & database
>
> This is where I get stuck.
>
> I tried migrating the app but there are no migrations to apply.
> I tried 'django-admin startproject ig_miner_app . but am getting this
> error code:
>
> "CommandError:
> /Users/Erin/Desktop/CodeByEAllard/project/instagram_miner/manage.py already
> exists, overlaying a project or app into an existing directory won't
> replace conflicting files"
>
> If I can get this sorted out, I should just be able to run the server like
> normal, right?
>
> I'm sure I'm missing something (or many things) but don't know what they
> are. Does any have suggestions for how to get the server to run?
>
> Thank you!
>
> Erin Allard
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/83e916c1-cf32-4e95-83b5-1d5da686bca0%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUKu1r9EpAarL%3D-T8Ty4K8VszfFnFdOh5UKOfcjuBUJ-SQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is completed listing all formaters (fakers, providers) in FactoryBoy?

2016-04-30 Thread Gergely Polonkai
Looking at FactoryBoy’s documentation, it doesn’t seem you can use these;
for example, slug is never mentioned in the documentation. What exactly do
you want to achieve? Are you sure it’s FactoryBoy you are looking for?



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-30 10:11 GMT+02:00 Seti Volkylany <setivolkyl...@gmail.com>:

>
> I mean the factory.Faker('*name*', locale='en'), and
>
> I found slug, name, first_name, last_name, time, date, url, but I am don`t
> found all list in Web and factoryboy`s documentation.
>
> May anyone known?
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/787d683b-cb31-432e-ac34-a480d5d4fda2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/787d683b-cb31-432e-ac34-a480d5d4fda2%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULd30C0o8ywkSFJeaPwL_XCVGPz_4aBab_-xFq1h2PtGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Nagios plugins for Monitoring Django Apps

2016-04-27 Thread Gergely Polonkai
Hello,

I don’t know of any built-in metrics in Django that you can monitor. If you
write some for your apps, you could also write some monitoring scripts, too
(probably in the form of a management command).

Best,
Gergely



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-27 22:42 GMT+02:00 Keir W <k...@whitlock.it>:

> Does anyone have any tips on monitoring the health & status of a django
> app, possibly with the use of a Nagios plugin?
>
> I am using check_log to grep out any errors from the apache error log file
> (when using mod_wsgi) but wondered if I was missing a trick and someone had
> something better to try.
>
> Ta.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/12b0d8a7-ceb6-4a9f-a17d-3f05ee9aa2aa%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/12b0d8a7-ceb6-4a9f-a17d-3f05ee9aa2aa%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJq8i6qJfA0zLLw-72RU%2BjPdDZm1RrmOGXXuiS%3Dzd_dYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Completed form for an authenticated user

2016-04-27 Thread Gergely Polonkai
It is indeed unclear, what you want to do. How I understood it:

show a bunch of fields to the user that they can fill with data
then, they press the Save button, and the data gets into the database (or
whatever)
then, you want to show the same fields, filled with the data that the user
just entered

Is this it?

Also, have you gone through the tutorial? If not, I strongly suggest to to
so. It will clear a lot of things both about Django and the web in general.

Best,
Gergely



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-27 19:13 GMT+02:00 Said Akhmedbayev <said@gmail.com>:

> Let's say, for example, I have a reusable form. An authenticated user
> fills out this form and saves it. How then, I can show to the user a page
> with the complete form?
>
> Sorry, for not being able to explain the question clearly, I am new to
> django and to the web development in general.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4165af84-44ec-4494-8613-8396cc6d2e0b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4165af84-44ec-4494-8613-8396cc6d2e0b%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUL_JRtrkzPq7Mjb_NQn9QpSnYFAYB907MbM1a2C_qiePw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using django login functionality in a non django app

2016-04-27 Thread Gergely Polonkai
I would create a separate view for this, like /falcon_login/, which could
give you a plain text result. But that’s totally up to you.



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-27 16:57 GMT+02:00 Larry Martell <larry.mart...@gmail.com>:

> Well, not really. I have managed to invoke my django login screen from
> my Qt app, but after I log in, of course my django app comes up.
>
> What I would like is to pass in some parameter to the login screen
> (which is easy), and then have my django app detect that and after
> successfully or unsuccessfully logging in, return a token or error
> code to the Qt app and not bring up the django app. But I'm not sure
> how to do that.
>
> On Tue, Apr 26, 2016 at 9:27 AM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
> >
> > That means you have to be able to do it via the API. The other solution
> is to pop up a web view for these tasks. However, we are moving out from
> Django field here, as this is getting more and more a falcon/UX-related
> question.
> >
> >
> > Gergely Polonkai
> > about.me/gergely.polonkai
> >
> > 2016-04-26 14:19 GMT+02:00 Larry Martell <larry.mart...@gmail.com>:
> >>
> >> I need to support create user, change password, delete user and forgot
> password.
> >>
> >> On Tue, Apr 26, 2016 at 7:32 AM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
> >> >
> >> >
> >> > That’s not a big issue if you really communicate with Django via a
> web-based API. If the user can’t log in, you can simply redirect them to a
> web page. I don’t see the need for user admin functions, though.
> >> >
> >> >
> >> > Gergely Polonkai
> >> > about.me/gergely.polonkai
> >> >
> >> > 2016-04-26 13:10 GMT+02:00 Larry Martell <larry.mart...@gmail.com>:
> >> >>
> >> >> Well, the issue with simply implementing auth, is that we'd need to
> >> >> not only implement login, which is easy, but also forgot password,
> and
> >> >> all the user admin functions. Since we have that already with django
> I
> >> >> want to leverage that and not reinvent the wheel.
> >> >>
> >> >> On Tue, Apr 26, 2016 at 2:29 AM, Gergely Polonkai <
> gerg...@polonkai.eu> wrote:
> >> >> > Now I somewhat understand what falcon is, I suggest that you simply
> >> >> > implement auth on you web app (it seems to me there is none or
> little right
> >> >> > now. Of course, you don't have to protect all iour views, or you
> may want to
> >> >> > display a different dataset, but that's another topic.
> >> >> >
> >> >> > When that is done, you have to do two things in your Qt app.
> First, make
> >> >> > sure that when the server says that you are not authorized, pop up
> a login
> >> >> > window. After a successful login, store the user's credentials for
> later
> >> >> > use. What type of authentication to use and what to store is up to
> your
> >> >> > decision: HTTP Basic (store user/password), HTTP session (store
> the session
> >> >> > cookie) or token (store the token) based auths are the most common
> examples.
> >> >> >
> >> >> > Best,
> >> >> > Gergely
> >> >> >
> >> >> > On Apr 26, 2016 00:09, "Larry Martell" <larry.mart...@gmail.com>
> wrote:
> >> >> >>
> >> >> >> The Qt app talks to the server with web requests routed to python
> code
> >> >> >> by falcon. It currently has no authentication/authorization of any
> >> >> >> kind. It's not a web app, you can't just navigate to any page,
> you can
> >> >> >> only get to parts of the app the code lets you get to.
> >> >> >>
> >> >> >> The way I envision it (if possible) is that I would have a
> decorator
> >> >> >> just like @login_required, and if that is called and the user is
> not
> >> >> >> logged in, it would invoke the django login page - just like it
> works
> >> >> >> in django. I think I can do most of this, the part I am unclear
> on is
> >> >> >> how I get control from the django login page back to the Qt app.
> >> >&

Re: Using django login functionality in a non django app

2016-04-26 Thread Gergely Polonkai
That means you have to be able to do it via the API. The other solution is
to pop up a web view for these tasks. However, we are moving out from
Django field here, as this is getting more and more a falcon/UX-related
question.



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-26 14:19 GMT+02:00 Larry Martell <larry.mart...@gmail.com>:

> I need to support create user, change password, delete user and forgot
> password.
>
> On Tue, Apr 26, 2016 at 7:32 AM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
> >
> >
> > That’s not a big issue if you really communicate with Django via a
> web-based API. If the user can’t log in, you can simply redirect them to a
> web page. I don’t see the need for user admin functions, though.
> >
> >
> > Gergely Polonkai
> > about.me/gergely.polonkai
> >
> > 2016-04-26 13:10 GMT+02:00 Larry Martell <larry.mart...@gmail.com>:
> >>
> >> Well, the issue with simply implementing auth, is that we'd need to
> >> not only implement login, which is easy, but also forgot password, and
> >> all the user admin functions. Since we have that already with django I
> >> want to leverage that and not reinvent the wheel.
> >>
> >> On Tue, Apr 26, 2016 at 2:29 AM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
> >> > Now I somewhat understand what falcon is, I suggest that you simply
> >> > implement auth on you web app (it seems to me there is none or little
> right
> >> > now. Of course, you don't have to protect all iour views, or you may
> want to
> >> > display a different dataset, but that's another topic.
> >> >
> >> > When that is done, you have to do two things in your Qt app. First,
> make
> >> > sure that when the server says that you are not authorized, pop up a
> login
> >> > window. After a successful login, store the user's credentials for
> later
> >> > use. What type of authentication to use and what to store is up to
> your
> >> > decision: HTTP Basic (store user/password), HTTP session (store the
> session
> >> > cookie) or token (store the token) based auths are the most common
> examples.
> >> >
> >> > Best,
> >> > Gergely
> >> >
> >> > On Apr 26, 2016 00:09, "Larry Martell" <larry.mart...@gmail.com>
> wrote:
> >> >>
> >> >> The Qt app talks to the server with web requests routed to python
> code
> >> >> by falcon. It currently has no authentication/authorization of any
> >> >> kind. It's not a web app, you can't just navigate to any page, you
> can
> >> >> only get to parts of the app the code lets you get to.
> >> >>
> >> >> The way I envision it (if possible) is that I would have a decorator
> >> >> just like @login_required, and if that is called and the user is not
> >> >> logged in, it would invoke the django login page - just like it works
> >> >> in django. I think I can do most of this, the part I am unclear on is
> >> >> how I get control from the django login page back to the Qt app.
> >> >>
> >> >> On Mon, Apr 25, 2016 at 5:26 PM, Gergely Polonkai <
> gerg...@polonkai.eu>
> >> >> wrote:
> >> >> > Hello,
> >> >> >
> >> >> > this all depends on how this Qt app communicates with the other end
> >> >> > (server
> >> >> > side). Does it offer *any* kind of authentication/authorization?
> If so,
> >> >> > look
> >> >> > for ways to integrate it with Django. If not, you are screwed
> anyway
> >> >> > (from
> >> >> > security point of view), because even if your app pops up a login
> >> >> > screen,
> >> >> > there can (and will) be ways to get around it.
> >> >> >
> >> >> > Best,
> >> >> > Gergely
> >> >> >
> >> >> > On Apr 25, 2016 22:37, "Larry Martell" <larry.mart...@gmail.com>
> wrote:
> >> >> >>
> >> >> >> We have an existing django app with login, change password, and
> forgot
> >> >> >> password functionality.
> >> >> >>
> >> >> >> Then we have this other app built with the falcon framework. The
>

Re: Using django login functionality in a non django app

2016-04-26 Thread Gergely Polonkai
That’s not a big issue if you really communicate with Django via a
web-based API. If the user can’t log in, you can simply redirect them to a
web page. I don’t see the need for user admin functions, though.



Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-26 13:10 GMT+02:00 Larry Martell <larry.mart...@gmail.com>:

> Well, the issue with simply implementing auth, is that we'd need to
> not only implement login, which is easy, but also forgot password, and
> all the user admin functions. Since we have that already with django I
> want to leverage that and not reinvent the wheel.
>
> On Tue, Apr 26, 2016 at 2:29 AM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
> > Now I somewhat understand what falcon is, I suggest that you simply
> > implement auth on you web app (it seems to me there is none or little
> right
> > now. Of course, you don't have to protect all iour views, or you may
> want to
> > display a different dataset, but that's another topic.
> >
> > When that is done, you have to do two things in your Qt app. First, make
> > sure that when the server says that you are not authorized, pop up a
> login
> > window. After a successful login, store the user's credentials for later
> > use. What type of authentication to use and what to store is up to your
> > decision: HTTP Basic (store user/password), HTTP session (store the
> session
> > cookie) or token (store the token) based auths are the most common
> examples.
> >
> > Best,
> > Gergely
> >
> > On Apr 26, 2016 00:09, "Larry Martell" <larry.mart...@gmail.com> wrote:
> >>
> >> The Qt app talks to the server with web requests routed to python code
> >> by falcon. It currently has no authentication/authorization of any
> >> kind. It's not a web app, you can't just navigate to any page, you can
> >> only get to parts of the app the code lets you get to.
> >>
> >> The way I envision it (if possible) is that I would have a decorator
> >> just like @login_required, and if that is called and the user is not
> >> logged in, it would invoke the django login page - just like it works
> >> in django. I think I can do most of this, the part I am unclear on is
> >> how I get control from the django login page back to the Qt app.
> >>
> >> On Mon, Apr 25, 2016 at 5:26 PM, Gergely Polonkai <gerg...@polonkai.eu>
> >> wrote:
> >> > Hello,
> >> >
> >> > this all depends on how this Qt app communicates with the other end
> >> > (server
> >> > side). Does it offer *any* kind of authentication/authorization? If
> so,
> >> > look
> >> > for ways to integrate it with Django. If not, you are screwed anyway
> >> > (from
> >> > security point of view), because even if your app pops up a login
> >> > screen,
> >> > there can (and will) be ways to get around it.
> >> >
> >> > Best,
> >> > Gergely
> >> >
> >> > On Apr 25, 2016 22:37, "Larry Martell" <larry.mart...@gmail.com>
> wrote:
> >> >>
> >> >> We have an existing django app with login, change password, and
> forgot
> >> >> password functionality.
> >> >>
> >> >> Then we have this other app built with the falcon framework. The
> >> >> client side of that is C++/Qt. That app has no login functionality -
> >> >> you bring it up and you're in. We would like to somehow use the login
> >> >> functionality of the django app in the falcon app. Is that even
> >> >> possible? I was thinking that in the Qt app I could bring up the
> >> >> django login page by invoking the URL for that app. But once they log
> >> >> in, how could I get control back to the Qt app and not have it
> proceed
> >> >> to the django app?
> >> >>
> >> >> Does this even make any sense? Has anyone ever done anything like
> this?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY6_P7B7PZK6PRCt%3D2m0JyQ%2BejcMLp-1Q%2B7C2N-5rfyxZg%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJF7654A-dgJ5-JwYsi_WXdPnusnknT83iRqgT59iw9XQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using django login functionality in a non django app

2016-04-26 Thread Gergely Polonkai
Now I somewhat understand what falcon is, I suggest that you simply
implement auth on you web app (it seems to me there is none or little right
now. Of course, you don't have to protect all iour views, or you may want
to display a different dataset, but that's another topic.

When that is done, you have to do two things in your Qt app. First, make
sure that when the server says that you are not authorized, pop up a login
window. After a successful login, store the user's credentials for later
use. What type of authentication to use and what to store is up to your
decision: HTTP Basic (store user/password), HTTP session (store the session
cookie) or token (store the token) based auths are the most common examples.

Best,
Gergely
On Apr 26, 2016 00:09, "Larry Martell" <larry.mart...@gmail.com> wrote:

> The Qt app talks to the server with web requests routed to python code
> by falcon. It currently has no authentication/authorization of any
> kind. It's not a web app, you can't just navigate to any page, you can
> only get to parts of the app the code lets you get to.
>
> The way I envision it (if possible) is that I would have a decorator
> just like @login_required, and if that is called and the user is not
> logged in, it would invoke the django login page - just like it works
> in django. I think I can do most of this, the part I am unclear on is
> how I get control from the django login page back to the Qt app.
>
> On Mon, Apr 25, 2016 at 5:26 PM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
> > Hello,
> >
> > this all depends on how this Qt app communicates with the other end
> (server
> > side). Does it offer *any* kind of authentication/authorization? If so,
> look
> > for ways to integrate it with Django. If not, you are screwed anyway
> (from
> > security point of view), because even if your app pops up a login screen,
> > there can (and will) be ways to get around it.
> >
> > Best,
> > Gergely
> >
> > On Apr 25, 2016 22:37, "Larry Martell" <larry.mart...@gmail.com> wrote:
> >>
> >> We have an existing django app with login, change password, and forgot
> >> password functionality.
> >>
> >> Then we have this other app built with the falcon framework. The
> >> client side of that is C++/Qt. That app has no login functionality -
> >> you bring it up and you're in. We would like to somehow use the login
> >> functionality of the django app in the falcon app. Is that even
> >> possible? I was thinking that in the Qt app I could bring up the
> >> django login page by invoking the URL for that app. But once they log
> >> in, how could I get control back to the Qt app and not have it proceed
> >> to the django app?
> >>
> >> Does this even make any sense? Has anyone ever done anything like this?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY5NrpmqBKjEcrvFEFLKiz%3D0DyL4oGueUKDvb37wZTO6Gg%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BbBHCzn-U_gEmoYFF%2BVz8vQNkhnMiGp-mv4Dn7_5BmJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using django login functionality in a non django app

2016-04-25 Thread Gergely Polonkai
Hello,

this all depends on how this Qt app communicates with the other end (server
side). Does it offer *any* kind of authentication/authorization? If so,
look for ways to integrate it with Django. If not, you are screwed anyway
(from security point of view), because even if your app pops up a login
screen, there can (and will) be ways to get around it.

Best,
Gergely
On Apr 25, 2016 22:37, "Larry Martell"  wrote:

> We have an existing django app with login, change password, and forgot
> password functionality.
>
> Then we have this other app built with the falcon framework. The
> client side of that is C++/Qt. That app has no login functionality -
> you bring it up and you're in. We would like to somehow use the login
> functionality of the django app in the falcon app. Is that even
> possible? I was thinking that in the Qt app I could bring up the
> django login page by invoking the URL for that app. But once they log
> in, how could I get control back to the Qt app and not have it proceed
> to the django app?
>
> Does this even make any sense? Has anyone ever done anything like this?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY4vgxwa6xCyem%3DG_OusAAfKcx5n-mixERNFDBdFknisoA%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJBXK-Y2Z8_VtidiTNpuNUZXi7hCruVTfx72cPDc87m9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can not read request.body from a POST request

2016-04-21 Thread Gergely Polonkai
A JSON/XML payload, for example. If you use plain Django (on DRF and other
extensions), then request.body is the only way to access said payload.

Best,
Gergely




Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-21 14:17 GMT+02:00 Vijay Khemlani <vkhem...@gmail.com>:

> What could be in the body that's not in the supplied Django fields?
>
> I have implemented RESTful APIs as you say (no idea why that matters as
> they are just HTTP requests) and never had the need to read the actual
> body..
>
> On Thu, Apr 21, 2016 at 2:13 AM, Gergely Polonkai <gerg...@polonkai.eu>
> wrote:
>
>> Vijay: They are not the same thing. request.POST, .GET and .FILES are
>> exactly that, POST and GET data and the optional uploaded files. However,
>> in e.g. a RESTful environment it is possible to have something else in the
>> request body.
>>
>> Mihai, what else do you do with the request before trying to read its
>> body?
>>
>> Best,
>> Gergely
>> They aree
>>
>> [image: --]
>>
>> Gergely Polonkai
>> [image: https://]about.me/gergely.polonkai
>>
>> <https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=external_link_campaign=chrome_ext>
>>
>>
>>
>>
>> Gergely Polonkai
>> [image: https://]about.me/gergely.polonkai
>>
>> <https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>
>>
>> 2016-04-20 22:44 GMT+02:00 Vijay Khemlani <vkhem...@gmail.com>:
>>
>>> Why would you want to access request.body directly? You should use
>>> request.POST, request.GET, request.FILES.
>>>
>>> On Wed, Apr 20, 2016 at 5:27 PM, Mihai Corciu <cor...@gmail.com> wrote:
>>>
>>>> Is there a method to access request.body from a POST request in Django,
>>>> without disabling 'django.middleware.csrf.CsrfViewMiddleware' ?
>>>>
>>>> CsrfViewMiddleware is causing:
>>>>
>>>> Exception Type: RawPostDataException
>>>> Exception Value: You cannot access body after reading from
>>>> request's data stream
>>>>
>>>> which means request.body is impossible to acces without disabling
>>>> CsrfViewMiddleware.
>>>>
>>>> --
>>>> 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 https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/9e35deeb-5586-46ec-8d54-648acdafbb8d%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/9e35deeb-5586-46ec-8d54-648acdafbb8d%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CALn3ei0%3DUx0euOS7XZ9Wb6cw9yMvKeqGwQO0cu37Y60broG%2Bvw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CALn3ei0%3DUx0euOS7XZ9Wb6cw9yMvKeqGwQO0cu37Y60broG%2Bvw%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
&

Re: remove ./ from commands

2016-04-21 Thread Gergely Polonkai
This is not a Django question per se, but you can either use

python manage.py

or add the directory where the manage.py script reside to the path. This
latter depends on what shell you use, but I guess it’s the default of OS X,
so your command becomes this:

export PATH="/Path/where/your/project/lives:$PATH"

After this one, you can enter plain

manage.py


Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-21 6:46 GMT+02:00 <ken.fo...@catapultconsulting.net>:

> I just installed django 1.9.5.  Now I have to type ./manage.py when I used
> to just type manage.py.  How do I get rid of the need to type ./
> osx el capitan
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8c85511f-b848-4e20-8339-5bcb403184eb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8c85511f-b848-4e20-8339-5bcb403184eb%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BJ99YsqGmNx9c-7gSP2jN0eN7czxwBUyazdbF73xiiMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can not read request.body from a POST request

2016-04-20 Thread Gergely Polonkai
Vijay: They are not the same thing. request.POST, .GET and .FILES are
exactly that, POST and GET data and the optional uploaded files. However,
in e.g. a RESTful environment it is possible to have something else in the
request body.

Mihai, what else do you do with the request before trying to read its body?

Best,
Gergely
They aree

[image: --]

Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=external_link_campaign=chrome_ext>




Gergely Polonkai
[image: https://]about.me/gergely.polonkai
<https://about.me/gergely.polonkai?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>

2016-04-20 22:44 GMT+02:00 Vijay Khemlani <vkhem...@gmail.com>:

> Why would you want to access request.body directly? You should use
> request.POST, request.GET, request.FILES.
>
> On Wed, Apr 20, 2016 at 5:27 PM, Mihai Corciu <cor...@gmail.com> wrote:
>
>> Is there a method to access request.body from a POST request in Django,
>> without disabling 'django.middleware.csrf.CsrfViewMiddleware' ?
>>
>> CsrfViewMiddleware is causing:
>>
>> Exception Type: RawPostDataException
>> Exception Value: You cannot access body after reading from request's
>> data stream
>>
>> which means request.body is impossible to acces without disabling
>> CsrfViewMiddleware.
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/9e35deeb-5586-46ec-8d54-648acdafbb8d%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/9e35deeb-5586-46ec-8d54-648acdafbb8d%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALn3ei0%3DUx0euOS7XZ9Wb6cw9yMvKeqGwQO0cu37Y60broG%2Bvw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALn3ei0%3DUx0euOS7XZ9Wb6cw9yMvKeqGwQO0cu37Y60broG%2Bvw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULiJRUvHWiY0fXjs0eMbdsEW5r7-vWbzWZWGwaxMt5mjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrating older 1.4 project to 1.9

2016-03-30 Thread Gergely Polonkai
I have already suggested this approach to someone with a similar problem:
upgrade one version at a time. I’m sure it is possible to find older
versions; 1. upgrade to the next minor release (1.4 => 1.5, etc), 2. do the
necessary adjustments, 3. goto 1.

It may be a lot of work, but at the end of the day you will have a
perfectly upgraded application. I have successfully upgraded 3 apps this
way, one of them being really big (tens of thousands of code lines).
Roger,

Yeah, I too have a large project that I'll hopefully be migrating
from 1.4 to 1.9 soon.

It's about 3.5 years worth of work, over 200,000 lines of code
in about 1000 Python source file and Django template files.

So any tips you come up with will be invaluable.  Please post
anything you learn to this thread.

Thanks!
--Fred
--
Fred Stluka -- mailto:f...@bristle.com  --
http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
--
On 3/30/16 9:23 AM, bobhaugen wrote:

We feel your pain. If you do it, and write down how it goes, we would be
grateful.
https://github.com/valnet/valuenetwork

On Tuesday, March 29, 2016 at 4:19:59 PM UTC-5, Roger Dunn wrote:
>
> I've inherited a moderately large project written 2 years ago using Django
> 1.4, and wondering if it is worth creating a fresh 1.9 project and porting
> in the old code, or doing an in-place upgrade to 1.9?
>
> I have it running on 1.4 'as is' but if I run* python manage.py migrate*
> it comes unglued as a lot of stuff has changed since 1.4.
>
>
>
> --
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/2a3de1fc-5032-4807-b008-66f2e381ac7f%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/56FBDDBE.9020409%40bristle.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BhDnDtD4WwkAPGWc4W0Zq9wz-iK%3DdmcNn0ONAijG8feQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: testing django migrations

2015-12-27 Thread Gergely Polonkai
I'm also interested in that, except that I'd like to test RunPython steps.
On Dec 28, 2015 12:32 AM, "Dan Tagg"  wrote:

> Hi,
>
> I used this:
> https://github.com/plumdog/django_migration_testcase
>
> It's only worth writing tests if you are modifying code created by
> makemigrations.
>
> Dan
>
> On 27 December 2015 at 10:14, varun naganathan <
> varunnaganathan...@gmail.com> wrote:
>
>> Hi,I wanted to know how am i supposed to test the working of django
>> migrations.As in how the migrations generate the SQL query.Basically I want
>> to inspect how the sql query generated as in the output of "./manage.py
>> sqlmigrate" is being generated.I've generally used "pdb" along wth
>> unittest.TestCase,but for migrations I'm pretty much stuck.Does anyone
>> probably have a sample test they wrote to test the django migrations.
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/b6364f7e-56ab-4682-ad0a-3684e6199c8f%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Wildman and Herring Limited, Registered Office: 52 Great Eastern Street,
> London, EC2A 3EP, Company no: 05766374
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPZHCY5CJ_9jex%2BnKNi%3DCy2XG9X9zrLS%3DJBW-mUmDoCpK6%2BTPA%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUL7z8M8nPbsAO2jM2EvyMCqxT4JJVGGSvA8MW__a8E6VQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: calling html file from within javascript

2015-12-13 Thread Gergely Polonkai
Sorry, I have pressed Send too soon…

As you see, using document.write is a very bad idea. However, freezing is
not mentioned in that document. What does freezing mean in this case? Are
you sure it's this code that gets executed and freezes?

Also, what exactly do you want to achieve?

Best,
Gergely
On Dec 14, 2015 7:52 AM, "Gergely Polonkai" <gerg...@polonkai.eu> wrote:

> Hello,
>
> although this is barelyDjango related, here are some notes.
>
> From MDN[1]: Note: as* document.write* writes to the document *stream*,
> calling *document.write* on a closed (loaded) document automatically calls
> *document.open* which will clear the document
> <https://developer.mozilla.org/en-US/docs/Web/API/document.open#Notes>.
>
> [1] https://developer.mozilla.org/en-US/docs/Web/API/Document/write
> On Dec 14, 2015 1:22 AM, "Gary Roach" <gary719_li...@verizon.net> wrote:
>
>> I use javascript in my  main.html (top template) to control the access to
>> several buttons. The buttons call a javascript function. This setup works
>> exactly as I wish except the buttons still don't really do anything. I need
>> to have each button load a different template. The pertinent script is:
>>
>> 
>> "use strict"
>> var bn = ""
>> function buttoncontrol(bn){
>> var i = 0;
>> var bx = "";
>> var x = []; /*array*/
>> if (bn=="resetDone")
>> {
>> for (var i = 0; i < 4; i++)
>> {
>> bx= "b" + (i+1);
>> document.getElementById(bx)
>> .removeAttribute("disabled");
>> }
>> return
>> }
>> else {
>> for (var i = 0; i < 4; i++)
>> {
>> bx= "b" + (i+1);
>> document.getElementById(bx)
>> .setAttribute("disabled", "true");
>> }
>> switch(bn) {
>> case "b1":
>> document.write("<a href=
>> 'welcome.html'>'Welcome.html'</a>");
>>  break;
>> case "b2":
>> break;
>> case "b3":
>> break;
>> case "b4":
>> break;
>> default:
>> document.write("fell out the bottom");
>> }
>> return;
>> }
>> }
>>
>> 
>>
>> The code works till it hits the document.write statement and freezes.
>> This just plain doesn't work. What would. I want to keep this approach, so
>> I need an alternative to the  document.write statement.
>>
>> Both my main.html and my welcome.html are in the same template directory.
>> I bypassed the button during development and the two pages worked well
>> together.
>>
>> Django 1.8
>> Python 3.4
>>
>> Gary R.
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/566E0BC0.8020100%40verizon.net
>> .
>> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJERe5jZR37%3DjBF3N7QMRiwR6kWNRWO%3DzxG273EzCLsDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: calling html file from within javascript

2015-12-13 Thread Gergely Polonkai
Hello,

although this is barelyDjango related, here are some notes.

>From MDN[1]: Note: as* document.write* writes to the document *stream*,
calling *document.write* on a closed (loaded) document automatically calls
*document.open* which will clear the document
.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Document/write
On Dec 14, 2015 1:22 AM, "Gary Roach"  wrote:

> I use javascript in my  main.html (top template) to control the access to
> several buttons. The buttons call a javascript function. This setup works
> exactly as I wish except the buttons still don't really do anything. I need
> to have each button load a different template. The pertinent script is:
>
> 
> "use strict"
> var bn = ""
> function buttoncontrol(bn){
> var i = 0;
> var bx = "";
> var x = []; /*array*/
> if (bn=="resetDone")
> {
> for (var i = 0; i < 4; i++)
> {
> bx= "b" + (i+1);
> document.getElementById(bx)
> .removeAttribute("disabled");
> }
> return
> }
> else {
> for (var i = 0; i < 4; i++)
> {
> bx= "b" + (i+1);
> document.getElementById(bx)
> .setAttribute("disabled", "true");
> }
> switch(bn) {
> case "b1":
> document.write(" 'welcome.html'>'Welcome.html'");
>  break;
> case "b2":
> break;
> case "b3":
> break;
> case "b4":
> break;
> default:
> document.write("fell out the bottom");
> }
> return;
> }
> }
>
> 
>
> The code works till it hits the document.write statement and freezes. This
> just plain doesn't work. What would. I want to keep this approach, so I
> need an alternative to the  document.write statement.
>
> Both my main.html and my welcome.html are in the same template directory.
> I bypassed the button during development and the two pages worked well
> together.
>
> Django 1.8
> Python 3.4
>
> Gary R.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/566E0BC0.8020100%40verizon.net
> .
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2Bbdr%3DNT6Jp2dqC25mzO%3DrZccQK2b-gK05ACPLgJFmGug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Working with forms.Form

2015-12-06 Thread Gergely Polonkai
Hello,

you should use ModelForm; if the only problem you have is the CSS
properties, you may assign custom CSS classes to your widgets, and use
templates to render your fields individually.

Best,
Gergely
On Dec 6, 2015 5:33 PM, "Teddy McZieuwa"  wrote:

> Hi,
> please, I am new to django, I just need to know to save to a database
> while using 'forms.Form' utility and how does it know which database model
> to use. I do not want to use the 'forms.ModelForm' because i would like to
> customize, I don't want django giving me its default style form.
> Please I really need help ASAP. 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/b0474e0d-4cac-4b6f-8396-87208d4e0dc7%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/CACczBUKsA0M7LStkf0JLQCCkD0C9gmRd3yBMBOXv7Ox-9uzk9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Recursion error after upgrading from 1.8 to 1.9

2015-12-02 Thread Gergely Polonkai
New info: I have removed everything after django.contrib.staticfiles, but
the problem still persists.

2015-12-02 11:57 GMT+01:00 Gergely Polonkai <gerg...@polonkai.eu>:

> I have upgraded Django from 1.8.5 to 1.9. Running my tests fails with this:
>
> RuntimeError: maximum recursion depth exceeded while calling a Python
> object
>
> My INSTALLED_APPS:
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'form_utils',
> 'django_fsm',
> 'django_fsm_log',
> 'compressor',
> 'rest_framework',
> 'rest_framework.authtoken',
> 'django_js_reverse',
> 'bootstrap3',
> 'timezone_field',
> 'builds',
> 'accounts',
> 'api',
> 'process',
> )
>
> I’m in the process of filtering this, but if anyone has some idea, don’t
> hesitate to share :)
>
> Best,
> Gergely
>

-- 
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/CACczBUKLxo42T0OaFQ8dY5WTAnsBsicQF%2BXggY1tt7TxFefyZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Recursion error after upgrading from 1.8 to 1.9

2015-12-02 Thread Gergely Polonkai
I have upgraded Django from 1.8.5 to 1.9. Running my tests fails with this:

RuntimeError: maximum recursion depth exceeded while calling a Python object

My INSTALLED_APPS:

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'form_utils',
'django_fsm',
'django_fsm_log',
'compressor',
'rest_framework',
'rest_framework.authtoken',
'django_js_reverse',
'bootstrap3',
'timezone_field',
'builds',
'accounts',
'api',
'process',
)

I’m in the process of filtering this, but if anyone has some idea, don’t
hesitate to share :)

Best,
Gergely

-- 
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/CACczBU%2BcWuScjjBjFu-L%3Dzx_v%2BEGJ6pQ2NhDKayNXUrTOieFKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fixed column width in admin interface?

2015-11-14 Thread Gergely Polonkai
Or you can apply a CSS with overflow: ellipsis; whichever fits you.
On 14 Nov 2015 17:10, "Simon Charette"  wrote:

> Hi Jorgue,
>
> You can simply define a `list_display` method
> 
> that truncates your text if required and append an ellipsis.
>
> e.g.
>
> class FooAdmin(admin.ModelAdmin):
> list_display = ['text_field_ellipsis']
>
> def text_field_ellipsis(self, obj):
> if len(obj.text_field) > max_length:
> return "%s..." % obj.text_field[:max_length]
> return obj.text_field
>
> Cheers,
> Simon
>
> Le samedi 14 novembre 2015 10:49:09 UTC-5, Jorge Fernandez-de-Cossio-Diaz
> a écrit :
>>
>> A column of my Django admin interface sometimes has too much text. When
>> this happens, I would like to replace the last part of the text with "...",
>> so that the column width doesn't gets past a maximum character count. How
>> can I do this?
>>
> --
> 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/f86671ca-0645-4567-a3b2-1372d55f7308%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/CACczBU%2BZwzpgbAQGTBXx%2ByFRdi6ri%3DveUy%3DpQrUrOrHXa0%2BZGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django on CentOS

2015-11-09 Thread Gergely Polonkai
Hello,

there’s a lot that is not clear for me in your included config:

• Why are all those paths in WSGIPythonPath?
• Are there Python modules in those directories?
• Do I get it right that your application is installed under /var/www
(which is generally a bad idea)?
• Is pizzaclub/settings.py available if you stand in any of those
directories? (Ie. try cd ; ls pizzaclub/settings.py)

Best,
Gergely

2015-11-09 9:48 GMT+01:00 Robin Fourcade :

> Hello, thanks for the answer.
>
> I've this code in my wsgi:
>
> import os, sys
> #Calculate the path based on the location of the WSGI script
> apache_configuration = os.path.dirname(__file__)
> project = os.path.dirname(apache_configuration)
> workspace = os.path.dirname(project)
> sys.path.append(workspace)
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'pizzaclub.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> And I don't know how to find the error as it works well when I run the
> project with manage.py.
>
> My settings file is there:
> /var/www/html/pizzaclub/pizza_club/settings.py
>
> I just added this in httpd.conf:
>
> Include "/var/www/html/pizzaclub/public/django_wsgi.conf"
>
>
> and this in the wsgi:
>
> Alias /static/ /var/www/html/pizzaclub/public/static/
> Alias /media/ "/var/www/html/pizzaclub/public/media/"
>
> WSGIScriptAlias / "/var/www/html/pizzaclub/public/pizzaclub.wsgi"
> WSGIPythonPath
> /var/www/html/emergence/:/var/www/html/pizzaclub/pizza_club:/var/www/html/pizzaclub/pizza_club/db:/var/www/html/pizzaclub/public/media:/var/www/html/pizzaclub/apache:/usr/bin/python
>
> 
> Allow from all
> 
>
> Thanks again for your 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/ec3bba44-a637-48e5-9636-ff5ffadd13e6%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/CACczBULzD%2BOH0viJBB5hTxEedWj%2B4umH24sDzON9AJKeVTdUzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django on CentOS

2015-11-08 Thread Gergely Polonkai
Hello,

no, the problem is here:

[Sun Nov 08 14:46:43 2015] [error] [client 109.10.154.52] ImportError:
Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No
module named pizzaclub.settings, referer:http 
://212.227.107.82/ 

It seems that your settings file is either missing, or Apache is
misconfigured so mod_wsgi can not find it.
On 8 Nov 2015 21:59, "Robin Fourcade"  wrote:

> Hi,
> Thanks for your answer !
> (I'd add that even if apache is running, if I run the server on the port
> 8000, I can acces the django project on this port without any issue)
>
> Here's the log
>
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] mod_wsgi
> (pid=22420): Exception occurred processing WSGI script
> '/var/www/html/pizzaclub/public/pizzaclub.wsgi'.
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] Traceback (most
> recent call last):
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 219,
> in __call__
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self.load_middleware()
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 37,
> in load_middleware
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] for
> middleware_path in settings.MIDDLEWARE_CLASSES:
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 184, in
> inner
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] self._setup()
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 42, in
> _setup
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self._wrapped = Settings(settings_module)
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 95, in
> __init__
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] raise
> ImportError("Could not import settings '%s' (Is it on sys.path?): %s" %
> (self.SETTINGS_MODULE, e))
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] ImportError:
> Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No
> module named pizzaclub.settings
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] mod_wsgi
> (pid=22420): Exception occurred processing WSGI script
> '/var/www/html/pizzaclub/public/pizzaclub.wsgi'., referer:
> http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] Traceback (most
> recent call last):, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 219,
> in __call__, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self.load_middleware(), referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 37,
> in load_middleware, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] for
> middleware_path in settings.MIDDLEWARE_CLASSES:, referer:
> http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 184, in
> inner, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self._setup(), referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 42, in
> _setup, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]
> self._wrapped = Settings(settings_module), referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 95, in
> __init__, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] raise
> ImportError("Could not import settings '%s' (Is it on sys.path?): %s" %
> (self.SETTINGS_MODULE, e)), referer: http://212.227.107.82/
> [Sun Nov 08 14:46:41 2015] [error] [client 109.10.154.52] ImportError:
> Could not import settings 'pizzaclub.settings' (Is it on sys.path?): No
> module named pizzaclub.settings, referer: http://212.227.107.82/
> [Sun Nov 08 14:46:42 2015] [error] [client 109.10.154.52] mod_wsgi
> (pid=22420): Exception occurred processing WSGI script
> '/var/www/html/pizzaclub/public/pizzaclub.wsgi'.
> [Sun Nov 08 14:46:42 2015] [error] [client 109.10.154.52] Traceback (most
> recent call last):
> [Sun Nov 08 14:46:42 2015] [error] 

Re: Managing and synchronising users on multiple sites

2015-11-08 Thread Gergely Polonkai
I meant web based SSO :) The aforementioned Stack Exchange sites work like
this; when you authenticate to one of their sites, you actually
authenticate to Stack Exchange, which sets a cookie that is processed by
the sites. This can be done by one of the already available web servers
(although a separate one would be the best)
On 8 Nov 2015 21:09, "Stodge" <sto...@gmail.com> wrote:

> The servers are in DMZs in different cities. I don't control the firewall
> configuration and I'm not allowed to open extra ports.
>
> On Sunday, 8 November 2015 14:18:37 UTC-5, Gergely Polonkai  wrote:
> > How about an SSO solution hosted at one of the sites? When the user logs
> in, the site authenticates them against the SSO, and fetches user data. See
> Stack Exchange sites (Stack Overflow, Server Fault, etc) as an example.
> >
> > On 8 Nov 2015 18:24, "Stodge" <sto...@gmail.com> wrote:
> > I have several Django sites and I need to synchronize user accounts
> across them all. I need the ability to create the same user on all sites at
> the same time and also to keep their info in sync. The servers are in
> different locations in DMZs and can't open connections to external servers.
> So no third party access. I thought I could write a Java app that uses a
> REST API to query and update accounts to synchronize them but that opens a
> security issue as I have to expose the ability to read/write passwords. I
> can't think of any other solutions - any ideas? Thanks
> >
> >
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> >
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com.
> >
> > To post to this group, send email to django...@googlegroups.com.
> >
> > Visit this group at http://groups.google.com/group/django-users.
> >
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c05af7b9-965c-47d9-9106-524a1e6cd46d%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/5cd372d7-9b36-4fe2-8381-dfcd69e63eba%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/CACczBUJ_TCH3jJczBUf%2BzLViTsVF1nzTsN%2Bzn7aKDTnsjp5akA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: finding information on modules, imports, etc.

2015-11-08 Thread Gergely Polonkai
It's a bit unclear what you want to do. Could you write a use case? I'm
afraid of an XY problem here…
On 8 Nov 2015 18:25, "Gary Roach"  wrote:

> I can't seem to find a "dictionary" of modules? or what ever on the use of:
>
> import os or other possible imports
>
> from django.contrib  import admin  possibilities.>
>
> Maybe I'm using the wrong terminology but after a gazillion searches, I
> still haven't found a decent reference.
>
> Any help to this relatively new user would be sincerely appreciated.
>
>
> Gary R.
>
> --
> 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/563F8575.1000208%40verizon.net
> .
> 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/CACczBULYKLmZ4bB%2BqDQAQqZjFPF2TN7ciyhhjBPb5k7TZSapDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Managing and synchronising users on multiple sites

2015-11-08 Thread Gergely Polonkai
How about an SSO solution hosted at one of the sites? When the user logs
in, the site authenticates them against the SSO, and fetches user data. See
Stack Exchange sites (Stack Overflow, Server Fault, etc) as an example.
On 8 Nov 2015 18:24, "Stodge"  wrote:

> I have several Django sites and I need to synchronize user accounts across
> them all. I need the ability to create the same user on all sites at the
> same time and also to keep their info in sync. The servers are in different
> locations in DMZs and can't open connections to external servers. So no
> third party access. I thought I could write a Java app that uses a REST API
> to query and update accounts to synchronize them but that opens a security
> issue as I have to expose the ability to read/write passwords. I can't
> think of any other solutions - any ideas? 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/c05af7b9-965c-47d9-9106-524a1e6cd46d%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/CACczBUKsafmFD1BCjZy97q42SME2-t-0-ao5-rf6w4T%2BME%3Dbew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: coding in template

2015-11-07 Thread Gergely Polonkai
That depends on your text editor. Most of them make it possible to choose
an encoding in the save dialog.

2015-11-07 21:56 GMT+01:00 Dariusz Mysior :

> How can I save in other coding, I had only option "save as" and name of
> file index.html
>
> W dniu sobota, 7 listopada 2015 21:44:25 UTC+1 użytkownik Dariusz Mysior
> napisał:
>>
>> I try use polish letters in my template index.html but I had an error
>>
>>
>> utf-8' codec can't decode byte 0xb3 in position 149: invalid start byte
>>>
>>>
>> How can I fix it?
>>
>> --
> 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/cdb1e75c-4ad3-4cb4-8f70-4d7ae03a9c81%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/CACczBU%2Budi2EAQEbfnpygK_HhxuwfGRCsdeqSNHew3CDOKvK9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: coding in template

2015-11-07 Thread Gergely Polonkai
Hello,

I guess seems that your template is saved in LATIN2 encoding (in which 0xb3
is ł). Save it in UTF-8, or set up Django to use LATIN2 as the encoding
instead of Unicode (I suggest to go with the first option, though).

Best,
Gergely

2015-11-07 21:44 GMT+01:00 Dariusz Mysior :

> I try use polish letters in my template index.html but I had an error
>
>
> utf-8' codec can't decode byte 0xb3 in position 149: invalid start byte
>>
>>
> How can I fix it?
>
> --
> 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/bce1852e-9f2e-482d-9037-5fac55afa487%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/CACczBUKP0omCPACuTxM8qSY3HV2DGE4T_RyiUMGd1neGP-xzyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I relate two tables using field name instead of id?

2015-11-05 Thread Gergely Polonkai
If you go with the current solution, you will have to add the to_field
keyword argument to ForeignKey:

clinician = models.ForeignKey(Clinician, to_field='name')

Best,
Gergely

2015-11-05 15:47 GMT+01:00 frocco :

> Thanks, I will look into adding id
>
> If I just do this, clinician = models.ForeignKey(Clinician)
> I get clinician_id does not exist
>
> In my related table I have
>
> def __unicode__(self):
> return self.clinicianname
>
>
> On Wednesday, November 4, 2015 at 11:19:40 AM UTC-5, frocco wrote:
>>
>> Hello,
>>
>> I have two existing tables
>> table1 has name1
>>
>> table2 has name2
>>
>> when I edit table2 in admin, I want a dropdownbox that shows values from
>> table1 using name1
>> both fields are character
>>
>> I cannot change the design, porting from msaccess
>>
>> 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/44660e3a-cd6c-4858-8b29-d1dc4ceeced0%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/CACczBULUX9nMhjMFgM54ZQ3CZiNNZPLTjBeidO9-f%2BVzR30zGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I relate two tables using field name instead of id?

2015-11-05 Thread Gergely Polonkai
It is possible, but in an SQL database it may become ineffective. For this,
you will have to make the name field unique, and put an index on it
(uniqueness also creates an index, by the way).

For the admin site to display names, though, you still have to define the
__str__() method that does only something like "return self.name".

However, based on what I said above, if I were you, I would convert the
access database so the tables use integer IDs for foreign keys. The admin
site will need to fetch data from the other table in both cases, but it can
speed up indexing and usage on the long run.

2015-11-05 15:08 GMT+01:00 frocco :

> The two models from msaccess are linked by name field, not id.
> Can I like by name field in django and not use id?
>
> There was no id in the table
>
> On Wednesday, November 4, 2015 at 12:35:49 PM UTC-5, Dheerendra Rathor
> wrote:
>>
>> In your model use define __str__ method to name1. Then django admin will
>> use name1 in dropdown box.
>>
>> On Wed, 4 Nov 2015 at 21:50 frocco  wrote:
>>
>>> Hello,
>>>
>>> I have two existing tables
>>> table1 has name1
>>>
>>> table2 has name2
>>>
>>> when I edit table2 in admin, I want a dropdownbox that shows values from
>>> table1 using name1
>>> both fields are character
>>>
>>> I cannot change the design, porting from msaccess
>>>
>>> thanks
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/756fc995-1c2c-4aee-a074-0a327dbc84e0%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/b76f6937-5be1-4025-8fe0-093f4542a527%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/CACczBUJHosmjBKanE_0x95412YGjOQ9%3DTkD%3DkdTHwXZuhsB%3DtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I relate two tables using field name instead of id?

2015-11-04 Thread Gergely Polonkai
This really depends on the structure of your models. In this case you will
most likely have a ForeignKey in one of your models; if the referenced
model has an __str__() method, the admin site (and also any other forms)
will display names instead of the text "OtherModel object".
On 4 Nov 2015 17:19, "frocco"  wrote:

> Hello,
>
> I have two existing tables
> table1 has name1
>
> table2 has name2
>
> when I edit table2 in admin, I want a dropdownbox that shows values from
> table1 using name1
> both fields are character
>
> I cannot change the design, porting from msaccess
>
> 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/756fc995-1c2c-4aee-a074-0a327dbc84e0%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/CACczBUJif1WaNEE-EJ4%3DCgwKxPHFNj6nVJy39FmYN3KhXozyug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best practices for writing functional tests to exercise forms?

2015-11-04 Thread Gergely Polonkai
An even more fine grained solution may be using an HTML parser like
beautifulsoup. However, if your site's functionality depends on client side
features like JavaScript, Selenium may be a better alternative.
On 4 Nov 2015 18:33, "Dheerendra Rathor"  wrote:

> You can use unittest.TestCase.assertRegexpMatches for checking if form is
> present in rendered template.
> If you want to check the entire cycle (form loading, filling) you can use
> selenium for testing on live server.
>
> On Wed, 4 Nov 2015 at 22:08 Tim Chase 
> wrote:
>
>> Beginning a new project, I'd like to include functional testing in
>> addition to my unit tests.  What are recommended best practices for
>> exercising form-classes?  I was hoping to do something like
>>
>>   c = django.test.Client()
>>   results = c.get(page_url)
>>   frm = SomeForm()
>>   # pseudo-code for desired functional testing follows
>>   self.assertFormIn(frm, results) # check the form is used
>>   frm["name"] = "Pat Smith"
>>   frm["email"] = "psm...@example.com"
>>   results = c.post(page_url, frm) # submit the filled-out form
>>   # check results for error messages and/or success here
>>
>> Is there some piece of Django that I've missed that would facilitate
>> higher-level tests like this?
>>
>> Thanks,
>>
>> -tkc
>>
>>
>>
>> --
>> 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/20151104103632.38e014a4%40bigbox.christie.dr
>> .
>> 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/CAByqUgj%2BeqyPr5b%2BVSu9AJ_45QZ5UgyrUn3G3pmxpSsN9SvHVg%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/CACczBUJf9ipkbETNG5BqX1wwiBpR7z83Lwix8z1fM%2BD_E5Trfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: can I write Django a client consuming RESTfull api from elsewhere

2015-11-04 Thread Gergely Polonkai
On 4 Nov 2015 17:31, "kk"  wrote:
>
>
> Ok one question,
> I would like to store a client connection in some kind of a global place
for my entire Django frontend.
> So that the request object can be used from any view.
> Can you suggest some guideline to do this?
> Happy hacking.
> Krishnakant.

That *may* work in your development server, but not in production. Most
production environments run instances on a per-request basis, so the global
connection you open for connection A will most probably be closed when the
connection B arrives.

>
>
> On Tuesday 03 November 2015 08:35 PM, Remco Gerlich wrote:
>>
>> Django code is just normal Python. Python can call REST APIs, sure (a
nice library is Requests: docs.python-requests.org/en/latest/ )
>>
>> Doing this in the view means that the user has to wait until the request
ends before he gets a response. Possibly this will make the view too slow.
You could also do the API requests in the background using Celery, and show
the results some other way.
>>
>> Remco Gerlich
>>
>>
>> On Tue, Nov 3, 2015 at 12:44 PM, kk  wrote:
>>>
>>> Dear all,
>>> I wish to know if I need to do some thing special for consuming a
RESTfull server from some other provider?
>>> What should I do in the views?
>>> Do I need the complete DRF to do this?
>>> Can I do this with just Django's views and then send data across to
templates?
>>> I mean, can I write views to connect and call the API, send and receive
data and then send the output to the templates?
>>> The encoding is in json when interacting with the remote REST API.
>>> happy hacking.
>>> Krishnakant.
>>>
>>> --
>>> 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/56389E08.10105%40gmail.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/CAFAGLK1rzNjgB2XxckRkZJqgOppwS6CiMxxwMd%2BmChnvKuy1Lw%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/563A32E4.1050105%40gmail.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/CACczBUK%2BdYHCQbBgR%3DHWfKqihL3LPPRFTAQRFz8%3Djgk6UTQkcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: can I write Django a client consuming RESTfull api from elsewhere

2015-11-03 Thread Gergely Polonkai
On 4 Nov 2015 05:45, "kk"  wrote:
>
>
>
> On Tuesday 03 November 2015 08:35 PM, Remco Gerlich wrote:
>>
>> Django code is just normal Python. Python can call REST APIs, sure (a
nice library is Requests: docs.python-requests.org/en/latest/ )
>>
> I got to see this, thanks,  had a quick look and it exactly does what I
want.
>
>
>> Doing this in the view means that the user has to wait until the request
ends before he gets a response. Possibly this will make the view too slow.
You could also do the API requests in the background using Celery, and show
the results some other way.
>
>
> What do you mean doing it in the background?
> How could it enhance the performance?

Imagine a slow web service that you consume (ie. a weather service that is
used by so many people).

Now when your user downloads the page that displays the service's data,
they have to wait, because it takes a long time for your app to get the
result from the service.

With the suggested solution, there is a background task that runs on your
server every 15 minutes or so. It fetches the data from the service and
stores it in your database. Now when a user wants to see your page, Django
gets the values from its own database, so the user doesn't have to wait for
your app to get it from the server.

As you can see, the tradeoff here is disk usage: you have to store the
service's data on your machine. Also, if the data you fetch changes quickly
(like in the stock market) this solution is not so good. In this case you
may want to fetch the service's data from the generated page, e.g. with
AJAX calls.

Best,
Gergely

> happy hacking.
> Krishnakant.
>
>> Remco Gerlich
>>
>>
>> On Tue, Nov 3, 2015 at 12:44 PM, kk  wrote:
>>>
>>> Dear all,
>>> I wish to know if I need to do some thing special for consuming a
RESTfull server from some other provider?
>>> What should I do in the views?
>>> Do I need the complete DRF to do this?
>>> Can I do this with just Django's views and then send data across to
templates?
>>> I mean, can I write views to connect and call the API, send and receive
data and then send the output to the templates?
>>> The encoding is in json when interacting with the remote REST API.
>>> happy hacking.
>>> Krishnakant.
>>>
>>> --
>>> 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/56389E08.10105%40gmail.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/CAFAGLK1rzNjgB2XxckRkZJqgOppwS6CiMxxwMd%2BmChnvKuy1Lw%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/56398D36.1080903%40gmail.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/CACczBULJYvmyOV4LuB6jKfS1U1x1x2jdej4kSWdAaxHm%2BGgjKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [1.8] Odd error on makemigrations when moving model to another application

2015-11-02 Thread Gergely Polonkai
On 3 Nov 2015 06:07, "Mike Dewhirst"  wrote:
>
> On 3/11/2015 9:55 AM, Alex Heyden wrote:
>>
>> I tried putting the model back in its original module with some much
smaller changes, but I'm getting the same error. The error is nonsense in
the current context.
>>
>> Is there some intermediate state saved somewhere when you try to run
makemigrations?
>
>
> Not as far as I can tell. I too have had difficulty moving models between
apps. It is in my too-hard basket for the moment. However ...
>
> When I try again I'll create the model-to-be-moved in its new app and get
that working properly. I would definitely do a makemigration but edit the
migration file prior to migrating to use a forwards_func() method to get
the data across and entrenched in its proper relations with other models on
creation. Finally, when all is working I'd bravely drop the old model in a
separate migration.

I totally agree with this approach. You copy the model from app A to app B,
update all objects to use app B and copy all data from A to B with a
RunPython function. This all should go in a migration file under app B.
Then, from within a migration under app A, remove the model. If you are
sure this app won't ever be used outside your project, you can make the
migration in app A to depend on the migration in app B, either, so there
will be no chance that your data gets copied before it is deleted.

Best,
Gergely
>
> hth
>
> Mike
>
>>
>> On Mon, Nov 2, 2015 at 4:34 PM, Alex Heyden > wrote:
>>
>> Traceback first:
>>
>> ./manage.py makemigrations
>> Traceback (most recent call last):
>> Â  File "./manage.py", line 10, in 
>> Â  Â  execute_from_command_line(sys.argv)
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>> line 351, in execute_from_command_line
>> Â  Â  utility.execute()
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>> line 343, in execute
>> Â  Â self.fetch_command(subcommand).run_from_argv(self.argv)
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 394, in run_from_argv
>> Â  Â  self.execute(*args, **cmd_options)
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 445, in execute
>> Â  Â  output = self.handle(*args, **options)
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py",
>> line 125, in handle
>> Â  Â  migration_name=self.migration_name,
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/autodetector.py",
>> line 43, in changes
>> Â  Â  changes = self._detect_changes(convert_apps, graph)
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/autodetector.py",
>> line 110, in _detect_changes
>> Â  Â  self.old_apps = self.from_state.concrete_apps
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/state.py",
>> line 170, in concrete_apps
>> Â  Â  self.apps = StateApps(self.real_apps, self.models,
>> ignore_swappable=True)
>> Â  File
>>
>>
"/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/db/migrations/state.py",
>> line 248, in __init__
>> Â  Â  raise ValueError(msg.format(field=operations[0][1],
>>
>> model=lookup_model))
>> ValueError: Lookup failed for model referenced by field
>> sdd.Documentation.opportunity:
sdd...governance.models.Opportunity
>>
>> Needless to say, sdd...governance.models.Opportunity is not a
>> valid path to anything.
>>
>> The Opportunity model was moved from the sdd application to the
>> governance application. Documentation has a foreign key to
>> Opportunity. The Python itself is correct. It used to be a direct
>> reference to the class in the module, now it's an imported
>> reference. All of the foreign keys are handled in the same way.
>> Nothing is done by string.
>>
>> I'm ok with a one-off solution for the migration, but I'm more
>> interested in /why/Â the model path is so far off and what I might
>>
>> have done to cause it.
>> -- 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 

Running migrations on the non-default database fails

2015-10-28 Thread Gergely Polonkai
Hello,

I have an application which, due to low usage, used SQLite in production.
Now the demand has risen for the app, and SQLite can't really keep up with
with all the new users. We decided to move to PostgreSQL.

The DB is now up and running, but to cause as short downtime as possible, I
added a new database to settings.py, and tried to run migrations on it:

python manage.py migrate --database postgre

The first few ran fine, but one of them tried to do a RunPython function
which should have modified the value of a column that had been removed from
the production database in a later migration. At this point migrations
failed: it turned out that, despite the --database parameter, RunPython
wanted to iterate through the rows of the production database.

Is this a problem/limitation in Django, or should I update my migration
functions to use the correct database? If the latter, how do I know which
database to use?

Best,
Gergely

-- 
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/CACczBU%2BPX87MQcC6ewQfFJUvNNnAY0s8pKisy%3DB_Nhvcm6DvDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Keep object along a session.

2015-10-21 Thread Gergely Polonkai
Hello,

in the runserver environment, each request is served by the same instance,
so whatever object you create and leave referenced somehow (good luck on
that) will stay alive until runserver is running. However, as soon as you
move to a production environment, be it Apache's mod_python, gunicorn or
whatever, the Python instance that served your first request may be dead by
the time you issue your second one. And it gots worse when you begin to
scale your application to multiple machines.

Why is that object not serializable? Is there really no way to make it so,
or store it's data to either the session, on the disk or to a key-value
store like Redis?

Best,
Gergely
On 21 Oct 2015 01:30, "Serena"  wrote:

> sorry, typo.
>
> Regards.
>
> I need to create an object when a user connects to the system. and the
> object must be kept alive until the user disconnects. This object is unique
> for each user connected to the system.
>
> This object can not be serialized and changes its state throughout his
> life.
>
> This object should be visible only from django, ie, only the server side.
>
> I have read and all I've found is serialized and stored in section. but.
> thus, it does not work for me.
>
> 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/816b2c09-9724-436a-89f9-6b200b1430cb%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/CACczBUJrpCkDCkcgevBjLvyjxfNOG-24Q7a-3gA6YG9iY%2BqK0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Importing models from another app?

2015-10-17 Thread Gergely Polonkai
How does it fail, what is the error message? My first guess is that you
should omit "mysite" from your import line, but without the exact message
it's hard to tell.

Best,
Gergely
On 17 Oct 2015 15:52, "svewa"  wrote:

> Hello everyone,
>
> I have a question about the model interaction between different django
> apps. In my project I have an app called *userprofile* containing my
> *UserProfile* model. In another app I have an *Object* model, which of
> course should have an owner. My idea is to give the *Object* class a
> field:
>
> *owner = models.ForeignKey(Userprofile)*
>
> but the import:
>
> *from mysite.userprofile.models import UserProfile*
>
> *fails*
>
> --
> 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/15ac9e1c-20a5-4a8c-a68b-6c05eefb6d78%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/CACczBUKQcDEtTJZXYkj5ySiujmnCCsgnxHh0hQ9j_GNHVHd-0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Gergely Polonkai
Hello,

I just solved it, and went with a @property. On Build I have:

@property
def values(self):
return Value.objects.filter(grouping__build=self)

and on the Value I have:

@property
def build(self):
return self.grouping.build

This way I stay backwards compatible and didn’t even have to change my
templates and such. Thanks for the tips, though!

Best,
Gergely

2015-10-14 15:09 GMT+02:00 Carsten Fuchs <carsten.fu...@cafu.de>:

> Am 14.10.2015 um 11:11 schrieb Gergely Polonkai:
>
>> This setup, though, doesn’t feel right, as it contains redundancy. Is
>> there a way to
>> access the list of Values directly from Build without having this
>> redundancy?
>>
>
> Well, you can filter your Value queryset by Build, see
>
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#lookups-that-span-relationships
>
> Or, starting with a Build instance, you can work towards the Value
> instances, see
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#related-objects
>
> Best regards,
> Carsten
>
> --
> 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/561E540F.6030202%40cafu.de.
>
> 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/CACczBU%2BogVBRKWPoMU_N_g8sXb4prmb-iMKD26pJAkOgzgePBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Reverse access model through a “double” ForeignKey

2015-10-14 Thread Gergely Polonkai
Hello,

I have three models:

• Build
• BuildGrouping, with a ForeignKey “build” pointing to Build
• Value, with a ForeignKey “grouping” that points to BuildGrouping

Right now, I also have Value.build, which is a ForeignKey to Build, so I
can access the list of Values directly from a Build.

This setup, though, doesn’t feel right, as it contains redundancy. Is there
a way to access the list of Values directly from Build without having this
redundancy?

Thank you in advance!

Best,
Gergely

-- 
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/CACczBU%2BCCSPDbH6Q%2Bn-n9r0kQjYHKrAMQgVWd6mFPjLfZhoULg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to run all tests in INSTALLED_APPS with the new test runner 1.6?

2015-10-07 Thread Gergely Polonkai
I'm not sure I understand what you want to achieve. I use 1.8 and it runs
all tests for all apps without backporting anything.
On 6 Oct 2015 22:39, <jordi.gutierrez.herm...@ecometrica.org> wrote:

> I want the old behaviour of running all tests in INSTALLED_APPS by default 
> Actually,
> I don't care too much if this is accomplished by grabbing the old
> django.test.simple.DjangoTestSuiteRunner from git history or by any other
> means.
>
> On Tuesday, October 6, 2015 at 4:24:00 PM UTC-4, Gergely Polonkai wrote:
>>
>> Hello,
>>
>> do you mean the integrated unittest module, or the Django test runners?
>>
>> However, both needs to be fetched from old history, and I daresay it
>> won't be an easy fetch. 1.6 code will more than likely be incompatible with
>> 1.8, so even if you backmerge it, you will have to do a lot of patching.
>>
>> Best,
>> Gergely
>> On 6 Oct 2015 21:02, <jordi.gutie...@ecometrica.org> wrote:
>>
>>> Hey, sorry to respond to such an old thread, but now that 1.8 completely
>>> removed the old test runner, I am wondering if there's any way to get it
>>> back.
>>>
>>> I don't want to explain why I want it back. Please don't tell me I don't
>>> want it.
>>>
>>> So, starting from the axiom that I want it back, how should I do it?
>>> Grab it from git history?
>>>
>>> On Tuesday, November 12, 2013 at 8:29:14 PM UTC-5, Russell Keith-Magee
>>> wrote:
>>>>
>>>>
>>>> On Sun, Nov 10, 2013 at 3:36 PM, Kyle MacFarlane <kylemac...@gmail.com>
>>>> wrote:
>>>>
>>>>> With the new test runner in 1.6 it only seems to be running tests
>>>>> under my project and ignoring all tests in dependent apps listed in
>>>>> INSTALLED_APPS.
>>>>>
>>>>> If I try to specify another app to test by doing something like
>>>>> "django test a_dependency" I get an exception from Python's unittest 
>>>>> saying
>>>>> "Path must be within the project" (all my dependencies are installed 
>>>>> system
>>>>> wide or in a shared buildout folder in my user dir).
>>>>>
>>>>> The only tests outside of my project I seem to be able to run are
>>>>> Django's itself via "django test django".
>>>>>
>>>>> How can I get the new test runner to discover and run all tests in
>>>>> INSTALLED_APPS? As far as I can tell the new test runner only supports
>>>>> tests located under the cwd which is not very useful for me since my
>>>>> projects tend to just amalgamate smaller apps located elsewhere.
>>>>>
>>>>
>>>> Hi Kyle,
>>>>
>>>> The short answer is no, you can't. However, there's method in this
>>>> madness.
>>>>
>>>> Essentially *all* Django projects are amalgams of smaller apps from
>>>> elsewhere, so you're not alone in this. However, it doesn't follow that you
>>>> need to run the tests for those apps. Consider the tests for one of the
>>>> many apps in your project. This app is either:
>>>>
>>>> 1) A standalone, third party app, provided by another developer. This
>>>> developer has presumably written and run the test suite for that app,
>>>> validated that they pass, and packaged the app as version X. You pin
>>>> version X in your requirements file. At this point, there's no value in you
>>>> running these tests as part of your own project -- these tests aren't going
>>>> to start spontaneously failing just because they're in your project.
>>>>
>>>> 2) A standalone app that you're maintaining in house. Although you're
>>>> maintaining this in house, it's really no different to case 1. Good
>>>> discipline means writing code, running tests, and validating a release
>>>> (either as a tagged version, or just a VCS hash/revision) and pinning at
>>>> that release. Again, the testing of the app is (or should be) independent
>>>> of the testing of your project.
>>>>
>>>> 3) An app that is strongly tied to this particular project. In which
>>>> case, it should be part of the project directory, and will be picked up
>>>> using Django's test suite. If you want to put your project directory
>>>> somewhere other than the default, you can use the -t option to ./manage.py
>>>> test to point at your top lev

Re: How to run all tests in INSTALLED_APPS with the new test runner 1.6?

2015-10-06 Thread Gergely Polonkai
Hello,

do you mean the integrated unittest module, or the Django test runners?

However, both needs to be fetched from old history, and I daresay it won't
be an easy fetch. 1.6 code will more than likely be incompatible with 1.8,
so even if you backmerge it, you will have to do a lot of patching.

Best,
Gergely
On 6 Oct 2015 21:02,  wrote:

> Hey, sorry to respond to such an old thread, but now that 1.8 completely
> removed the old test runner, I am wondering if there's any way to get it
> back.
>
> I don't want to explain why I want it back. Please don't tell me I don't
> want it.
>
> So, starting from the axiom that I want it back, how should I do it? Grab
> it from git history?
>
> On Tuesday, November 12, 2013 at 8:29:14 PM UTC-5, Russell Keith-Magee
> wrote:
>>
>>
>> On Sun, Nov 10, 2013 at 3:36 PM, Kyle MacFarlane 
>> wrote:
>>
>>> With the new test runner in 1.6 it only seems to be running tests under
>>> my project and ignoring all tests in dependent apps listed in
>>> INSTALLED_APPS.
>>>
>>> If I try to specify another app to test by doing something like "django
>>> test a_dependency" I get an exception from Python's unittest saying "Path
>>> must be within the project" (all my dependencies are installed system wide
>>> or in a shared buildout folder in my user dir).
>>>
>>> The only tests outside of my project I seem to be able to run are
>>> Django's itself via "django test django".
>>>
>>> How can I get the new test runner to discover and run all tests in
>>> INSTALLED_APPS? As far as I can tell the new test runner only supports
>>> tests located under the cwd which is not very useful for me since my
>>> projects tend to just amalgamate smaller apps located elsewhere.
>>>
>>
>> Hi Kyle,
>>
>> The short answer is no, you can't. However, there's method in this
>> madness.
>>
>> Essentially *all* Django projects are amalgams of smaller apps from
>> elsewhere, so you're not alone in this. However, it doesn't follow that you
>> need to run the tests for those apps. Consider the tests for one of the
>> many apps in your project. This app is either:
>>
>> 1) A standalone, third party app, provided by another developer. This
>> developer has presumably written and run the test suite for that app,
>> validated that they pass, and packaged the app as version X. You pin
>> version X in your requirements file. At this point, there's no value in you
>> running these tests as part of your own project -- these tests aren't going
>> to start spontaneously failing just because they're in your project.
>>
>> 2) A standalone app that you're maintaining in house. Although you're
>> maintaining this in house, it's really no different to case 1. Good
>> discipline means writing code, running tests, and validating a release
>> (either as a tagged version, or just a VCS hash/revision) and pinning at
>> that release. Again, the testing of the app is (or should be) independent
>> of the testing of your project.
>>
>> 3) An app that is strongly tied to this particular project. In which
>> case, it should be part of the project directory, and will be picked up
>> using Django's test suite. If you want to put your project directory
>> somewhere other than the default, you can use the -t option to ./manage.py
>> test to point at your top level project directory. This doesn't change the
>> discovery strategy; it just alters the place that Django looks.
>>
>> So - you shouldn't have any need to run *all* the tests in INSTALLED_APPS
>> -- just the apps that are actually part of your project, and won't be
>> independently tested. If the app is independently maintained, but not
>> independently tested, you've got much bigger problems :-)
>>
>> Yours,
>> Russ Magee %-)
>>
> --
> 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/df0a8e3c-129e-4db4-8e8a-12d6d6ce7573%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 

Re: Foriegn key error--> no such column: eduplus_choice.question_id

2015-09-30 Thread Gergely Polonkai
Did you run your migrations?
On 30 Sep 2015 15:35, "Bhanu Kathuria" <001kathuriabh...@gmail.com> wrote:

> Settings,admin and model file are attached.
>
> --
> 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/c0e69bbe-9e7c-4642-ac2f-5092e7bd0d70%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/CACczBULQfHohtzLJKp-N%2B%3D%3DKv4f6V7whUPuBOgKXYbrfNBdGAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key in sqlite3

2015-09-30 Thread Gergely Polonkai
Assuming you are using Django and it's ORM, the same way as in any other
database:

fieldname = models.ForeignKey(AnotherModel)
On 30 Sep 2015 15:18, "Bhanu Kathuria" <001kathuriabh...@gmail.com> wrote:

> I am using sqlite3 database.
> How can I add foreign key between two tables.
>
> --
> 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/56c957c9-6b03-4c19-9566-9a63cdbf8319%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/CACczBUKyATKexddYKEMhKyg4SpywuyZ7uMxDK5HMXxadQV7vLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin: Unknown fields

2015-09-29 Thread Gergely Polonkai
Hello,

I suspect you didn't make/run migrations:

python manage.py makemigrations
python manage.py migrate

The first command creat the so-called migration files that are required to
update the database by adding new tables and fields, while the second one
does the actual upgrade.

Also, allow me some comments.

You may want to omit genus_id from your model, as it gets created
automatically anyway. One field less to manage while you write your code.
Of course, it's up to you.

The second one is your choice field. By convention, Django people do it
this way:

EXAMPLE_CHOICES = (
('short code to store in DB', 'long text to display'),
…
)
field = models.CharField(choices=EXAMPLE_CHOICES)

My main point here other than conventions is that "short code" won't get
displayed for the user, so make your choice list based on this.

Third, eggplant is Solanum if I recall well :)

Best,
Gergely
On 29 Sep 2015 00:56, "Rolston Jeremiah"  wrote:

> Hello,
>
> I am new to Python and Django so please bear with me.
>
> I have  created a model(below) and would now like to access
> from the admin interface. As per instructions  I found on the
> django site (Part 2 tutorial version 1.8.4)
>
>
> model
>
> ///
>
> class Genus(models.Model):
> genus_id = models.AutoField(primary_key=True),
> scientific_genus = models.CharField(max_length=32),
> common_name = models.CharField(max_length=32),
> common_examples = models.TextField(),
> genus_choices = (
> ('Member Banana...','Musa'),
> ('Mango...','Magnifera'),
> ('Avocado...','Persea Americana'),
> ('Soursop, Custard, Sugar Apple...','Annona Reticulata'),
> ('Ginger, Tumeric ...','Zingiber Officinale Roscoe'),
> ('Persimmon','Diospyros'),
> ('Breadfruit...','Artocarpus Altilis'),
> ('Cherry ...','Prunus'),
> ('Grapes ...','Vitis'),
> ('Tomato ...','Lycopersicon'),
> ('EggPlant ...',''),
> ('Onion, Garlic ...','Allium'),
> ('Cashew ...','Anacardium'),
> ('Rice ...','Oryza'),
> ('Pepper ...','Capsicum'),
> ('Orange,Lemon, Lime ','Citrus')
> ),
> image_url = models.CharField(max_length=128),
> genus = models.CharField(max_length=32,choices=genus_choices),
> description = models.TextField()
>
>
> I edit  "admin.py"  so that it now looks like
>
>
> admin.py
>
> //
>
> from django.contrib import admin
> from cfxBase.models import Genus
> # Register your models here.
>
>
> class GenusAdmin(admin.ModelAdmin):
> fields = [
>'genus',
>'scientific_genus',
>'common_name',
>'description',
>'common_examples',
>'image_url'
> ]
>
> admin.site.register(Genus, GenusAdmin)
>
>
>
> 
>
> Now when I attempt the admin page add entry  for Genus I am getting this
> error:
>
>
> FieldError at /admin/cfxBase/genus/add/
>
> Unknown field(s) (scientific_genus, genus, common_name, common_examples,
>
>   description, image_url) specified for Genus.
>
>
> Check fields/fieldsets/exclude attributes of class GenusAdmi
>
>
>
> Your help will be  greatly 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/3b131d1a-78b9-4294-adad-1040a5ab7a12%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/CACczBUKQ6ma72xvWmp4vftqdJj%3DNpSAURy%2B2VcY0SJE%2Bwwu7tQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django query, order results such that th128 > th99

2015-09-28 Thread Gergely Polonkai
Hello,

what you want to achieve is called "natural order sorting" which is not
built into any common SQL implementation I know. You have to do it manually
from code, or, if you have to do pagination, add a sorting column that is
numeric (and indexed).

Best,
Gergely
On 28 Sep 2015 08:42, "gintare"  wrote:

> Is it possible to order the query result strings in such a way that th128
> string would be first comparing to th99.
> The query results contains 128 items in format: "th"+number. For instance,
> th1, th2, ...th80, ..th99, th100, th128.
> Than i order results, they go in the following order, th1, th10,th100,
> th101,th102,... th11,th110, ... th2, th20, th21,th22,.. th9,..th99.
> Thus i am not able to get the largest result, which is th128. I am getting
> th99 instead.
>
> def temp(request):
> query = request.GET.get( 'q','')
> #a=Aref5.objects.filter(Rname__contains='book').count()  #finds128
>
> a=Aref5.objects.filter(Rname__contains='book').order_by('-Rname')[0:1].get()
> #gets aref5 object
> print(a.Rname) #prints th99 instead of th128, which logically is larger
> return render_to_response('Ath.html', {"query": query})
>
> --
> 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/69e26bab-210e-4137-adf3-498855d0eae6%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/CACczBU%2Bi0tVFhMypH7VuPKe9c%2B_-tk8ofdwyMgyAA1h3V4vtAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Tutorial(Database Setup Question)

2015-09-27 Thread Gergely Polonkai
Hello,

that message is clear: line 45 in your settings.py has a syntax error. That
line, however, seem OK, so I guess the previous one is that; maybe a comma
is missing.

Best,
Gergely
On 27 Sep 2015 14:26, "Cai Gengyang"  wrote:

> Hi Tom,
>
> Following your latest instructions , I have posted my input and output
> results here. Still getting an error message though it is a different one
> this time ( a traceback error )
>
> CaiGengYangs-MacBook-Pro:~ CaiGengYang$ cd mysite folder
>
> CaiGengYangs-MacBook-Pro:mysite CaiGengYang$ ls
>
> manage.py mysite
>
> CaiGengYangs-MacBook-Pro:mysite CaiGengYang$ python manage.py migrate
>
> Traceback (most recent call last):
>
>   File "manage.py", line 10, in 
>
> execute_from_command_line(sys.argv)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 338, in execute_from_command_line
>
> utility.execute()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 303, in execute
>
> settings.INSTALLED_APPS
>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py",
> line 48, in __getattr__
>
> self._setup(name)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py",
> line 44, in _setup
>
> self._wrapped = Settings(settings_module)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py",
> line 92, in __init__
>
> mod = importlib.import_module(self.SETTINGS_MODULE)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
> line 37, in import_module
>
> __import__(name)
>
>   File "/Users/CaiGengYang/mysite/mysite/settings.py", line 45
>
> 'django.middleware.csrf.CsrfViewMiddleware',
>
>   ^
>
> SyntaxError: invalid syntax
>
> CaiGengYangs-MacBook-Pro:mysite CaiGengYang$
>
>
>
> On Sunday, September 27, 2015 at 7:51:51 PM UTC+8, Thomas wrote:
>>
>>
>> > On Sep 27, 2015, at 04:39, Cai Gengyang  wrote:
>> >
>> > Hi Tom,
>> > So I click on Finder ---> Go ---> Home ---> 'Weiqi' folder ---> mysite
>> folder ---> manage.py file. (using a Mac OS X Yosemite Version 10.10.2)
>> > This puts me in the same directory as the manage.py file.
>> > Then I key in the command  : $ python manage.py migrate
>>
>> The command must be typed from a terminal window, and afaik Finder has no
>> influence on the current working directory in that window.
>>
>> Use the Terminal app to open a command line window, then use “cd” or
>> “pushd” to go to “mysite folder” within that terminal window.
>>
>> If that is done correctly, then you should be able to type “ls” and see
>> manage.py in the resulting listing. Then try typing the python command
>> above.
>>
>> btw, I would strongly recommend using virtualenv for developing on your
>> Mac (and on any other system). There are many references to that in this
>> mailing list; do a google search to find a procedure for doing this.
>>
>> hth
>>
>> - Tom
>
> --
> 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/278af114-1a2e-4c4b-ab90-f2c4814d7f4e%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/CACczBULz2y%3D3VRY1SDoE%3DVZE0nQnYUDbmfiu2UJkurY2K79YiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NoReverseMatch error in django 1.8

2015-09-27 Thread Gergely Polonkai
Hello,

the bookp route requires a user and a book_id parameter. Unless you supply
that, your {% url %} tag won't match.

Best,
Gergely
On 27 Sep 2015 12:49, "hossein"  wrote:

> this is my views and url.py
> as long as use  tag in my template show error
>
> url
>
> urlpatterns = [
> url(r'^bookee/$', views.index, name='index'),
> url(r'^bookee/user/(?P[a-z0-9-._@+]\w+)/$', views.uprofile, 
> name='userprofile'),
> url(r'^bookee/user/(?P[a-z0-9-._@+]\w+)/book/(?P\d)/$', 
> views.bookprof, name='bookp'),
> 
> url(r'^bookee/user/(?P[a-z0-9-._@+]\w+)/publisher/(?P\d)/$', 
> views.publishprof, name='publishep'),
> ]
>
>
>
> view
>
> def uprofile(request, user):
> usr = User.objects.get(username=user)
> book = Book.objects.filter(user=usr)
> return render(request, 'u/uprof.html', {'usr': usr, 'book': book})
>
> def bookprof(request, user, bookid):
> usr = User.objects.get(username=user)
> bookid = Book.objects.get(id=bookid)
> # bookd = Book.objects.filter(id=bookid)
> return render(request, 'u/uprof.html', {'usr':usr,'bookid': bookid})
>
> def publishprof(request, user, publishid):
> usr = User.objects.get(username=user)
> pubid = Publisher.objects.get(id=publishid)
> publisher = Publisher.objects.filter(id=pubid)
> return render(request, 'u/uprof.html', {'usr':usr,'publisher': publisher})
>
> template
>
> 
> 
> list of books
> 
> 
>
> NoReverseMatch at /bookee/user/admin/
> Reverse for 'bookp' with arguments '()' and keyword arguments '{}' not found. 
> 1 pattern(s) tried: 
> ['bookee/user/(?P[a-z0-9-._@+]\\w+)/book/(?P\\d)/$']
>
>
> thanks for your 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/a9092ae0-ff31-467c-ab25-e8418d82270d%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/CACczBUJeMpAy%2Bqm6c0_Z5c3ihTcdT3eGnEnZD8fUMaFHq93DRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOOB exposes CSRF token. Now what?

2015-09-25 Thread Gergely Polonkai
Hello,

you may force-push a new commit that removes the settings file from the
GitHub repo, but if you are really paranoid, you may want to change your
CSRF token in production immediately. It may cause some temporary annoyance
to your users, but nothing long-term.

Best,
Gergely

2015-09-25 8:03 GMT+02:00 Gordon Reeder :

> I'm learning Django and still very new at it. And like a newbie, I may
> have made a newbie goof.
> I have leaked my CSRF token.
> I am building up a web site with Django which I have under revision
> control with Git. I have pushed two commits of the project out to Github.
> The commits included the settings.py file, which list the CSRF token. I
> have read (after the fact) that maybe that wasn't the smartest thing to do.
>
> So now what?
>
> Can I remove the settings.py file from Github?
> Or can I generate a new CSRF token?
>
> Any 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/9faaf7ad-29af-473d-8e63-e1c51b4b90d0%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/CACczBULGV4cYYQ_9s2JjGCNOGRqg5Ga2rTgu%3D85cC%3DMnp20X3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create a view form capable of saving data into models through FK

2015-09-25 Thread Gergely Polonkai
Hello,

The most beautiful way (IMHO) is to create a widget type for this. See this
answer on SO[1]. I wonder why this is not part of Django yet…

[1] http://stackoverflow.com/a/5155576/1305139
On 25 Sep 2015 01:53, "eli"  wrote:

> Hi Guys,
> A noob here,
>
> I have two models,
>
> class Students(CommonInfo):
> first_name = models.CharField(max_length=75)
> surname = models.CharField(max_length=75)
> class_score = models.ForeignKey(Course, related_name='course')
> exam_score = models.ForeignKey('House')
> ...
>
> def __unicode__(self):
>
> return u'%s %s' % (
> self.first_name, self.surname)
>
> class Scores(models.Model):
> class_score = models.PositiveIntegerField()
> exam_score =  models.PositiveIntegerField()
> ...
>
> I need to create view that would eventually produce a form with
> first_name, surname intact but the two foreign fields i.e class and exam
> scores as editable fields to allow users key in data and save(for named
> students) into the various models. I dont seem to find any concise way of
> doing this.
> More efficient suggestions are welcome.
> 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/b1dd4578-ee90-4fff-9623-65c633d2a591%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/CACczBUKVO%2BL%2BdBVBrix_OC%3D26_7%2BkEgsB5T5Ys7cZevhaWKPww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: custom setting provided by myapp

2015-09-24 Thread Gergely Polonkai
Hello,

Most apps I know don't do such things. They write everything needed for
them to work in their docs, and if something is not set, they either work
with a sane default, or raise ImproperlyConfigured. I do the same myself.

Also, Python does this in general; it assumes you read the manual before
using something :)

Best,
Gergely
On 23 Sep 2015 23:20, "Bill Freeman"  wrote:

> If you have a system based on Django (some CMS for example), rather than
> an app for folks to add to a site that has a lot of unrelated stuff, then
> sure, generate one, but don't replace one that may have hours of
> customization work into it.  Let the site owner/tech do the merging.  If
> there are no settings when you install, then, yes, you could create the
> active settings file.  But you might find that difficult as Django versions
> change, or if you are going to allow it to work with the user's choice of
> Django version.  One possible approach is to read in the existing settings,
> see what it doesn't have that you need, and produce a file that the main
> settings file could import * from.
>
> On Wed, Sep 23, 2015 at 5:12 PM, Luis Zárate  wrote:
>
>> Hi,
>>
>> Sure, but why not auto-generate the setting file?, for example I know
>> various CMS than have an installer that provide a custom setting with
>> auto-generate configuration file (I don't know how to do that).
>>
>> Other idea is that my app can add configuration if is not set explicitly,
>> so the user have the possibility to change whatever he want and my app only
>> guarantee that run well most of time.
>>
>> 2015-09-23 12:10 GMT-06:00 Bill Freeman :
>>
>>> I would be upset to find an app that I installed fiddling with my
>>> project settings.
>>>
>>> On Wed, Sep 23, 2015 at 12:53 PM, Luis Zárate 
>>> wrote:
>>>
 Hi,

 l have an app than need other apps to run well, I create a requirements
 file and setup file and insert the required apps in my settings, also
 include my custom configurations.

 I want to build the settings file automatically (with installer script)
 or when the user put my app in his installed_apps automatically update the
 project settings with my custom apps settings.

 So what is the best approach for do that.



 --
 "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%2B5VyMutG68Dh2MuC1h7-uL%3DRzw6Y9v7RM33k5WN8qH-i3VAQ%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/CAB%2BAj0s%3Det%2B7%2BvHVcGGz%2BAkbQNWykHoMqzX6gO-XxxRTE0xmLQ%40mail.gmail.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%2B5VyMX_YcXaJuyNQi%2BQhfv7cepG5t4WXVnWM3eoyzyf5rV8w%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 

Re: Django error report not being sent through email

2015-09-19 Thread Gergely Polonkai
It belongs to settings.py, as everything else. However, if you haven't
overridden it, it should send yeu the emails. Are you sure your e-mail
sender settings are set properly?

Best,
Gergely
On 19 Sep 2015 14:27, "Xin Ji"  wrote:

> No, I haven't.
> How should I override? And Which file should I put the LOGGING settings in?
>
> 在 2015年9月19日星期六 UTC+8下午7:49:56,Xin Ji写道:
>>
>> I'm using apache + django + mod_wsgi to serve my app.
>> My apache version is 2.4.7 and my django version is 1.8.4
>>
>> My django settings are:
>>  * DEBUG=False*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *  ADMINS = [  ('username','usern...@comp.nus.edu.sg
>> '),  ]  MANAGERS = [
>> ('username','usern...@comp.nus.edu.sg '),  ]
>> MIDDLEWARE_CLASSES = (  ...
>> 'django.middleware.common.BrokenLinkEmailsMiddleware',  )  EMAIL_HOST =
>> 'stmp.comp.nus.edu.sg '  EMAIL_PORT = 25
>> EMAIL_HOST_USER = 'username'  EMAIL_HOST_PASSWORD = 'password'*
>>
>> When I ran the server, I got this error on the website(This page uses the
>> django 500.html template.):
>> Server Error *(500)*
>>
>> There's been an error. It's been reported to the site administrators via
>> email and should be fixed shortly. Thanks for your patience.
>>
>> But I *didn't receive* any email about the error report.
>>
>> What's wrong with my configurations?
>>
> --
> 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/68c1b621-1cb5-4dfd-bd22-921134a0d128%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/CACczBUKqJ6yeTQGYN19-imzikrPsbY2PgLHXJVhaEXSS2QkRLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django error report not being sent through email

2015-09-19 Thread Gergely Polonkai
Hello,

BrokenLinkEmailsMiddleware sends error reports about 404 errors.

500 errors are reported via logging. Have you overridden the LOGGING
setting?

Best,
Gergely

2015-09-19 13:49 GMT+02:00 Xin Ji :

> I'm using apache + django + mod_wsgi to serve my app.
> My apache version is 2.4.7 and my django version is 1.8.4
>
> My django settings are:
>  * DEBUG=False*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *  ADMINS = [  ('username','usern...@comp.nus.edu.sg
> '),  ]  MANAGERS = [
> ('username','usern...@comp.nus.edu.sg '),  ]
> MIDDLEWARE_CLASSES = (  ...
> 'django.middleware.common.BrokenLinkEmailsMiddleware',  )  EMAIL_HOST =
> 'stmp.comp.nus.edu.sg '  EMAIL_PORT = 25
> EMAIL_HOST_USER = 'username'  EMAIL_HOST_PASSWORD = 'password'*
>
> When I ran the server, I got this error on the website(This page uses the
> django 500.html template.):
> Server Error *(500)*
>
> There's been an error. It's been reported to the site administrators via
> email and should be fixed shortly. Thanks for your patience.
>
> But I *didn't receive* any email about the error report.
>
> What's wrong with my configurations?
>
> --
> 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/24b158eb-c6f3-4928-8588-391484139734%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/CACczBUK_1mWTrO5FCDmT0%2BYUnoYL1926G8Et2OCvesStFFJOUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best way to trigger javascript function when returning a page from django view

2015-09-19 Thread Gergely Polonkai
Hello,

I can't see the use case here. If you are submitting the form with AJAX,
why would you store it? Or, if I misunderstood you and you submit in the
non-AJAX way, Django will send give you back your filled form with the
validation errors.

Best,
Gergely
On 19 Sep 2015 10:09, "Martin Torre Castro"  wrote:

> Hello,
>
> I have a django project where I make requests to the server views both by
> AJAX and the usual  simple URL requests to Django.
>
> The thing is that I have made one javascript function for storing the
> forms contents in the HTML5 webstorage and I want to clear the stored data
> after coming from a succesful operation, beacuse the flow is:
>
> 1. You get to the form
>
> 2. You enter the data into the form
>
> 3. Press submit
>a. If there is a validation error, we come back to 3 and the javascript
> function fills the same data entered into the form (this is already done
> and is awesome and comfortable for the user)
>
> 4. If all data was valid and OK, after returning from the python/django
> view I want to trigger the javascript function that clears the stored data,
> because is saved and we don't need it anymore because it's already saved. 
> *This
> is my problem*
>
>
> When returning to an AJAX I can simply use the success function in
> jQuery.get() o jQuery.ajax(), but when returning from a regular view I
> can't think of any strategy other than passing the flow to a success page,
> in which I trigger the function with $(document).ready().
>
> I'm looking for the best alternative, because it would be better not
> forcing me to pass through a specific page. Any ideas?
>
>
> Thank you 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/bffd59a7-c30f-4092-8160-30ef7e472b27%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/CACczBUKE741snUn-BKF9RUzJejFypsb-W4tamtS7NJdW6F06KA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2015-09-19 Thread Gergely Polonkai
Hello,

0) learn to use Google. Getting the following two links took about 12
seconds
1) if you want to contribute to Open Source in general, go to [1]
2) if you want to contribute to Django specifically, go to [1], then go to
[2]
3) profit!

Best,
Gergely

[1] http://developer.com/open/how-to-start-contributing-to-open-source.html
[2] https://docs.djangoproject.com/en/1.8/internals/contributing/
Hi
I am a Django newbie and wish to contribute to open source. Please
guide me through the initial procedure.

--
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/CAEpzxCUm-FSOKaNRskpN6YWkgB0icJ8F-3UpQ1NBe9wLs5vVWQ%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/CACczBU%2By4wEOpBNbor9kRvJD0iVpdBhTAMu%2B7X93WE6AuX-8nA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-09 Thread Gergely Polonkai
Hello,

this is a bit off topic here, and highly opinion based, but here are my two
cents: I got along very well with both Bootstrap and Angular, but never
tried React before. However, a quick Google search shows that React is
barely supported yet (in terms of available Django apps).

Best,
Gergely
On 10 Sep 2015 00:29, "ThomasTheDjangoFan" <
stefan.eichholz.ber...@googlemail.com> wrote:

> Yeah, I definetly hate to write Javascript and I really do NOT want to
> write server code in it.
>
>
> *The parts where I really need a javascript framework in my app are
> complex forms:A page might consist of multiple forms bundled with formsets,
> inline-forms and so on.*
>
>
> *The question is:*Which js-framework has the best form support for
> django? It would be cool if I would just have to write server-side
> model-variation and the client would adopt it.
> Which js-framework has the best tutorial to get myself started?
>
> *I checked out *
> *www.djangopackages.com  - it seems like I
> have the following options:*Angular.js: made by Google (6 django-pakets
> on www.djangopackages.com)
> JQuery.js: (4 django-pakets on www.djangopackages.com)
> Ember.js: (3 django-pakets on www.djangopackages.com)
> React.js: made by facebook (0 django-pakets on www.djangopackages.com)
> riot.js: (0 django-pakets on www.djangopackages.com)
>
> Any suggestions?
>
> Kind regards
> Thomas
>
> --
> 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/13e79d83-a4e5-4e6f-a372-47320791d9cd%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/CACczBUKWf6knewigf6ax6bheKje2jXUNs5uJ3%3DZ0KgiL2UxAXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-09 Thread Gergely Polonkai
Hello,

I never used React.js before, only Angular, which already has some support:

https://github.com/jrief/django-angular

For react, it seems there’s only confusion yet, but I guess that’s mostly
because React.js itself is pretty new.

Also, if you are already confortable with Python (and Django), you can
start writing the backend, and learn about possible frontend libraries on
the way.

Best,
Gergely

2015-09-09 15:28 GMT+02:00 ThomasTheDjangoFan <
stefan.eichholz.ber...@googlemail.com>:

> Hi Gergely,
>
> thanks a lot for the quick response.
>
> Well... I am an Javascript Beginner and I need to start it from scratch.
> The project *definetly needs more Javascript-UI Compontents* than what
> bootstrap gives us.
> + *Interactive UI Elements* that show the same content and update each
> others
> + Modal Forms that update the base-view after being closed
> + Filters
> + Sortable Tables
> + and much more
>
> So I need to check out, React.js or something else and make it work with
> Django.
>
> *I guess that compared to Meteor.js Django (& React.js or something
> similar) is the better solution for putting out a website that consists of
> both an application part and an static website.*
>
>
>
>
> *What do you guys think of Django in combination with React.js?Are there
> good tutorials out there to make it work and get me started?Or is there
> another framework you can recon?*
> Kind regards
> Thomas
>
> Am Mittwoch, 9. September 2015 07:35:52 UTC+2 schrieb Gergely Polonkai:
>>
>> Hello,
>>
>> this all depends: if I'm a JS expert, I'd go with Meteor or another JS
>> framework. If I'm a Python expert, I'd go with Django or another Python
>> framework.
>>
>> Meteor's strength is in the fact that (almost) the same code runs on the
>> server and in the browser (wether it's good or not is another story, and
>> opinions will change developer by developer). It is more than possible that
>> your CRM's frontend will utilize JavaScript anyway, but for that, you may
>> want to use different frameworks like Angular or Bootstrap (if you can call
>> this latter a JS framework).
>>
>> So I'm really sorry but I think no one will actually tell you what to do:
>> you must decide based on the requirements.
>>
>> Oh, and don't stick with JS just because "it's a small app with 10
>> users"; if you see potential in your app, make it scalable. Maybe you will
>> be able to sell it latel to bigger corps. ;)
>>
>> Best,
>> Gergely
>> On 9 Sep 2015 00:12, "ThomasTheDjangoFan" <stefan.eich...@googlemail.com>
>> wrote:
>>
>>> Hi guys,
>>>
>>> I have invested quite a lot of time & energy into learning django and I
>>> feel comfy using it. (I have studied the 2 Scoops, the Tdd book and got the
>>> boook "Scaling Django" and "lightweight Django" right here next to me).
>>>
>>> It feels like I finally got the right tool, BUT:
>>> I am about to implement my first big project - a *customer relation
>>> management system*. The userbase will be small - around 1 to 10 users.
>>>
>>> During my planing I came accross javascript-framworks (like angular or
>>> meteor) and yes: *my project definetly needs some javaside-tricks on
>>> the client-side.*
>>>
>>> So I used the last 7 days to stick my head into the javascript stuff and
>>> I am *sooo overwhelmed* by all the options out there (!!!). And
>>> it seems like there really is no good tutorial for the javascript-frontend
>>> stuff with django.
>>>
>>> *Now I am going crazy and thinking about dropping django completely and
>>> switching to Meteor*. (By the way: The meteor-guys seem to be totally
>>> in love with react.js.)
>>>
>>> *Before making a stupid decision I feel like I need some guidance from
>>> the real experts.*
>>>
>>> *Now my question to you is:*
>>> *If you were about to implement a quite-complex crm system (starting
>>> from the ground up): what tool would you use?*
>>> Would you use Django (maybe in combination with React) or would you
>>> switch to Meteor?
>>> If you would stick to Django - which js-framework can you recon? (I
>>> really need some good and clear tutorials to get me started)
>>>
>>> I am really thankful for your tips
>>>
>>> Kind regards
>>> Thomas
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>&g

Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-08 Thread Gergely Polonkai
Hello,

this all depends: if I'm a JS expert, I'd go with Meteor or another JS
framework. If I'm a Python expert, I'd go with Django or another Python
framework.

Meteor's strength is in the fact that (almost) the same code runs on the
server and in the browser (wether it's good or not is another story, and
opinions will change developer by developer). It is more than possible that
your CRM's frontend will utilize JavaScript anyway, but for that, you may
want to use different frameworks like Angular or Bootstrap (if you can call
this latter a JS framework).

So I'm really sorry but I think no one will actually tell you what to do:
you must decide based on the requirements.

Oh, and don't stick with JS just because "it's a small app with 10 users";
if you see potential in your app, make it scalable. Maybe you will be able
to sell it latel to bigger corps. ;)

Best,
Gergely
On 9 Sep 2015 00:12, "ThomasTheDjangoFan" <
stefan.eichholz.ber...@googlemail.com> wrote:

> Hi guys,
>
> I have invested quite a lot of time & energy into learning django and I
> feel comfy using it. (I have studied the 2 Scoops, the Tdd book and got the
> boook "Scaling Django" and "lightweight Django" right here next to me).
>
> It feels like I finally got the right tool, BUT:
> I am about to implement my first big project - a *customer relation
> management system*. The userbase will be small - around 1 to 10 users.
>
> During my planing I came accross javascript-framworks (like angular or
> meteor) and yes: *my project definetly needs some javaside-tricks on the
> client-side.*
>
> So I used the last 7 days to stick my head into the javascript stuff and I
> am *sooo overwhelmed* by all the options out there (!!!). And it
> seems like there really is no good tutorial for the javascript-frontend
> stuff with django.
>
> *Now I am going crazy and thinking about dropping django completely and
> switching to Meteor*. (By the way: The meteor-guys seem to be totally in
> love with react.js.)
>
> *Before making a stupid decision I feel like I need some guidance from the
> real experts.*
>
> *Now my question to you is:*
> *If you were about to implement a quite-complex crm system (starting from
> the ground up): what tool would you use?*
> Would you use Django (maybe in combination with React) or would you switch
> to Meteor?
> If you would stick to Django - which js-framework can you recon? (I really
> need some good and clear tutorials to get me started)
>
> I am really thankful for your tips
>
> Kind regards
> Thomas
>
> --
> 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/5da587a8-204d-45c3-ae1a-5936e87861b4%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/CACczBU%2BxWAz8afWJNZ4O2%2B92T3z-%2B9NWPhG22C4kBbZcfd-mFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What are the disadvantages of using a custom user model?

2015-08-31 Thread Gergely Polonkai
Hello,

is it the fields or the functionality you don't need? If it is really the
functionality, you shouldn't bother; just don't use it. If some of the
fields, then it worths an evaluation on why you don't need them, if you
will have only a few users (e.g. a company internal app), then again, don't
bother. If you will have tons, you should go with custom users, although be
warned that changing the user model while the project is live is a real
PITA.

Best,
Gergely
On 31 Aug 2015 06:11, "a.esmail"  wrote:

> Hello,
> I am evaluating whether it is better to use a custom user model in django
> or just extend django.contrib.auth.models.User.
> The default User model offers a lot of the functionality that I don't need
> in my project and doesn't have a lot of fields that I will need.
>
> My question is, what should I be worried about when using a custom User
> model?
>
> One thing I can think of is, some plugins/apps might require django's
> built-in User model to function properly.
> Any other issues I should be aware of?
>
> 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/049a9bbd-a2c0-4aa8-a65c-8bda8849cba9%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/CACczBUJk5uzWDJGgMZW%2B4oSbnyZZEX2zKoh3FTWgv7Peuc8iPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Notify Customer Support of Request Failures

2015-08-30 Thread Gergely Polonkai
Hello,

in a default Django installation the 500 responses are handled by the
logger, not a middleware. It is possible to write a middleware that
captures all error responses, and sends a mail about each of them (or only
if they are relevant). I don't know of any that is already written, but
based on the information you gave, it's not a hard task.

Best,
Gergely
On 30 Aug 2015 15:30, "Avraham Serour"  wrote:

> add logging messages everywhere that matters, include any information
> relevant to you, then monitor the logs. the ELK stack is nice (
> https://www.elastic.co/products/logstash)
>
> On Sun, Aug 30, 2015 at 7:49 AM,  wrote:
>
>> Hello,
>>
>> I'd like to notify our customer support of certain errors. For example,
>> if a sign up fails (a 500, for whatever reason), I want them to get a mail
>> with as much information as possible about the customers and their request,
>> so they can contact them and resolve the issue. Two questions about this:
>>
>> AFAIK, the settings.MANAGERS are similar in nature: They're the ones
>> administering the site, being notified of 404s using the
>> BrokenLinkEmailsMiddleware
>> .
>> Are they *meant* to also get support mails, or what is their role exactly?
>>
>> Is there an app, middleware or view decorator that will notify a group of
>> ppl (either users in a group or a list of email addresses), when a certain
>> status code / error occurs (e.g. 500, 400, 404) at certain views? I'd need
>> the ability to customize the mail template to make sure that all
>> information needed to act upon the issue is there.
>>
>> Google search, searching the mailing list archives and the error-handling
>> grid of Django-packages revealed nothing even close to what I am looking
>> for.
>>
>> Thank you for any pointers!
>>
>> Cheers,
>> murat
>>
>> --
>> 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/22122da6-f5bb-47f0-99b7-2c674c39e2fd%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%2BMULAb6rqtPxqptsy0%3DGTZfUFeJ3BMxzOUHBDK1QMQng%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/CACczBULLeAhcv4G7ECNHjFDMqENyD7-69qH9k44kbtTE-XfWxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Live Site to Localhost (Testing)

2015-08-25 Thread Gergely Polonkai
If this is a Django-only thing, you can use manage.py to dump and load your
data, without the SQL dump. The code, I guess, is available from somewhere,
e.g. in a VCS so you just have to clone/checkout.
On 20 Aug 2015 16:40,  wrote:

> We have a completely developed Django Site running on live, But it never
> had a testing environment. Now, I downloaded all the files of Website and
> download a mysql dump file.
> I want to run this on my local machine windows (Just to push my changes
> here to test before going live).
> I installed all requirements (Python 2.7, Pip, Mysql, Django), and able to
> create a new project and run the server. How do I configure and run the
> downloaded site now?
>
> Your help is highly Appreciated.
>
> Thanks,
> Bhanu.
>
> --
> 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/8ec6f13f-53fb-49e0-b7c2-98be447e7960%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/CACczBUJm1%3DMfoAzxG2Fnwk8KOz2RaAZ1novkERmimOo3bAE%2BBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to access the parent instance from the Inline model admin?

2015-08-23 Thread Gergely Polonkai
Whose parent do you want to get? The inline, the model, or, less likely,
the form?
On 23 Aug 2015 16:48, "Michael"  wrote:

> How can I access the parent instance from the inline model admin?
>
> My goal is to allow to add a child object only when the status of the
> parent is equal to 1 so I'm trying to override the `has_add_permission`
> function based on the status of the parent instance but I cannot get the
> parent instance.
> Is there another way to do this?
>
>
> class ChildInline(admin.TabularInline):
> model = Child
> form = ChildForm
>
> fields = (
> ...
> )
> extra = 0
>
> def has_add_permission(self, request):
> # Return True only if the parent has status == 1
> # How to get to the parent instance?
> #return True
>
> class ParentAdmin(admin.ModelAdmin):
> inlines = [ChildInline,]
>
>
>
>
>
> --
> 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/6690f995-8978-4a95-84af-1e7a1b211727%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/CACczBUJh8p9%2B0fvErxkm7nKNDHBD%2B4AO-6gGLuYZb0xy2xNurw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Console Routes With Django ??

2015-08-12 Thread Gergely Polonkai
Not really. Management commands available in Django can't modify database
content as console routes does. Think about them as having a CRUD view set
that you can only call via a management command.
On 12 Aug 2015 01:23, "Tom Lockhart"  wrote:

>
> On Aug 11, 2015, at 12:29, Prabath Peiris 
> wrote:
>
> Hi
>
> I am new to (kind of) Django framework and just finish the
> Django-REST-framework tutorials and it looks really cool. I am a big fan of
> ZendFramework2.0 (with Apigility) and trying to make parallels between
> these two frameworks. My primary question is about console routes. In ZF2
> you can define console routes very easily and execute same controllers as
> web API requests. What is the best way to accomplish this in Django
> (specially using REST framework).
>
> ZF2 console routes :
> http://framework.zend.com/manual/current/en/modules/zend.console.routes.html
>
>
> affect the equivalent would be Django management commands.
>
> hth
>
> - Tom
>
> --
> 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/755F8E03-EE81-4379-876A-563DA2A0321B%40gmail.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/CACczBUKcTNO27Htx%2BF5Rq7-GofG62UggvGzz%2BaLoEXM%2BOWhFxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Console Routes With Django ??

2015-08-11 Thread Gergely Polonkai
Hello,

as far as I know, Django doesn't have thin functionality built in. I would
be interested in such an app, though…

Best,
Gergely
On 11 Aug 2015 21:30, "Prabath Peiris"  wrote:

> Hi
>
> I am new to (kind of) Django framework and just finish the
> Django-REST-framework tutorials and it looks really cool. I am a big fan of
> ZendFramework2.0 (with Apigility) and trying to make parallels between
> these two frameworks. My primary question is about console routes. In ZF2
> you can define console routes very easily and execute same controllers as
> web API requests. What is the best way to accomplish this in Django
> (specially using REST framework).
>
> ZF2 console routes :
> http://framework.zend.com/manual/current/en/modules/zend.console.routes.html
>
>
> Thanks
> Prabath
>
> --
> 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/192c3d1d-3bb1-4052-9e50-189c265efdeb%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/CACczBULab3e6xbTJXfcbKB8GnMhbNsNrfE%2B7dHA2fHtZ11sXpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using FormMixin with DetailView

2015-07-28 Thread Gergely Polonkai
Forgot to add, the full backtrace would be helpful, too. It should be
present on the same error page.
On 28 Jul 2015 08:52, "Gergely Polonkai" <gerg...@polonkai.eu> wrote:

> Hello,
>
> could you show us the relevant part of your urls.py file? I suspect view
> parameters to cause the trouble but I'd like to be sure.
>
> Best,
> Gergely
> On 28 Jul 2015 00:46, "Ioannis Latousakis" <latus...@gmail.com> wrote:
>
>> I am on the exact same situation as the one described in the
>> documentation here:
>> https://docs.djangoproject.com/en/1.7/topics/class-based-views/mixins/#using-formmixin-with-detailview
>>
>>
>> I have followed the documentation but I get the following exception:
>>
>> __init__() takes exactly 1 argument (3 given)
>>
>> Request Method:GETRequest URL:
>> http://localhost:8000/post/5144752345317376/Django Version:1.6.11Exception
>> Type:TypeErrorException Value:
>>
>> __init__() takes exactly 1 argument (3 given)
>>
>> Exception Location:...app/sitepackages/django/core/handlers/base.py in
>> get_response, line 11
>>
>>
>>
>> I think the only location where I might need something different is my
>> urls.py... Here is the complete code:
>>
>>
>> class PostView(BlogMixin,DetailView):
>> """ A view for displaying a single post """
>> template_name = 'post.html'
>> model = Post
>> def get_context_data(self, **kwargs):
>> context = super(PostView, self).get_context_data(**kwargs)
>> context['form'] = CommentForm()
>> return context
>>
>> class PostDetailView(View):
>> print "HERE    "
>>
>>
>> def get(self, request, *args, **kwargs):
>> print "GET    "
>> view = PostView.as_view()
>> return view(request, *args, **kwargs)
>>
>>
>> def post(self, request, *args, **kwargs):
>> print "POST    "
>> view = PostComment.as_view()
>> return view(request, *args, **kwargs)
>>
>>
>> class PostComment(  SingleObjectMixin , FormView):
>> template_name = 'post.html'
>> form_class = CommentForm
>> model = Post
>>
>>
>> def post(self, request, *args, **kwargs):
>> self.object = self.get_object()
>> return super(PostComment, self).post(request, *args, **kwargs)
>>
>>
>> def get_success_url(self):
>> return reverse('post-detail', kwargs={'pk': self.object.pk})
>>
>> class BlogMixin(object):
>> """
>> Basic mixin for all the views. Update the context with additional
>> information that is required across the whole site, typically
>> to render base.html properly
>> """
>> def get_context_data(self, *args, **kwargs):
>> context = super(BlogMixin, self).get_context_data(*args, **kwargs)
>> blog = Blog.get_unique()
>> context.update({
>> 'blog': blog,
>> 'active_user': users.get_current_user(),
>> 'is_admin': users.is_current_user_admin()
>> })
>> return context
>>
>> urls.py:
>> url(r'^post/(?P[\d]+)/$', views.PostDetailView.,
>> name="post-detail"),
>>
>>
>>
>> Before the exception, 'HERE --" is printed, but no GET or POST
>>
>> --
>> 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/299d4e5e-0b69-4627-a1e6-e7f2d1ff9d8d%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/299d4e5e-0b69-4627-a1e6-e7f2d1ff9d8d%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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/CACczBUKwyqRuyU0W%2B6oVnt-HUcuPgW00a6wAcZtX5bdOis4TPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using FormMixin with DetailView

2015-07-28 Thread Gergely Polonkai
Hello,

could you show us the relevant part of your urls.py file? I suspect view
parameters to cause the trouble but I'd like to be sure.

Best,
Gergely
On 28 Jul 2015 00:46, "Ioannis Latousakis"  wrote:

> I am on the exact same situation as the one described in the documentation
> here:
> https://docs.djangoproject.com/en/1.7/topics/class-based-views/mixins/#using-formmixin-with-detailview
>
>
> I have followed the documentation but I get the following exception:
>
> __init__() takes exactly 1 argument (3 given)
>
> Request Method:GETRequest 
> URL:http://localhost:8000/post/5144752345317376/Django
> Version:1.6.11Exception Type:TypeErrorException Value:
>
> __init__() takes exactly 1 argument (3 given)
>
> Exception Location:...app/sitepackages/django/core/handlers/base.py in
> get_response, line 11
>
>
>
> I think the only location where I might need something different is my
> urls.py... Here is the complete code:
>
>
> class PostView(BlogMixin,DetailView):
> """ A view for displaying a single post """
> template_name = 'post.html'
> model = Post
> def get_context_data(self, **kwargs):
> context = super(PostView, self).get_context_data(**kwargs)
> context['form'] = CommentForm()
> return context
>
> class PostDetailView(View):
> print "HERE    "
>
>
> def get(self, request, *args, **kwargs):
> print "GET    "
> view = PostView.as_view()
> return view(request, *args, **kwargs)
>
>
> def post(self, request, *args, **kwargs):
> print "POST    "
> view = PostComment.as_view()
> return view(request, *args, **kwargs)
>
>
> class PostComment(  SingleObjectMixin , FormView):
> template_name = 'post.html'
> form_class = CommentForm
> model = Post
>
>
> def post(self, request, *args, **kwargs):
> self.object = self.get_object()
> return super(PostComment, self).post(request, *args, **kwargs)
>
>
> def get_success_url(self):
> return reverse('post-detail', kwargs={'pk': self.object.pk})
>
> class BlogMixin(object):
> """
> Basic mixin for all the views. Update the context with additional
> information that is required across the whole site, typically
> to render base.html properly
> """
> def get_context_data(self, *args, **kwargs):
> context = super(BlogMixin, self).get_context_data(*args, **kwargs)
> blog = Blog.get_unique()
> context.update({
> 'blog': blog,
> 'active_user': users.get_current_user(),
> 'is_admin': users.is_current_user_admin()
> })
> return context
>
> urls.py:
> url(r'^post/(?P[\d]+)/$', views.PostDetailView.,
> name="post-detail"),
>
>
>
> Before the exception, 'HERE --" is printed, but no GET or POST
>
> --
> 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/299d4e5e-0b69-4627-a1e6-e7f2d1ff9d8d%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/CACczBUL-Kog-%3D04Biv3uKpE8_qNMNt_GxzFH%3Doa_DNMtRxm83g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model opinnions

2015-07-26 Thread Gergely Polonkai
It should, yes. But instead hardcoding /media in your templates, use {{
MEDIA_URL }}
On 26 Jul 2015 11:57, <duriromp...@gmail.com> wrote:

> Yeah, there is a test image to do the work. But I'm not using HTML
> elements to see it: I'm trying to directly see it with the URL, like when
> you open a Twitter image in a new tab.
>
> About the setup...
> MEDIA_ROOT = os.path.join(BASE_DIR, '/media/')
> MEDIA_URL = '/media/'
> So *localhost:8000/media/images/avatar.jpg* would work, isn't it?
>
>
> El sábado, 25 de julio de 2015, 23:14:58 (UTC+2), Gergely Polonkai
> escribió:
>>
>> Do you save your avatar images there? Do you prepend MEDIA_URL to the
>> avatar's src=""? How do you display the image by the way?
>>
>> These are the quick questions that came into my mind without knowing your
>> setup…
>> On 25 Jul 2015 22:59, <durir...@gmail.com> wrote:
>>
>>> Nah, I just want to have an avatar inside, to get easy.
>>>
>>> And I tried the media docs a few hours ago, but for some reason it
>>> doesn't work. I've to set specific URL in *urls.py* of the app? (Also
>>> notice that I use another folder inside media, but I don't think that's the
>>> problem).
>>>
>>> El viernes, 24 de julio de 2015, 13:47:26 (UTC+2), durir...@gmail.com
>>> escribió:
>>>>
>>>> I'm doing a little app that consists of a web page were users submits
>>>> their jokes (
>>>> https://github.com/RompePC/django-muro_humoristas/tree/feature). I had
>>>> finished the models (a little overview would help), but I have one 
>>>> question.
>>>>
>>>> I want to use an avatar field for the users: however, I don't
>>>> understand well for what is *MEDIA_URL* (also, I would want to know
>>>> where you would put your *MEDIA_ROOT*, in a folder of the app, or in a
>>>> directory as one that gives the example
>>>> https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-MEDIA_ROOT
>>>> ).
>>>>
>>>> Thanks (and sorry if anyone doesn't understand spanish hehe).
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d1078810-e3b2-46e6-b6ca-15992d1f6ada%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/d1078810-e3b2-46e6-b6ca-15992d1f6ada%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/CACczBUL17Vudf_pFn4s7UKct7g9%2BvfCn3H4GfwhON5p9RrDeLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model opinnions

2015-07-25 Thread Gergely Polonkai
Do you save your avatar images there? Do you prepend MEDIA_URL to the
avatar's src=""? How do you display the image by the way?

These are the quick questions that came into my mind without knowing your
setup…
On 25 Jul 2015 22:59,  wrote:

> Nah, I just want to have an avatar inside, to get easy.
>
> And I tried the media docs a few hours ago, but for some reason it doesn't
> work. I've to set specific URL in *urls.py* of the app? (Also notice that
> I use another folder inside media, but I don't think that's the problem).
>
> El viernes, 24 de julio de 2015, 13:47:26 (UTC+2), durir...@gmail.com
> escribió:
>>
>> I'm doing a little app that consists of a web page were users submits
>> their jokes (
>> https://github.com/RompePC/django-muro_humoristas/tree/feature). I had
>> finished the models (a little overview would help), but I have one question.
>>
>> I want to use an avatar field for the users: however, I don't understand
>> well for what is *MEDIA_URL* (also, I would want to know where you would
>> put your *MEDIA_ROOT*, in a folder of the app, or in a directory as one
>> that gives the example
>> https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-MEDIA_ROOT
>> ).
>>
>> Thanks (and sorry if anyone doesn't understand spanish hehe).
>>
>  --
> 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/d1078810-e3b2-46e6-b6ca-15992d1f6ada%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/CACczBUJgv2mbHtFuSh7CJpcueqRs-2y8LvhhZHvkAGF4DvmpFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model opinnions

2015-07-25 Thread Gergely Polonkai
MEDIA_URL is a prefix that you will put in front of the URL media files.
E.g. you set your webserver to load such files under the /media/ URL, like
www.example.com/media/my-video.webm. Using different storage backends, like
an Amazon S3 bucket, you may want to set this to the bucket's URL.

However, you can even outsource avatar handling to some provider, like
Gravatar (which is a totally different topic, though).
I'm doing a little app that consists of a web page were users submits their
jokes (https://github.com/RompePC/django-muro_humoristas/tree/feature). I
had finished the models (a little overview would help), but I have one
question.

I want to use an avatar field for the users: however, I don't understand
well for what is *MEDIA_URL* (also, I would want to know where you would
put your *MEDIA_ROOT*, in a folder of the app, or in a directory as one
that gives the example
https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-MEDIA_ROOT).

Thanks (and sorry if anyone doesn't understand spanish hehe).

-- 
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/fddd7d84-04d3-4e88-ab8c-a75fb5b4e673%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/CACczBU%2BB6OVG%3DUQ03Fh1BBx7Z2C2tgQiwOL%3D036wV_OYvh%2BtQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django : DRF Token based Authentication VS JSON Web Token

2015-07-23 Thread Gergely Polonkai
Hello,

after a quick read I cannot find any essential differences between the two,
in regards of authentication. JWT, however, is much more fine grained and
has a bunch of token manipulation options.

Best,
Gergely
On 24 Jul 2015 03:01, "Ankit Agrawal"  wrote:

>
>Hi everyone,
>
>
> I am building a real world application where users will access the app
> primarily from Android, iOS devices as well as Desktops.
>
> From my elementary research, I have realized that token based
> authentication mechanism is more better and elegant for client-server
> models as compared to session based authentication.
>
>
> In Django, I have found two popular ways to do this -
>
>1.
>
> http://www.django-rest-framework.org/api-guide/authentication/#tokenauthentication
>2. http://getblimp.github.io/django-rest-framework-jwt/
>
> From what I understood, option 2] is an extension of 1] except that the
> Token is in the form of JSON(serialized). I would like to understand what
> other differences there are between option 1] and 2] and the
> advantages/disadvantages of choosing either.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/11204a7d-a582-40bd-a9ba-e06abe23afff%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/CACczBU%2BOuayzoNLSX%2BQTbCdXBT0xsUzb%3DCRXh%3DyCzj%2BF4yvWZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Gergely Polonkai
Hello,

I'm sorry, I was not around my mailbox lately.

Yes, you are right, my attempt is not the solution to your problem; it
seems that this m2m field really cannot be modified like this. With some
slight modifications, though, it may be.

1) create the through table
2) migrate data with RunPython — if you want to be portable, stay with
RunPython instead of RunSQL
3) delete the ManyToManyField
4) recreate the ManyToManyField with the through option

All this can (and I think, should) go into the same migration file.
Meanwhile it might worth a question to the devs (or a more thorough search
on the topic) to understand why you can't switch from a simple m2m field to
one with a through option.

Best,
Gergely
On 23 Jul 2015 19:08, "Carsten Fuchs"  wrote:

> Hi Carl,
>
> Am 23.07.2015 um 18:28 schrieb Carl Meyer:
>
>> Overall I think it might be simpler to go with your initial approach. I'd
>> first rename
>> the old field to some other temporary name (you don't have to update any
>> other code to
>> use this name, as you'll commit all of these migrations in one commit, so
>> nothing but
>> the following data migration ever needs to know anything about this
>> temporary name),
>>
>
> Thanks for clarifying the details regarding renaming! With this, this is
> the approach that I feel the most comfortable with and will try now.
>
> Overall, many thanks for your thoughts and your detailed reply, it's very
> much appreciated and helps a lot!
>
> Best regards,
> Carsten
>
> --
> 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/55B11F7B.1010805%40cafu.de.
> 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/CACczBU%2BYcmaxdqr7q-i%3DY1Xe3U%2BE0BqUF%2BqbBWFhthQoWFOg7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHOP APP

2015-07-21 Thread Gergely Polonkai
…anyways, I'm not really sure it can be done in mere 6 hours. Or if so, I
wouldn't dare to deploy it to production :)
On 22 Jul 2015 00:06, "Cesar Mojarro"  wrote:

> hahaha!
> Can you do my homework?
>
> On Tue, Jul 21, 2015 at 4:59 PM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>>
>> On Tue, Jul 21, 2015 at 7:11 PM, dravid rahul 
>> wrote:
>>
>>> Hi can anyone please help me with this.. I am newbie to django.
>>>
>>> PLEASE FIND BELOW ATTACHMENT
>>>
>>> Thanks in Advance
>>> Dravid
>>>
>>
>> Dravid - we're not going to do your homework for you. You've been given a
>> task for assessment purposes - the whole point is that you do the work
>> yourself.
>>
>> We're happy to answer questions, but they need to be specific questions
>> about usage, not "can you do this for me".
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>>  --
>> 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/CAJxq84-tBeir0qSbARb0Djg%3D%2BsZoM%2BXK6rat85e22D%3DtZ00Liw%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/CAHXGZtqGTZt33HBH-GAY84X4EStrb4Ts3-iujA96YGGXXit_sQ%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/CACczBUJqX1_t-Va2JJ5ty15%2B-YLSqVycXWBzhPxuTNAibfV1OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Good practise on Form logic

2015-07-18 Thread Gergely Polonkai
Hello,

whichever fits you. If you always and only do it before saving, you can
integrate it in the form's save() method, for example.

Another thing to consider is, what does some_logic do? If it works only
with the form data (e.g. transposing it somehow, which new data may be used
by others like a view), then it should clearly be part of the form, not the
view.

Best,
Gergely
On 18 Jul 2015 23:09, "Aldo Suarez"  wrote:

> Say for example you have a Form with its validator methods.
> Then, in the view you normally do:
>
> in forms.py,
>
> if form.is_valid():
>> # do some logic / add to database
>> # redirect
>
>
>
> Now: Is it good practise to do that "post-logic" inside Form methods or
> should I do it on the view? i.e.
>
> in views.py,
>
> def some_view(request):
>> if request.method == 'POST':
>> form = SomeForm(request.POST)
>> if form.is_valid():
>> form.some_logic(request.user)
>> # redirect
>> else:
>> form = SomeForm()
>> # render
>
>
> in forms.py,
>
> class SomeForm(forms.Form):
>> def clean(self):
>> # clean data
>> def some_logic(self, user):
>> # some logic w/ cleaned data
>
>  --
> 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/cdb0ae37-7f46-42c0-b99c-f3a641bbad0b%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/CACczBULzwe%3DAy8EUPpK4EHHZvZqdGYWgT3jB6ZzhpucyUFnFOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >