Re: Added new column to model and run migrations but not applied to database table

2022-07-03 Thread Malik Rumi
Hi Salima. I am having a similar issue. I see it has been two weeks without 
a response. Have you found a similar bur report on the Django bug tracker? 
Have you filed a bug report yourself? Have you found a sustainable 
solution? Thanks.

On Wednesday, June 15, 2022 at 8:46:59 AM UTC-5 sali...@rohteksolutions.com 
wrote:

> Hello Django experts,
>
> We are seeing this problem again and think that this should be a serious 
> bug in Django. We are wondering whether any one in this community is having 
> the same issue. I would appreciate it if you could share your thoughts on 
> this because we are really unhappy to see this problem again and again. 
>
> Thanks 
> ~Salima
>
> On Mon, Aug 16, 2021 at 9:47 AM Salima Begum  
> wrote:
>
>> Hi,
>> I am hitting this problem again with new code merges into the 
>> deployment server. Last time, I fixed the issue by doing like this
>>
>> "I have tried all the ways what you guys suggested me But here I don't 
>> want change database why because it is deployment server so, when I run 
>> manage.py makemigrations migrations are applied and changes are reading but 
>> when I run manage.py migrate changes are not taken to database so, Manually 
>> I queried queries to add columns into respected tables into database."
>>
>> I really think this might not be a sustainable solution. So, I would 
>> really like to fix this permanently. I would appreciate it if someone could 
>> suggest a remedy for this issue.
>>
>> Thank you in advance
>> ~Salima
>>
>> On Tue, Jul 27, 2021 at 5:18 AM guna visva  wrote:
>>
>>> having had the unfortunate phase of dealing with it , sorting it 
>>> requires some patience
>>>
>>> the issue is the tables in django_migrations is not in sync with rest 
>>> the rest of your database or migrations files. 
>>>
>>> You have to first remove the addition in field etc and make sure the 
>>> database tables are first in sync with your models, then 1. delete 
>>> migrations files and 2. delete django_migrations. Then 3.makemigrations and 
>>> 4. migrate fake.  All risks are yours to take
>>>
>>> Then finally just add your fields and makemigrations and migrate
>>>
>>> The above might/or not work as it might give some content type errors 
>>>
>>>
>>>
>>>
>>> On Wednesday, July 21, 2021 at 2:39:56 AM UTC+8 sebasti...@gmail.com 
>>> wrote:
>>>
 Is in settings.py also in installed app? Without that migrations don't 
 work

 Salima Begum  schrieb am Di., 20. Juli 
 2021, 19:00:

> Hi ,
> Thank you for your responses.
>  I have tried all the ways Which you people suggested I am not getting 
> any error while running makemigrations or migrate and 
> python manage.py migrate --fake-initial. But those migrations are not 
> applying to the database. How can I fix this issue without deleting the 
> database? 
>
> Thank you
> ~Salima
>  
>
> On Mon, Jul 19, 2021 at 7:02 PM Aman Vyas  wrote:
>
>> if it is saying no changes detected while running makemigrations and 
>> you are sure that you changed models.py  then these things you can try:
>>
>> 1: python manage.py makemigrations appname
>>
>> if this will not work then do that
>>
>> 2: delete migrations folder from your app and delete database then 
>> run again python manage.py makemigrations
>>
>>
>>
>>
>> On Mon, Jul 19, 2021 at 6:07 AM Salima Begum <
>> sali...@rohteksolutions.com> wrote:
>>
>>> Hi all,
>>>
>>> I have added a new column to the existing model while developing. 
>>> Then I run makemigrations and migrate. It is not applied to the 
>>> database 
>>> table which is created based on that model. How can I fix this issue? 
>>> Please help me to complete this issue.
>>>
>>> The below issue I am facing in deployment server after adding new 
>>> field and deployed into server.
>>>
>>> ```
>>> psycopg2.errors.UndefinedColumn: column 
>>> shopping_ls_product_search.quality_prdct does not exist
>>> LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE 
>>> ("shopping_...
>>> ```
>>> Thank you
>>> ~Salima
>>>
>>> -- 
>>> You received this message because you are subscribed 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google 
>> Groups "Django users" group.
>> To unsubscribe from this group and stop rece

ForeignKey Reverse Relation Fail

2022-07-27 Thread Malik Rumi
I have a model with a recursive foreign key to 'self'. This is intended to 
model a parent child
relation among instances. The forward relation, on a field called 
'childof', works as expected.
The reverse relation, using the related_name 'parent', comes up as a 
RelatedManager,
again as expected. However, parent.count(), parent.all(), etc., always give 
me the "Manager is
not accessible on instances" error. Many of these parent instances will 
themselves also be a
childof some other instance, and apparently, that's my problem. I don't 
know how to make Django
recognize the dual nature of some instances. Is there a way to hack the 
RelatedManager to fix this?

I am not getting any accessor errors from manage.py check.

I posted this to Django Forum, but the respondent was not able to duplicate 
my issue - i.e.,
he said it worked as expected for him. :-(

I saw a suggestion to use an explicit junction table on Stack Overflow, but 
making a round trip - or two - to an external table seems like an
awful lot of overhead for this situation.

If instead of a junction table, if I made an explicit parentto field on the 
model, would that work?
Presumably the related name on the childof field would still fail like it 
does now,
but I would instead have the explicit parent field to work with. I still 
would not have the
automatic reverse relation, and I would have to come up with a script to 
fill in the parentto
field, but that might solve my problem:
# pseudocode
family = c.itertools.groupby(instance.childof)
family = c.pandas.groupby(instance.childof)
for f in family:
pop = c.objects.get(instance.childof)
OR
pop = instance.childof
c.objects.update(pop.parentto=f) # where parentto is a Postgresql ArrayField
OR # 
https://docs.djangoproject.com/en/4.0/ref/models/relations/#django.db.models
.fields.related.RelatedManager.add:
>>> b = Blog.objects.get(id=1)
>>> e = Entry.objects.get(id=234)
>>> b.entry_set.add(e) # Associates Entry e with Blog b
SEE ALSO: 
https://docs.djangoproject.com/en/4.0/topics/db/examples/many_to_one/

If I did this two field hack, then I don't really need either one to be 
ForeignKeys any more,
do I? They could be a CharField and an ArrayField, couldn't they? That 
breaks the extended 
lookup chain - but I don't have that now, anyway - or at least, I only have 
it in one direction.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3555d391-9c9e-440f-a603-103c9ccdc858n%40googlegroups.com.


Re: ForeignKey Reverse Relation Fail

2022-07-27 Thread Malik Rumi
Thanks, but the recursive foreignkey *is* a one to many relationship...
unless you're talking about something else?
*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*


On Wed, Jul 27, 2022 at 10:16 AM Ammar Mohammed 
wrote:

> Hi
> Have you tried using OneToMany relationship ?
> On 27 Jul 2022 12:18, "Malik Rumi"  wrote:
>
>> I have a model with a recursive foreign key to 'self'. This is intended
>> to model a parent child
>> relation among instances. The forward relation, on a field called
>> 'childof', works as expected.
>> The reverse relation, using the related_name 'parent', comes up as a
>> RelatedManager,
>> again as expected. However, parent.count(), parent.all(), etc., always
>> give me the "Manager is
>> not accessible on instances" error. Many of these parent instances will
>> themselves also be a
>> childof some other instance, and apparently, that's my problem. I don't
>> know how to make Django
>> recognize the dual nature of some instances. Is there a way to hack the
>> RelatedManager to fix this?
>>
>> I am not getting any accessor errors from manage.py check.
>>
>> I posted this to Django Forum, but the respondent was not able to
>> duplicate my issue - i.e.,
>> he said it worked as expected for him. :-(
>>
>> I saw a suggestion to use an explicit junction table on Stack Overflow,
>> but making a round trip - or two - to an external table seems like an
>> awful lot of overhead for this situation.
>>
>> If instead of a junction table, if I made an explicit parentto field on
>> the model, would that work?
>> Presumably the related name on the childof field would still fail like it
>> does now,
>> but I would instead have the explicit parent field to work with. I still
>> would not have the
>> automatic reverse relation, and I would have to come up with a script to
>> fill in the parentto
>> field, but that might solve my problem:
>> # pseudocode
>> family = c.itertools.groupby(instance.childof)
>> family = c.pandas.groupby(instance.childof)
>> for f in family:
>> pop = c.objects.get(instance.childof)
>> OR
>> pop = instance.childof
>> c.objects.update(pop.parentto=f) # where parentto is a Postgresql
>> ArrayField
>> OR #
>> https://docs.djangoproject.com/en/4.0/ref/models/relations/#django.db.models
>> .fields.related.RelatedManager.add:
>> >>> b = Blog.objects.get(id=1)
>> >>> e = Entry.objects.get(id=234)
>> >>> b.entry_set.add(e) # Associates Entry e with Blog b
>> SEE ALSO:
>> https://docs.djangoproject.com/en/4.0/topics/db/examples/many_to_one/
>>
>> If I did this two field hack, then I don't really need either one to be
>> ForeignKeys any more,
>> do I? They could be a CharField and an ArrayField, couldn't they? That
>> breaks the extended
>> lookup chain - but I don't have that now, anyway - or at least, I only
>> have it in one direction.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3555d391-9c9e-440f-a603-103c9ccdc858n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/3555d391-9c9e-440f-a603-103c9ccdc858n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/xGtwxhx2Nrw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHs1H7tjom_GRucP8Dx3x8AzQobS4GCva8a0nuN3bEWVB2Taqw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHs1H7tjom_GRucP8Dx3x8AzQobS4GCva8a0nuN3bEWVB2Taqw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBxYfR6ntzGe8EGbnm0z6%2BxjiJDP5nmg9kF5kuB9pCZiEg%40mail.gmail.com.


Re: Not getting static files with django & heroku deployment

2015-07-04 Thread Malik Rumi
Hi Martin,

First let me say unapologetically that I love PyDanny and his work and 
contributions to the Django community, especially Two Scoops. However, you 
should know that the philosophy he espouses there is very different from 
the one Heroku espouses. I've been told he talks about that somewhere, but 
I've never seen it personally. 

I won't go into too much detail, but you can read about it here: 
https://devcenter.heroku.com/articles/architecting-apps

What you need more than anything is the Heroku Django template :  
https://devcenter.heroku.com/articles/django-app-configuration

Try that first. Follow the directions carefully, then let us know if you 
still need help. 


On Saturday, July 4, 2015 at 7:13:39 PM UTC-5, Martin Torre Castro wrote:
>
> Hello,
>
> I'm developing a webapp with Django 1.7 (project_name is "sonata") and the 
> project layout from the "Two scoops of Django 1.6", so I have a 3-tier 
> basic folder tree.
>
> .├── requirements└── sonata
> ├── person
> │   └── templatetags
> ├── registration
> ├── sonata
> │   └── settings
> ├── static
> │   ├── css
> │   │   └── images
> │   ├── fonts
> │   └── js
> ├── templates
> │   ├── personApp
> │   └── registrationApp
> └── utils
> └── templatetags
>
>
> I have a problem when deploying on Heroku. I have achieved the deployment, 
> but the static files are not being served to the browser.
>
> I know I should force some way of serving the static files through the 
> settings and have googled about. I've seen many ways and read about using 
> Amazon services, but I'm looking for the easiest one, which will make the 
> future production deployment easy as well with gUnicorn (I hope).
>
> I tried modifying the settings file (which is the heroku.py one, which 
> overrides the base.py) and changing values for STATIC_ROOT, 
> STATICFILES_DIRS and adding the line:
>
> *urlpatterns += static(settings.MEDIA_URL, 
> document_root=settings.STATIC_ROOT)*
> 
> I've tried as well running:
>
> *heroku run sonata/manage.py collectstatic*
> 
> before doing 
>
> *git push heroku master*
>
> but nothing happens, even checking with 
>
> *heroku run ls sonata/assets *
>
> that the files are being copied.
>
> Please, I would like some orientation for really understanding what I'm 
> doing wrong and mending it. 
>
> When finding out about heroku and deployment I met also some sample 
> ProcFiles which used a project_name.wsgi file and I don't know anything 
> about it.
>
> I could use use some help, because the more webs I read, the more confused 
> I get. Please assume I know very little about deployments. A link would be 
> useful, but it has to show newbie's material :-(
>
> Thank you very much on advance.
>
>
> ### *ProcFile* 
> ##
> web: python sonata/manage.py runserver 0.0.0.0:$PORT --noreload
>
>
>
>
> ### *heroku.py* 
> ##
> # -*- coding: utf-8 -*-
> """Heroku settings and globals."""
> 
> from __future__ import absolute_import
> 
> from .base import *
> 
> from os import environ
> 
> # TODO Warning! Heroku retrieve values as strings
> # TODO we should check (only for Heroku) that 'True' and 'False' are 
> respectively True and False 0, 
> # or the equivalent ones, True and False
> def get_env_setting(setting):
> """ Gets the environment variable or an Exception.
> This can be used, for example, for getting the SECRET_KEY and not 
> having it hardcoded in the source code 
> Also for setting the active settings file for local development, 
> heroku, production server, etc... """
> try:
> return environ[setting]
> except KeyError:
> error_msg = "Set the %s env variable" % setting
> raise ImproperlyConfigured(error_msg)
> 
> ## HOST CONFIGURATION
> # See: 
> https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production
> ALLOWED_HOSTS = ['*']
> ## END HOST CONFIGURATION
> 
> ## EMAIL CONFIGURATION
> # See: 
> https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
> 
> # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host
> EMAIL_HOST = environ.get('EMAIL_HOST', 'smtp.gmail.com')
> 
> # See: 
> https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
> EMAIL_HOST_PASSWORD = environ.get('EMAIL_HOST_PASSWORD', '')
> 
> # See: 
> https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
> EMAIL_HOST_USER = environ.get('EMAIL_HOST_USER', 'your_...@example.com 
> ')
> 
> # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-port
> EMAIL_PORT = e

Fighting with sqlcustom

2014-07-09 Thread Malik Rumi


Background: I am new to Django and Python, having started on Windows this 
past December. Currently I am working in a Vagrant precise64 box, and 
wanted to import one of my old Windows apps which was done on sqlite3 to my 
current postgres. Once I got that done, Django told me I would need to run 
sqlcustom. So I did, and all I’ve been getting since is one error after 
another. 

The current error is:

django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, 
> but se
> ttings are not configured. You must either define the environment variable 
> DJANG
> O_SETTINGS_MODULE or call settings.configure() before accessing settings.

 I am working off Randall Degges’ django-skel with Django 1.5, so I have 
apps, settings, and requirements folders for prod, common, and dev. Prod is 
working fine on Heroku, where DJANGO SETTINGS MODULE is in the config vars.

Up until now, when I want to do something locally, I use 
–settings=mylocalsettings, which I got from the Two Scoops book and had 
been working fine, but not here. The sqlcustom command does not seem to 
accept or recognize this attempt to direct it to my local settings.

The error message tells me to either set DJANGO SETTINGS MODULE or 
configure(). I’ve never come across configure() before. Apparently it is 
different from –settings=mylocalsettings, but I can’t tell you how or why.

I don’t want to put DJANGO SETTINGS MODULE in my local environment because 
I don’t know what that would do to either my other projects or my Heroku 
settings. I am in a virtual environment, but does that isolate the 
environmental variables? Even if it does, what impact would this have on my 
Heroku settings for this project?

On the official docs, I found this either or message 
.
 
But the same document allows for the TwoScoops way, which it calls ‘manual’.

I tried django-admin.py but then I got this:

ImportError: Could not import settings 'fed1.settings.dev' (Is it on 
> sys.path?):
>  No module named fed1.settings.dev

 Note that now there is no database or settings module issue. The path is 
correct – *IF *django-admin.py is looking at the directory I am in. I have 
manage.py but not django-admin.py, which I assume is buried somewhere else 
in Django itself.

 

Why isn’t manual working?

Where do I put configure()? At the top of settings.dev? 

Why was manage.py runserver not giving me any errors?

What do I do to get this working?

Bonus: Why don't the instructions also tell me to syncdb or run a migration?

thx.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/3884e06b-0b32-4591-8ec1-b88ef17bc039%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Errors Using Pip In Powershell to Download Django

2014-07-16 Thread Malik Rumi
Yesterday I tried to get the 1.7rc1 and got the error 'file contains no 
section headers'. I assumed this was because it was a tarball, and after 
looking around gave up for the night.
Tonight I decided to just get 1.6.5. But to my surprise, I got the same 
error. I have no control over putting section headers in these files. What 
do I do now? 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/357d221c-7ac0-40cf-854a-9890ecded8ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Errors Using Pip In Powershell to Download Django

2014-07-17 Thread Malik Rumi
Thanks to both of you. I had a corrupt pip cache. Solution here: 
http://stackoverflow.com/questions/9510474/removing-pips-cache

On Thursday, July 17, 2014 10:20:51 AM UTC-5, cmawe...@gmail.com wrote:
>
> Yesterday I tried to get the 1.7rc1 and got the error 'file contains no 
>> section headers'. I assumed this was because it was a tarball, and after 
>> looking around gave up for the night.
>> Tonight I decided to just get 1.6.5. But to my surprise, I got the same 
>> error. I have no control over putting section headers in these files. What 
>> do I do now? Thanks. 
>>
>
> Yes, you could try zip:
> https://github.com/django/django/zipball/1.7c1
> or, even newer:
> https://github.com/django/django/zipball/stable/1.7.x 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e3d5a4f-c690-4d38-a4a3-d51ff43dbdad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What is the difference between running manage.py and ./manage.py?

2014-08-03 Thread Malik Rumi
Is this a Linux thing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/4b5c91a6-3ee8-4855-96fb-011e87d10d7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to Construct a View with multiple and singular objects?

2014-08-04 Thread Malik Rumi


I have a model with numerous objects. However, some of these objects have 
sub-objects and some do not. When calling up an object with sub-objects, 
(linked by a foreign key) I’d like to display 

Object

1.Sub object

2.Sub object

And when the user requests an object with no subs, they get

Object

However, if I have a ‘get’ for objects in my view, I am going to get an 
error for all objects that have sub objects.

Similarly, if I use a listview, I will get all the objects and sub objects 
on one long page, which I don’t want. 

My tentative solution is to put this in the template:

If objects with sub objects

{{List of linked sub objects}}

else

{{object}}

Assuming that works, my difficulty is with the view. How do I write it to 
cover both situations without putting them in separate models?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/902668f2-22ef-4ba6-a234-dca1128a2e25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the difference between running manage.py and ./manage.py?

2014-08-04 Thread Malik Rumi
Thanks for the clarification!

On Sunday, August 3, 2014 9:16:01 PM UTC-5, Lachlan Musicman wrote:
>
> Not really, it's a Nix thing (ie, OSX and BSD as well as linux). 
>
> Basically, if you set the file to be executable (chmod +x) then 
> ./filename is a way of executing using the default file association 
> (.py is python usually). 
>
> The ./ bit indicates "look in the folder we are in" - if the file is 
> not in the folder you run it from, you will need to use the full path. 
>
> In other words, the difference is merely one of execution, both give 
> the same result, since it's two ways of doing the same thing. 
>
> cheers 
> L. 
>
> On 4 August 2014 12:03, Malik Rumi > 
> wrote: 
> > Is this a Linux thing? 
> > 
> > -- 
> > You received this message because you are subscribed 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/4b5c91a6-3ee8-4855-96fb-011e87d10d7d%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> You have to be really clever to come up with a genuinely dangerous 
> thought. I am disheartened that people can be clever enough to do that 
> and not clever enough to do the obvious thing and KEEP THEIR IDIOT 
> MOUTHS SHUT about it, because it is much more important to sound 
> intelligent when talking to your friends. 
> This post was STUPID. 
> ---
>  
>
> The Most Terrifying Thought Experiment of All Time 
>
> http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/4704d1a0-1388-4464-9dda-45a5d3eabec7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


1.7: module has no attribute

2014-08-10 Thread Malik Rumi
I am trying to make my first django project using 1.7. When I try to run 
python manage.py * (runserver, makemigrations, shell, validate - it doesn't 
matter) I get the same error: 

slug = models.Slugfield(max_length=50, unique=True)
AttributeError: 'module' object has no attribute 'Slugfield'

Here is what I have done to try to correct this:

1. Shortened the max_length on Slugfield to 50 from 100
2. Created an apps.py for AppConfig, as laid out in 
https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.apps 
3. Changed INSTALLED APPS to include 'apps.appnameConfig'
4. Checked the capitalization of my models, classes, modules, and app names
5. Copied the slug field from my model's Articles class and pasted it into 
apps.py

When I did that, I got:

NameError: name 'models' is not defined

This did not make any sense to me at all. What was I supposed to do now, 
import models?

6. Figuring I had nothing to lose, I did import models, and got:

AttributeError: 'module' object has no attribute 'Slugfield'

Right back where I started from. 

Please help. Thx. 

ps - I don't know if this is an appconfig issue or not, but while we are at 
it, let me confess that I don't get it. Yes, I read the docs. I don't get 
it. I don't understand the benefit. I have never used ready(), but of 
course I am still quite new to all 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/ea8a36a0-634b-4b3b-a531-60cdd03a044a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7: module has no attribute

2014-08-11 Thread Malik Rumi
Damn. I wouldn't say I was out of the woods yet, still other errors to deal 
with, but at least this one does seem to have gone away. Thanks, Sulphur.

On Monday, August 11, 2014 1:01:34 AM UTC-5, Me Sulphur wrote:
>
> It is SlugField (F is capital) and not Slugfield
>
> Refer:
> https://docs.djangoproject.com/en/dev/ref/models/fields/#slugfield
>
>
>
> On Monday, 11 August 2014 10:06:20 UTC+5:30, Malik Rumi wrote:
>>
>> I am trying to make my first django project using 1.7. When I try to run 
>> python manage.py * (runserver, makemigrations, shell, validate - it doesn't 
>> matter) I get the same error: 
>>
>> slug = models.Slugfield(max_length=50, unique=True)
>> AttributeError: 'module' object has no attribute 'Slugfield'
>>
>> Here is what I have done to try to correct this:
>>
>> 1. Shortened the max_length on Slugfield to 50 from 100
>> 2. Created an apps.py for AppConfig, as laid out in 
>> https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.apps 
>> 3. Changed INSTALLED APPS to include 'apps.appnameConfig'
>> 4. Checked the capitalization of my models, classes, modules, and app 
>> names
>> 5. Copied the slug field from my model's Articles class and pasted it 
>> into apps.py
>>
>> When I did that, I got:
>>
>> NameError: name 'models' is not defined
>>
>> This did not make any sense to me at all. What was I supposed to do now, 
>> import models?
>>
>> 6. Figuring I had nothing to lose, I did import models, and got:
>>
>> AttributeError: 'module' object has no attribute 'Slugfield'
>>
>> Right back where I started from. 
>>
>> Please help. Thx. 
>>
>> ps - I don't know if this is an appconfig issue or not, but while we are 
>> at it, let me confess that I don't get it. Yes, I read the docs. I don't 
>> get it. I don't understand the benefit. I have never used ready(), but of 
>> course I am still quite new to all 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/a2fecbf4-7d57-49af-a4b2-fdbf9433d6fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to Construct a View with multiple and singular objects?

2014-08-11 Thread Malik Rumi
This is on hold while I wrestle with other problems. 

On Monday, August 4, 2014 11:43:52 AM UTC-5, Collin Anderson wrote:
>
> Do you get an error if you wrap it in an if statement?
>
> {% if object.sub_object %}{{ object.sub_object }}{% endif %}
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/f501bebc-5dcc-4152-ad62-dcf251d638b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.7: ImportError: No module named .models

2014-08-11 Thread Malik Rumi


#admin.py:

from apps..models import Articles, Sections

ImportError: No module named .models

 

I have seen this error before, and it went away when I changed INSTALLED 
APPS from  to apps. because I have all my apps in a 
folder called apps. Now I have changed even that to Config because 
of the 1.7 change to how this works. Apps.py is two levels down from here, 
so I don’t think there is a collision issue. 

I tried changing the import statement to match the Config in 
INSTALLED APPS, but that just gave me the same error with the *Config name 
instead. 

This is my model, it is clearly there, so I don’t know why or where this 
error is coming from or where to look to fix it.  is all lower 
case, both in the Django directory and in admin.py. Just for the hell of it 
I capitalized  in admin.py, but I still get the same error. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/aa401aa3-b9d9-4f01-9ac9-745f0360d311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.7: ImportError: No module named .models

2014-08-11 Thread Malik Rumi
UPDATE

What is “.models”, why and when do we import from it, and how is it 
different from importing from “models”?

I’ve never seen this .models before. I saw it the first time this morning 
in the documentation 
https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.register
 
when trying to solve this problem. But it just a casual mention, not an 
explanation. As I understood it, this was only for those choosing to use 
the new register decorator, so I didn’t worry about it. Now I’ve seen it 
again, in a video by a guy using 1.6 who, at least so far, has made no 
reference to a decorator of any kind. 

Is this the source of my problems? Where is the documentation on “.models”? 
Yes, I have looked and found zip. 

Thanks.

On Monday, August 11, 2014 8:43:29 AM UTC-5, Malik Rumi wrote:
>
> #admin.py:
>
> from apps..models import Articles, Sections
>
> ImportError: No module named .models
>
>  
>
> I have seen this error before, and it went away when I changed INSTALLED 
> APPS from  to apps. because I have all my apps in a 
> folder called apps. Now I have changed even that to Config because 
> of the 1.7 change to how this works. Apps.py is two levels down from here, 
> so I don’t think there is a collision issue. 
>
> I tried changing the import statement to match the Config in 
> INSTALLED APPS, but that just gave me the same error with the *Config name 
> instead. 
>
> This is my model, it is clearly there, so I don’t know why or where this 
> error is coming from or where to look to fix it.  is all lower 
> case, both in the Django directory and in admin.py. Just for the hell of it 
> I capitalized  in admin.py, but I still get the same error. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/4a50755e-cd00-436d-b075-158c5227a4be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.7: ImportError: No module named .models

2014-08-11 Thread Malik Rumi
Ok, changing to .models seems to have fixed that error. On to the rest 
Thx!

On Monday, August 11, 2014 12:40:48 PM UTC-5, Tyrel Souza wrote:
>
> .models is from PEP 328 http://legacy.python.org/dev/peps/pep-0328/
> It's checking for models.py in the current module and it's knowns as a 
> "relative import"
>
>
> On Monday, August 11, 2014 1:35:50 PM UTC-4, Malik Rumi wrote:
>>
>> UPDATE
>>
>> What is “.models”, why and when do we import from it, and how is it 
>> different from importing from “models”?
>>
>> I’ve never seen this .models before. I saw it the first time this morning 
>> in the documentation 
>> https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.register
>>  
>> when trying to solve this problem. But it just a casual mention, not an 
>> explanation. As I understood it, this was only for those choosing to use 
>> the new register decorator, so I didn’t worry about it. Now I’ve seen it 
>> again, in a video by a guy using 1.6 who, at least so far, has made no 
>> reference to a decorator of any kind. 
>>
>> Is this the source of my problems? Where is the documentation on 
>> “.models”? Yes, I have looked and found zip. 
>>
>> Thanks.
>>
>> On Monday, August 11, 2014 8:43:29 AM UTC-5, Malik Rumi wrote:
>>>
>>> #admin.py:
>>>
>>> from apps..models import Articles, Sections
>>>
>>> ImportError: No module named .models
>>>
>>>  
>>>
>>> I have seen this error before, and it went away when I changed INSTALLED 
>>> APPS from  to apps. because I have all my apps in a 
>>> folder called apps. Now I have changed even that to Config because 
>>> of the 1.7 change to how this works. Apps.py is two levels down from here, 
>>> so I don’t think there is a collision issue. 
>>>
>>> I tried changing the import statement to match the Config in 
>>> INSTALLED APPS, but that just gave me the same error with the *Config name 
>>> instead. 
>>>
>>> This is my model, it is clearly there, so I don’t know why or where this 
>>> error is coming from or where to look to fix it.  is all lower 
>>> case, both in the Django directory and in admin.py. Just for the hell of it 
>>> I capitalized  in admin.py, but I still get the same error. 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/506d841b-c4a5-4d85-acf1-007a42ea1b8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Sequence of code validation

2014-08-17 Thread Malik Rumi
When you run python mange.py *, Django runs through your code and stops to 
point out errors instead of giving you runserver or shell or whatever you 
were trying to do. What is that sequence? Is it the same every time? Where 
can I find out more about it? I looked in the docs, but I couldn't find it. 
I assume that's because I don't know the right keywords. Thx. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sequence of code validation

2014-08-17 Thread Malik Rumi
Thanks for both the reply and it's speed. Yes, this looks to be part of
what I am looking for. I say part because the link you gave does not
specifically reference checking views and urls.py, but whatever check is
being run for me is clearly looking there, too. I am using 1.7c1, and the
reason I asked specifically about the sequence of these checks is because I
am trying to track down a NameError that is showing up in urls.py even
though my import from views.py is *.


On Sun, Aug 17, 2014 at 8:15 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> HI Malik,
>
> It sounds like you might be referring to the validation/system check
> framework.
>
> In Django 1.6, this is implemented using a single huge method that looks
> for specific problems in your model definitions. This functionality isn't
> well documented, and isn't extensible as an end user. If you want to run
> the validation manually, you can invoke `python manage.py validate` - that
> will *just* run the validation. Commands like syncdb and runserver hook
> into the same functionality and force a validation check before they do
> what they're supposed to do.
>
> In Django 1.7 (soon to be released), the validation tools have been
> replaced but the system checks framework. This capability *is* documented,
> and *is* user extensible.
>
> https://docs.djangoproject.com/en/1.7/ref/checks/
>
> You invoke the system check framework by calling `python manage.py check`
> (calls to validate will redirect to check).
>
> I hope that helps.
>
> Yours,
> Russ Magee %-)
>
>
> On Sun, Aug 17, 2014 at 8:08 PM, Malik Rumi 
> wrote:
>
>> When you run python mange.py *, Django runs through your code and stops
>> to point out errors instead of giving you runserver or shell or whatever
>> you were trying to do. What is that sequence? Is it the same every time?
>> Where can I find out more about it? I looked in the docs, but I couldn't
>> find it. I assume that's because I don't know the right keywords. Thx.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/MpGtEwlt8rc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJxq84_sM6am%3DnU2WU6ShPY%2BwBi%2BkeLKrAHCuUCTJV%3DA5gsVMA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJxq84_sM6am%3DnU2WU6ShPY%2BwBi%2BkeLKrAHCuUCTJV%3DA5gsVMA%40mail.gmail.com?utm_medium=email&utm_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/CAKd6oBwnSn6vPC8UZCTBLtPwxBg5quFZACkoY6X0kbzZPZ4N-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sequence of code validation

2014-08-17 Thread Malik Rumi
Thanks. Your answer led me straight to
https://docs.python.org/2/tutorial/modules.html#packages and I am working
my way through that now, but it looks promising. If I have more issues,
I'll be back...


On Sun, Aug 17, 2014 at 8:44 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> Hi Malik,
>
> Ah - in that case, you're not looking at anything special that Django is
> doing; you're just seeing the result of importing Python code.
>
> Running something like ./manage.py runserver sets of a sequence of complex
> code internally - effectively, all the code in your project (or, at least,
> all your models.py, views.py and urls.py files) will be imported. If there
> are any problems in any of them, the first error encountered by the
> interpreter will be surfaced.
>
> The fact that you're seeing a NameError means that *something* in your
> code is generating it. Unfortunately, for a variety of reasons, the actual
> source of the error can be hard to track down from the stack trace Django
> provides. The best was I know of to debug the problem is to open up a shell
> and try importing modules until  you find the one that fails to import.
>
> Yours,
> Russ Magee %-)
>
> On Sun, Aug 17, 2014 at 9:28 PM, Malik Rumi 
> wrote:
>
>> Thanks for both the reply and it's speed. Yes, this looks to be part of
>> what I am looking for. I say part because the link you gave does not
>> specifically reference checking views and urls.py, but whatever check is
>> being run for me is clearly looking there, too. I am using 1.7c1, and the
>> reason I asked specifically about the sequence of these checks is because I
>> am trying to track down a NameError that is showing up in urls.py even
>> though my import from views.py is *.
>>
>>
>> On Sun, Aug 17, 2014 at 8:15 AM, Russell Keith-Magee <
>> russ...@keith-magee.com> wrote:
>>
>>> HI Malik,
>>>
>>> It sounds like you might be referring to the validation/system check
>>> framework.
>>>
>>> In Django 1.6, this is implemented using a single huge method that looks
>>> for specific problems in your model definitions. This functionality isn't
>>> well documented, and isn't extensible as an end user. If you want to run
>>> the validation manually, you can invoke `python manage.py validate` - that
>>> will *just* run the validation. Commands like syncdb and runserver hook
>>> into the same functionality and force a validation check before they do
>>> what they're supposed to do.
>>>
>>> In Django 1.7 (soon to be released), the validation tools have been
>>> replaced but the system checks framework. This capability *is* documented,
>>> and *is* user extensible.
>>>
>>> https://docs.djangoproject.com/en/1.7/ref/checks/
>>>
>>> You invoke the system check framework by calling `python manage.py
>>> check` (calls to validate will redirect to check).
>>>
>>> I hope that helps.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>>
>>> On Sun, Aug 17, 2014 at 8:08 PM, Malik Rumi 
>>> wrote:
>>>
>>>> When you run python mange.py *, Django runs through your code and stops
>>>> to point out errors instead of giving you runserver or shell or whatever
>>>> you were trying to do. What is that sequence? Is it the same every time?
>>>> Where can I find out more about it? I looked in the docs, but I couldn't
>>>> find it. I assume that's because I don't know the right keywords. Thx.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> 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/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to a topic in the
>>> Goo

Re: Does Django detect changes in models Meta ?

2014-09-07 Thread Malik Rumi
Django 1.7rc2 here. Same question, same hope for an answer. It may be that 
not all possible changes to a model are intended to be picked up. For 
example, I created all my models directly in 1.7rc2, and I have not changed 
any fields. What I have done is changed / added some meta and methods. 
Maybe these changes don't 'count'? 

Your models will be scanned and compared to the versions currently 
> contained in your migration files, and then a new set of migrations will be 
> written out. Make sure to read the output to see what makemigrations thinks 
> you have changed - it’s not perfect, and for complex changes it might not 
> be detecting what you expect.


and

Migrations are Django’s way of propagating changes you make to your models 
(*adding 
> a field, deleting a model,* etc.)


 So it might be that unless you change something that actually hits the 
database, there won't be anything to migrate, and that makes sense, but it 
would be nice if someone with expertise, experience, and inside knowledge 
could confirm and explain that. 

On Tuesday, September 2, 2014 3:16:45 PM UTC-5, David Los wrote:
>
> Very, very good question. I am experiencing the same issues with Django 
> 1.7rc2 and 1.7rc3.
>
> Syncdb and sql statements are intended for Django < 1.7.
>
> Would love to hear a solution!
>
> Op vrijdag 22 augustus 2014 09:32:43 UTC+2 schreef termopro:
>>
>> Hi there,
>>
>> I am using Django 1.7 RC2.
>> I have created models and have run all the migrations so Django created 
>> tables in database.
>> Now i decided to change database table names and have added Meta class to 
>> models containing table name:
>>
>> class SomeModel(models.Model):
>>...
>>class Meta:
>>   db_table = 'newname'
>>
>> Now when i run "makemigrations" Django doesn't detect any changes in 
>> models:
>> "No changes detected in app 'blabla'."
>> As far as i understand the logic, Django should change table names from 
>> 'appname_somemodel" to "newname".
>>
>> Is this an expected behavior or i am missing something?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/c618d499-a1a0-4cbc-953c-0e14bb8f9d59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does Django detect changes in models Meta ?

2014-09-08 Thread Malik Rumi
>>Maybe Migrations is just really buggy? I am using PostgreSQL as the
backend. I added a column with a default value and then did makemigrations
then migrate. It doesn't work. I get a very long error<<

h.. I hope not. I'm using Postgres too. Looks like I'll have to add
a new field to my models tonight when I get off work from the day job. I'll
let you know what happens.

On Mon, Sep 8, 2014 at 9:38 AM, Michael A. Martin 
wrote:

> Maybe Migrations is just really buggy? I am using PostgreSQL as the
> backend. I added a column with a default value and then did makemigrations
> then migrate. It doesn't work. I get a very long error.
>
> On Sep 7, 2014, at 8:54 AM, Malik Rumi  wrote:
>
> Django 1.7rc2 here. Same question, same hope for an answer. It may be that
> not all possible changes to a model are intended to be picked up. For
> example, I created all my models directly in 1.7rc2, and I have not changed
> any fields. What I have done is changed / added some meta and methods.
> Maybe these changes don't 'count'?
>
> Your models will be scanned and compared to the versions currently
>> contained in your migration files, and then a new set of migrations will be
>> written out. Make sure to read the output to see what makemigrations thinks
>> you have changed - it’s not perfect, and for complex changes it might not
>> be detecting what you expect.
>
>
> and
>
> Migrations are Django’s way of propagating changes you make to your models
>> (*adding a field, deleting a model,* etc.)
>
>
>  So it might be that unless you change something that actually hits the
> database, there won't be anything to migrate, and that makes sense, but it
> would be nice if someone with expertise, experience, and inside knowledge
> could confirm and explain that.
>
> On Tuesday, September 2, 2014 3:16:45 PM UTC-5, David Los wrote:
>>
>> Very, very good question. I am experiencing the same issues with Django
>> 1.7rc2 and 1.7rc3.
>>
>> Syncdb and sql statements are intended for Django < 1.7.
>>
>> Would love to hear a solution!
>>
>> Op vrijdag 22 augustus 2014 09:32:43 UTC+2 schreef termopro:
>>>
>>> Hi there,
>>>
>>> I am using Django 1.7 RC2.
>>> I have created models and have run all the migrations so Django created
>>> tables in database.
>>> Now i decided to change database table names and have added Meta class
>>> to models containing table name:
>>>
>>> class SomeModel(models.Model):
>>>...
>>>class Meta:
>>>   db_table = 'newname'
>>>
>>> Now when i run "makemigrations" Django doesn't detect any changes in
>>> models:
>>> "No changes detected in app 'blabla'."
>>> As far as i understand the logic, Django should change table names from
>>> 'appname_somemodel" to "newname".
>>>
>>> Is this an expected behavior or i am missing something?
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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/c618d499-a1a0-4cbc-953c-0e14bb8f9d59%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c618d499-a1a0-4cbc-953c-0e14bb8f9d59%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/Yj6Guv0ch5k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5D1B3515-04E8-46FD-823B-32B64E1B4124%40gmail.com
> <https://groups.google.com/d/msgid/django-users/5D1B3515-04E8-46FD-823B-32B64E1B4124%40gmail.com?utm_medium=email&utm_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/CAKd6oBz6K89a6_4_%3DkvUeMcaTqNNwetqEbKdroRz41pak8maKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


1 named url per page/screen?

2014-09-25 Thread Malik Rumi
1. I am trying to understand the documentation 
here: 
https://docs.djangoproject.com/en/1.7/topics/http/urls/#naming-url-patterns

Let us suppose I have a model and folder on mysite called Colors. Within 
Colors there are several individual documents: blue, green, yellow.

If blue, green, and yellow all use the same view and template, [and they're 
supposed to, aren't they?]  does this mean each url must be named 'blue' or 
'green' or 'yellow' in order for Django to tell them apart?

That's how I'm reading this, but that doesn't make sense to me, because it 
seems to be about the same as hardcoding the url, and if you have a lot of 
pages it would be murder to have to do this for every page, and seems 
contrary to the whole notion of a dynamic web site.  So what am I missing 
here?



2. I am struggling with this error: 
" Reverse for 'colors_articleView' with arguments '()' and keyword 
arguments '{u'pk': '', u'slug': ''}' not found. 1 pattern(s) tried: 
['colors/(?P\\d+)/(?P[\\w]+)'] "
I don't know what I'm missing here. I did a queryset for all the colors in 
a function based equivalent to list view and didn't see this error, but now 
that I want individual pages I can't resolve it. 



thx.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/c41e2fc7-fb04-4c1f-b269-f9849ded1139%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Failure to get data from database and onto template.

2014-10-01 Thread Malik Rumi


Executive Summary:

I need to know how to consistently write fbv’s that get the content I want 
out of my database and into my templates for display on my site in the way 
I want it displayed.

I confess, I don’t get it. Mark me down in points for asking a dumb 
question. I don’t care. I need help. 

 

Problem 1

I have successfully constructed my own function based view for listing all 
my articles with all their sections in a table of contents. At first they 
were not in order. I put an orderby on the models meta but that made no 
difference. Then I put an order_by ID in the view and that worked – except 
they were descending instead of ascending. Then I put reversed on the 
template and it worked.

 However, in the course of struggling with Problem 2, suddenly my table of 
contents is out of order again, and I* have not touched* those lines of 
code. I don’t understand how that could be. Daniel Roseman suggested I 
create a new field, number it, and order by that instead of relying on the 
ID as PK, and I will do that if I have to, but right after that is when I 
discovered reversed so I didn’t do it then. Now I’d like to know why the 
order changed when I haven’t touched the code that (supposedly) fixed it.

 Template for loop code:

{% for a in A %}

 

{% if a.sections_set.all %} 

{{ a.name }} {{ a.popular_name }} 

{% for section in a.sections_set.all reversed %}


 Model meta:

  class meta:

 

ordering = ['id']


 View:

def TOC(request):

 

A = Articles.objects.order_by('id') 

for a in A: 

a.sections_set.order_by('id') 

return render(request, 'statute.html', {'A': A,})


 

Problem 2 (the bigger one)

I cannot for the life of me get any articles or sections to come up on 
their own detail page. If I mouse over the links in my table of contents, 
the little preview url in the bottom right corner comes up correct for each 
one. I have bounced around from name error to type error to no match errors 
to does not exist errors and back again.

I have read the documentation. I have done the polls tutorial. I have read 
about context.  None of that matters. I have researched, tried this that 
and the other thing, and gotten nowhere. I have no doubt that it is 
something simple but simple or not I’m not getting it. If you can show me 
how to get it right, and keep getting it right consistently as I go 
forward, I would be very grateful.

Yes, I know there are class based views. I read that I can subclass them. 
But I fail to see the advantage of subclassing something I understand even 
less over learning to write what I want directly. I can’t learn without 
understanding, and to do that I need to get my hands dirty writing the 
code, not relying on someone else’s magic. I am not interested in a flame 
war as to whether or not CBV’s were a good idea, but I will point out that 
there is almost zero documentation or tutorials on how to write your own 
FBV’s, and certainly nothing on any complex FBV. I’ve been searching for 
over a week for it. 

The template I am calling does come up. It overwrites base in all the 
places I expect it to. But there is no content. Debug toolbar says it is 
the right view. The only sql queries are sessions and user. Shouldn’t there 
be at least one for the content? The context processors say my GET 
querydict is empty and my content is an empty string. The only fields I 
want to show on the detail pages are the name and the text. Here is the 
relevant portion of my template:
{% block content %}

 

 

{{ text }} 

 

{% endblock content %}


(I tried {{a.text}} earlier, that didn’t work either.)

Here is my urls.py
urlpatterns = patterns('',

 

url(r'^$', views.TOC, name='TOC'), 

url(r'^(?P\d+)\/(?P[-\w]+)', views.articleView, name='articleView'
), 

url(r'^(?P\d+)\/(?P[-\w]+)', views.sectionView, name='sectionView'
), 

)


 

Here is my *most recent* attempt at a view:
 def articleView(request, **kwargs):

 

a = Articles.objects.values('name', 'text') 

context = {'a' : a} 

return render(request, 'statute2.html', context)


Note that this is *exactly *the same format as laid out in Polls Tutorial 
3: https://docs.djangoproject.com/en/1.7/intro/tutorial03/#a-shortcut-render 

The only difference is the presence of **kwargs. I was getting all kinds of 
errors before I tried **kwargs, and I was getting all kinds of errors with 
GET before I tried values(). Now I just have a blank template, which I also 
had at various times before **kwargs and values().

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/12c0

Re: 1 named url per page/screen?

2014-10-01 Thread Malik Rumi


Ok, thank you Daniel. Your response is reasonable and makes sense, but that 
clarity is not on the docs page. But this leads me to a related follow up: 
The need for the parameter, be it 'green' as in my case or '1945' as in the 
docs, means that each template is going to be tied to a single web page. So 
instead of hardcoding the url, we are hardcoding the template, meaning it 
can't be re-used, even if the only difference between it and the copy is 
'yellow' instead of 'green'. 

In other words, two documents in the same namespace, with the same view and 
the same regex/url pattern, can't be reversed unless you include a 
distinguishing, unique parameter in the url tag. And this unique parameter 
has to be 'hardcoded', it can't be a variable. That doesn’t make sense to 
me either. In fact, once I fixed the part about empty strings being passed, 
and I figured out why I was getting no reverse match, Django was able to 
decipher the right parameter without me hardcoding it in the url tag, so I 
completely don’t understand what is going on there. If you’d care to 
enlighten me, please do. 

But I am not out of the woods yet. I posted a new request for help here: 
https://groups.google.com/forum/#!topic/django-users/fbiVWytyz5w 

. I invite you to share your wisdom.


On Thursday, September 25, 2014 4:43:43 PM UTC-5, Malik Rumi wrote:
>
> 1. I am trying to understand the documentation here: 
> https://docs.djangoproject.com/en/1.7/topics/http/urls/#naming-url-patterns
>
> Let us suppose I have a model and folder on mysite called Colors. Within 
> Colors there are several individual documents: blue, green, yellow.
>
> If blue, green, and yellow all use the same view and template, [and 
> they're supposed to, aren't they?]  does this mean each url must be named 
> 'blue' or 'green' or 'yellow' in order for Django to tell them apart?
>
> That's how I'm reading this, but that doesn't make sense to me, because it 
> seems to be about the same as hardcoding the url, and if you have a lot of 
> pages it would be murder to have to do this for every page, and seems 
> contrary to the whole notion of a dynamic web site.  So what am I missing 
> here?
>
>
>
> 2. I am struggling with this error: 
> " Reverse for 'colors_articleView' with arguments '()' and keyword 
> arguments '{u'pk': '', u'slug': ''}' not found. 1 pattern(s) tried: 
> ['colors/(?P\\d+)/(?P[\\w]+)'] "
> I don't know what I'm missing here. I did a queryset for all the colors in 
> a function based equivalent to list view and didn't see this error, but now 
> that I want individual pages I can't resolve it. 
>
>
>
> thx.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/0b0d6e7e-497b-47d3-bd25-38184f897871%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1 named url per page/screen?

2014-10-02 Thread Malik Rumi
Well, as I said, I completely don't understand what is going on here. By my 
understanding, which is obviously wrong, I should not have been able to 
resolve the problem as I did. But I really would like to understand, so 
thank you for helping. 

I think it is a matter of vocabulary, and understanding what is meant or 
implied by terms. Here's the text from the docs at issue:
***

With these names in place (full-archive and arch-summary), you can target 
each pattern individually by using its name:

{% url 'arch-summary' 1945 %}{% url 'full-archive' 2007 %}

***
'Name' in this example is either 'arch-summary' or 'full-archive'. This is 
referring to the view and the urlconf. The 1945 and 2007 refer to specific 
years of the archive that are being accessed. But the docs say NOTHING 
about these additional terms. They are literals, or at least they appear to 
me to be literals, not variables. That is why I say they are 'hardcoded', 
(and I concede that may not be the right term in this situation). 
 Presumably, from this example, there are archives for every year from 1945 
thru 2007. So it looks to me like they are saying the only way to get a 
year-specific page out of the archive is to add the name/unique keyword of 
that specific page or year. That is why I said what I said, and that is why 
I interpreted it the way I did. Now that may be wrong, and obviously is, 
but to my untrained and inexperienced eye, this is the plain meaning of the 
example. Do you see what I am saying? What would have let me understand it 
correctly the first time out? Rewriting the docs is one possibility, but 
maybe understanding some other aspect of Django or Python would have led me 
to the right conclusion without a rewrite. What would that be?


On Thursday, October 2, 2014 8:27:52 AM UTC-5, Daniel Roseman wrote:
>
> On Wednesday, 1 October 2014 21:35:30 UTC+1, Malik Rumi wrote:
>>
>> Ok, thank you Daniel. Your response is reasonable and makes sense, but 
>> that clarity is not on the docs page. But this leads me to a related follow 
>> up: The need for the parameter, be it 'green' as in my case or '1945' as in 
>> the docs, means that each template is going to be tied to a single web 
>> page. So instead of hardcoding the url, we are hardcoding the template, 
>> meaning it can't be re-used, even if the only difference between it and the 
>> copy is 'yellow' instead of 'green'. 
>>
>> In other words, two documents in the same namespace, with the same view 
>> and the same regex/url pattern, can't be reversed unless you include a 
>> distinguishing, unique parameter in the url tag. And this unique parameter 
>> has to be 'hardcoded', it can't be a variable. That doesn’t make sense to 
>> me either. In fact, once I fixed the part about empty strings being passed, 
>> and I figured out why I was getting no reverse match, Django was able to 
>> decipher the right parameter without me hardcoding it in the url tag, so I 
>> completely don’t understand what is going on there. If you’d care to 
>> enlighten me, please do. 
>>
>> But I am not out of the woods yet. I posted a new request for help here: 
>> https://groups.google.com/forum/#!topic/django-users/fbiVWytyz5w 
>>
>> . I invite you to share your wisdom.
>>
>
> Well, I must confess to being completely puzzled by what you're saying 
> here. Why would you need to hardcode the parameter? Why do you say it can't 
> be a variable? It can, of course: if you had a URL defined as 
> `(r'^color/(?P\w+)/$, color_detail, name='color-detail')`, and 
> in your template context a list of strings ['red', 'blue', 'green'], then 
> you could produce a list of links via the URL tag by iterating:
>
> {% for item in colors %} 
> {% url "color_detail" color_name=item %}
> {% endfor %}
>
> which will produce links pointing to /color/red/, /color/blue/, etc.
> --
> Daniel.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/d9557444-ed8b-48d4-8fce-8ec8778b8d59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Failure to get data from database and onto template.

2014-10-02 Thread Malik Rumi
Daniel,
Thank you. Yes, your code works. If I had posted a week ago, I would not 
have lost a week on my life expectancy. Obviously, I'm just not 'getting 
it'. If you have any suggestions, or resources, to help me understand 
better going forward, I'd be grateful, but you've done plenty already. Thx.

On Thursday, October 2, 2014 8:36:59 AM UTC-5, Daniel Roseman wrote:
>
> On Wednesday, 1 October 2014 21:32:14 UTC+1, Malik Rumi wrote:
>>
>> Executive Summary:
>>
>> I need to know how to consistently write fbv’s that get the content I 
>> want out of my database and into my templates for display on my site in the 
>> way I want it displayed.
>>
>> I confess, I don’t get it. Mark me down in points for asking a dumb 
>> question. I don’t care. I need help. 
>>
>>  
>>
>> Problem 1
>>
>> I have successfully constructed my own function based view for listing 
>> all my articles with all their sections in a table of contents. At first 
>> they were not in order. I put an orderby on the models meta but that made 
>> no difference. Then I put an order_by ID in the view and that worked – 
>> except they were descending instead of ascending. Then I put reversed on 
>> the template and it worked.
>>
>>  However, in the course of struggling with Problem 2, suddenly my table 
>> of contents is out of order again, and I* have not touched* those lines 
>> of code. I don’t understand how that could be. Daniel Roseman suggested I 
>> create a new field, number it, and order by that instead of relying on the 
>> ID as PK, and I will do that if I have to, but right after that is when I 
>> discovered reversed so I didn’t do it then. Now I’d like to know why the 
>> order changed when I haven’t touched the code that (supposedly) fixed it.
>>
>>  Template for loop code:
>>
>> {% for a in A %}
>>
>>  
>>
>> {% if a.sections_set.all %} 
>>
>> {{ a.name }} {{ a.popular_name }} 
>>
>> {% for section in a.sections_set.all reversed %}
>>
>>
>>  Model meta:
>>
>>   class meta:
>>
>>  
>>
>> ordering = ['id']
>>
>>
>>  View:
>>
>> def TOC(request):
>>
>>  
>>
>> A = Articles.objects.order_by('id') 
>>
>> for a in A: 
>>
>> a.sections_set.order_by('id') 
>>
>> return render(request, 'statute.html', {'A': A,})
>>
>>
>>  
>>
>> Problem 2 (the bigger one)
>>
>> I cannot for the life of me get any articles or sections to come up on 
>> their own detail page. If I mouse over the links in my table of contents, 
>> the little preview url in the bottom right corner comes up correct for each 
>> one. I have bounced around from name error to type error to no match errors 
>> to does not exist errors and back again.
>>
>> I have read the documentation. I have done the polls tutorial. I have 
>> read about context.  None of that matters. I have researched, tried this 
>> that and the other thing, and gotten nowhere. I have no doubt that it is 
>> something simple but simple or not I’m not getting it. If you can show me 
>> how to get it right, and keep getting it right consistently as I go 
>> forward, I would be very grateful.
>>
>> Yes, I know there are class based views. I read that I can subclass them. 
>> But I fail to see the advantage of subclassing something I understand even 
>> less over learning to write what I want directly. I can’t learn without 
>> understanding, and to do that I need to get my hands dirty writing the 
>> code, not relying on someone else’s magic. I am not interested in a flame 
>> war as to whether or not CBV’s were a good idea, but I will point out that 
>> there is almost zero documentation or tutorials on how to write your own 
>> FBV’s, and certainly nothing on any complex FBV. I’ve been searching for 
>> over a week for it. 
>>
>> The template I am calling does come up. It overwrites base in all the 
>> places I expect it to. But there is no content. Debug toolbar says it is 
>> the right view. The only sql queries are sessions and user. Shouldn’t there 
>> be at least one for the content? The context processors say my GET 
>> querydict is empty and my content is an empty string. The only fields I 
>> want to show on the detail pages are the name and the text. Here is the 
>> relevant portion of my template:
>> {% block content %}
>>
>>  
>>
>>  
>>

Re: Failure to get data from database and onto template.

2014-10-02 Thread Malik Rumi
Collin, 
Thank you for the suggestion. I will try it tonight after I get off work 
and can finish cleaning up the code following Daniel's answer. sectionView 
is supposed to be id/slug, but I included the Article name in the Section 
names, because I can't put a fk in the slug. So maybe that was also a newby 
mistake. This must be why Django is sending Article 1 and Article 2 Section 
1 to the same view, it sees the match for 'Article' and stops there. So 
I'll probably end up renaming them, so as you can see, I have (made for 
myself) a lot of (re)work to do. But I am learning! 

On Thursday, October 2, 2014 12:49:47 PM UTC-5, Collin Anderson wrote:
>
> For the ordering issue, I'd recommend setting ordering = ['pk'] in the 
> Model class Meta, then you don't need to try to handle it in your view.
>
> What does your sectionView look like? Does /{{ id }}/{{ slug }}/ uniquely 
> identify both an article and a section, or should it be /{{ article_id 
> }}/{{ article_slug }}/{{ section_id }}/ ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/bc2e3171-e55b-4e64-bd6d-bbc36e7118d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Failure to get data from database and onto template.

2014-10-03 Thread Malik Rumi
I just wanted to report back and see if you had any additional ideas to 
offer. I did change the meta from id to pk, but there was no change. Then I 
took reverse off the template for loop and (almost) everything was the way 
I wanted it. For some reason, Article 4 came out Sections 3,4,1,2, in that 
order. Their ids, in that same order, are 16, 15, 13, 14. In other words, 
if they were ordered by pk like the rest, they would be in proper order, 
but they are not. Since it is only this one group, I don't want to mess 
with the whole thing anymore, but I don't know what to do about these. The 
only thing I can think of is to delete 3 and 4 and then re-create them and 
hope that puts them in the right order. Any other ideas?

I was wrong about the Articles and Sections on the same view. Turns out it 
was the ID that was controlling everything, Django wasn't even looking at 
the slug, even when I put unique_together on the meta. Changing the names 
of the Sections didn't even work. Neither did putting article_id in the 
Sections regex. If I put sectionView first in the urlconf, all the sections 
would come up fine but none of the articles. If I put articleView first in 
the urlconf, the articles all came up and the sections got doesnotexist. 
The only thing that worked (and I tried A LOT of variations) was to put the 
Sections on (?P) only, no id, no digits.

So even though that problem is technically solved, if you have some best 
practices to share with me so I can get this done better next time, I am 
all ears. 

Thanks again for all the help.

On Thursday, October 2, 2014 4:08:24 PM UTC-5, Malik Rumi wrote:
>
> Collin, 
> Thank you for the suggestion. I will try it tonight after I get off work 
> and can finish cleaning up the code following Daniel's answer. sectionView 
> is supposed to be id/slug, but I included the Article name in the Section 
> names, because I can't put a fk in the slug. So maybe that was also a newby 
> mistake. This must be why Django is sending Article 1 and Article 2 Section 
> 1 to the same view, it sees the match for 'Article' and stops there. So 
> I'll probably end up renaming them, so as you can see, I have (made for 
> myself) a lot of (re)work to do. But I am learning! 
>
> On Thursday, October 2, 2014 12:49:47 PM UTC-5, Collin Anderson wrote:
>>
>> For the ordering issue, I'd recommend setting ordering = ['pk'] in the 
>> Model class Meta, then you don't need to try to handle it in your view.
>>
>> What does your sectionView look like? Does /{{ id }}/{{ slug }}/ uniquely 
>> identify both an article and a section, or should it be /{{ article_id 
>> }}/{{ article_slug }}/{{ section_id }}/ ?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/75b7a838-6433-4cc8-a499-577b37245132%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


moving existing django projects

2014-11-12 Thread Malik Rumi


Q: This is a ‘help me understand how this works / what it does’ question 
rather than a ‘help me I’m stuck’ question. I have an existing Django 
project I wanted to get on Heroku. I created a new site on Heroku, uploaded 
my project, and ran migrations. But all I have is a generic new, empty 
Django site. The Django admin knows nothing about my models. Now, granted, 
I have not yet put up my existing database but I expected it to at least 
create the tables for my models, which it did not. Of course they are in 
installed apps, but I did not run ‘startapp’ since the app already exists. 
So why didn’t this work? 

Or, should the question be: 'in the case of moving a pre-existing project, 
what do you do *instead *of 'startapp''?

Or maybe I have to run startapp anyway? Why?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/5a5b7987-8c92-4522-861f-5c9d0871e8ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: moving existing django projects

2014-11-15 Thread Malik Rumi
<< What WSGI server are you using in the
Heroku deployment? Can you point to the instructions you followed to
deploy your project on Heroku?>>

Simple questions with not so simple answers. I started with a Django
getting started tutorial on Heroku. It had a different look and feel than
the rest of Heroku, and it included a sample application called 'getting
started'. However, that page has now been completely rewritten to look like
all the other Heroku pages, and it no longer includes the tutorial or the
getting started project:
https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
.

This project used get_wsgi_application from django.core and Cling.

I suspect the reason it's gone now is that there is now an 'official'
Django template for getting started on Heroku. It uses whitenoise instead
of dj-static and Cling but still has django.core.

Anyway, I adjusted my project to suit these new requirements, then tried
adding my pre-existing project which works just fine on my home machine
(Windows 8.1), and when that didn't behave as expected is when I came here
to post. Since then I have gone ahead and imported my database with
pgbackup. Now I understood that this would be 'destructive', but I assumed
that meant it would destroy my database, not wipe my models.py too - but
that's what it did. Now what I don't get is, if it was so destructive, why
is the 'getting started' project now BACK in my Heroku site, (I had deleted
it in the first place, and why wasn't it wiped out too in the second
place?) and when I run git status or migrate, they both say there are no
changes to update, even though my pre-existing models.py is still sitting
there on my local dev. I don't get that at all.

Your wisdom and insights will be greatly appreciated.

On Wed, Nov 12, 2014 at 5:05 PM, Carl Meyer  wrote:

> Hi Malik,
>
> On 11/12/2014 08:27 PM, Malik Rumi wrote:
> > Q: This is a ‘help me understand how this works / what it does’ question
> > rather than a ‘help me I’m stuck’ question. I have an existing Django
> > project I wanted to get on Heroku. I created a new site on Heroku,
> > uploaded my project, and ran migrations. But all I have is a generic
> > new, empty Django site. The Django admin knows nothing about my models.
> > Now, granted, I have not yet put up my existing database but I expected
> > it to at least create the tables for my models, which it did not. Of
> > course they are in installed apps, but I did not run ‘startapp’ since
> > the app already exists. So why didn’t this work?
>
> I don't know why it isn't working. What WSGI server are you using in the
> Heroku deployment? Can you point to the instructions you followed to
> deploy your project on Heroku?
>
> > Or, should the question be: 'in the case of moving a pre-existing
> > project, what do you do /instead /of 'startapp''?
>
> Nothing. Just migrate.
>
> > Or maybe I have to run startapp anyway? Why?
>
> Startapp is nothing but a convenience to pre-generate a skeleton of some
> files; it is precisely and entirely equivalent to creating those same
> files yourself in your codebase.
>
> Personally, I never use "startapp" at all, even to create an app in the
> first place.
>
> It is certainly not necessary to run it for existing apps on new
> deployments.
>
> Carl
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/CAKd6oBwbQN%2B%2B_ahd-yZTUTfkqNv6Nm85wPpcN7c_GuWYkg6snw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: moving existing django projects

2014-11-18 Thread Malik Rumi
Well, yes, Carl, I am a self taught newby learning all the assumptions,
blind spots, and gotchas as I go stumbling through my learning curve. So
thank you for your input.
Yes, this is gunicorn.


Entirely possible. I have another thread going where I learned that Heroku
ascribes to 12 Factor, not the One True Way, That is also almost certainly
why I keep getting debug toolbar errors on my Heroku installs even though
debug is not in my prod settings. that's the subject of yet a 3rd thread.


I didn't think I was confused about that, but when I ran into this problem
I didn't know what other explanation there could be.

Here are my console logs:

*Wed Nov 12 *


$ git status

On branch master

Changes not staged for commit:

  (use "git add/rm ..." to update what will be committed)

  (use "git checkout -- ..." to discard changes in working directory)

modified:   .gitignore

deleted:Cannon/__init__.py

deleted:Cannon/gettingstarted/__init__.py

deleted:Cannon/gettingstarted/settings.py

deleted:Cannon/gettingstarted/static/humans.txt

deleted:Cannon/gettingstarted/urls.py

deleted:Cannon/gettingstarted/wsgi.py

deleted:Cannon/settings.py

deleted:Cannon/static/humans.txt

deleted:Cannon/urls.py

deleted:Cannon/wsgi.py

modified:   Procfile

Untracked files:

  (use "git add ..." to include in what will be committed)

Baillee/

static/

templates/

no changes added to commit (use "git add" and/or "git commit -a")

(Dayton)

<>

after running git commit and git add:

$ git status

On branch master

nothing to commit, working directory clean

(Dayton)

*Sat Nov 15 after running pgbackup:*


ls

Cannon Procfile   reitz template.txt  runtime.txt

manage.py  README.md  requirements.txtstaticfiles

~ $ cd Cannon

cd Cannon

~/Cannon $ ls

ls

gettingstarted  __init__.pyc  settings.pyc  urls.py

__init__.py settings.py   staticwsgi.py


Note Baillee is gone but 'getting started' is back. Now maybe I screwed
this up too, and don't know how to make git work, but I did go to the docs
before running this.



Yes, I will, but I'd still like to understand what happened here so I can
diagnose and understand how all these things work better than I do now.

On Mon, Nov 17, 2014 at 12:47 PM, Carl Meyer  wrote:

> Hi Malik,
>
> On 11/15/2014 08:52 PM, Malik Rumi wrote:
> > << What WSGI server are you using in the
> > Heroku deployment? Can you point to the instructions you followed to
> > deploy your project on Heroku?>>
> >
> > Simple questions with not so simple answers. I started with a Django
> > getting started tutorial on Heroku. It had a different look and feel
> > than the rest of Heroku, and it included a sample application called
> > 'getting started'. However, that page has now been completely rewritten
> > to look like all the other Heroku pages, and it no longer includes the
> > tutorial or the getting started project:
> >
> https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
> .
> >
> > This project used get_wsgi_application from django.core and Cling.
> >
> > I suspect the reason it's gone now is that there is now an 'official'
> > Django template for getting started on Heroku. It uses whitenoise
> > instead of dj-static and Cling but still has django.core.
>
> django.core.wsgi.get_wsgi_application() gets a WSGI application object,
> but you still need a WSGI server to run it. That'll be whatever your
> Procfile contains in the "web: " line. Gunicorn is the one shown in
> Heroku's docs; is that what you're using?
>
> > Anyway, I adjusted my project to suit these new requirements, then tried
> > adding my pre-existing project which works just fine on my home machine
> > (Windows 8.1), and when that didn't behave as expected is when I came
> > here to post. Since then I have gone ahead and imported my database with
> > pgbackup. Now I understood that this would be 'destructive', but I
> > assumed that meant it would destroy my database, not wipe my models.py
> > too - but that's what it did.
>
> I am quite sure that importing a database using pgbackup did not
> actually wipe your models.py file. (It can't; once you've deployed a
> version of an app to Heroku all your code is read-only). If you're not
> seeing your models in the admin, that's a symptom of a different
> problem. Perhaps the wrong settings are being used?
>
> A good place to start would be your Procfile, and the value of
> DJANGO_SETTINGS_MODULE you s

wsgi errors lead to 500 launching django on heroku

2015-01-01 Thread Malik Rumi


I have a wsgi problem I am hoping you can help me with. I am running 
Django1.7 with gunicorn 19.1.1 and wsgiref 0.1.2. I am trying to get this 
to run on Heroku. The last error was that it could not find the template 
home.html and that there was a wsgi error. I added TEMPLATE_DIR to my 
settings and found an article on Google Groups about mod_wsgi. I am not 
running mod_wsgi but it said there that many of the same solutions would 
apply so I decided to try it.

 

However, when I ran the test, much to my surprise, I saw Hello World. I 
checked the logs, and saw 200 OK. I thought maybe somehow the template 
issue had also been a wsgi issue, or perhaps the addition of the wsgi test 
code had somehow fixed a syntax error in my wsgi.py by closing a tag or 
something. Those were my best wild guesses, anyway.

 

So I removed the test code, ran mine again, and sure enough, I was right 
back to the uninformative wsgi errors that led me to seek help in the first 
place. But at least there was no template error this time.

I do not understand how the presence of wsgi debug code could give me 200 
ok and then when I take it out I get 500.

 

I ran it again with the code and debug set to true. I got the same Hello 
World and a 200 ok in the logs. I thought perhaps the code was catching the 
start of the web process but missing the end when it crashed, but no, my 
Heroku dashboard reports the web dyno is up and running fine.

 

I am at a loss as to what to do next here. If you would be so kind as to 
share some insights, I would be most appreciative.  

ps: This is also in the logs but I have been unable to find any useful 
information on it:

gunicorn.http.wsgi.WSGIErrorsWraper object at 0x7f391e254650

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/dab4f3de-bdf8-49bd-9407-53e6abd8e913%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: wsgi errors lead to 500 launching django on heroku

2015-01-03 Thread Malik Rumi
SOLVED.

On Thursday, January 1, 2015 9:17:57 PM UTC-6, Malik Rumi wrote:
>
> I have a wsgi problem I am hoping you can help me with. I am running 
> Django1.7 with gunicorn 19.1.1 and wsgiref 0.1.2. I am trying to get this 
> to run on Heroku. The last error was that it could not find the template 
> home.html and that there was a wsgi error. I added TEMPLATE_DIR to my 
> settings and found an article on Google Groups about mod_wsgi. I am not 
> running mod_wsgi but it said there that many of the same solutions would 
> apply so I decided to try it.
>
>  
>
> However, when I ran the test, much to my surprise, I saw Hello World. I 
> checked the logs, and saw 200 OK. I thought maybe somehow the template 
> issue had also been a wsgi issue, or perhaps the addition of the wsgi test 
> code had somehow fixed a syntax error in my wsgi.py by closing a tag or 
> something. Those were my best wild guesses, anyway.
>
>  
>
> So I removed the test code, ran mine again, and sure enough, I was right 
> back to the uninformative wsgi errors that led me to seek help in the first 
> place. But at least there was no template error this time.
>
> I do not understand how the presence of wsgi debug code could give me 200 
> ok and then when I take it out I get 500.
>
>  
>
> I ran it again with the code and debug set to true. I got the same Hello 
> World and a 200 ok in the logs. I thought perhaps the code was catching the 
> start of the web process but missing the end when it crashed, but no, my 
> Heroku dashboard reports the web dyno is up and running fine.
>
>  
>
> I am at a loss as to what to do next here. If you would be so kind as to 
> share some insights, I would be most appreciative.  
>
> ps: This is also in the logs but I have been unable to find any useful 
> information on it:
>
> gunicorn.http.wsgi.WSGIErrorsWraper object at 0x7f391e254650
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/0edbfd4f-d1de-436f-ba89-85b0cc99f487%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't Install on Windows 8.1

2013-12-24 Thread Malik Rumi
Thank you. One more question before I dive in: I already have python 
installed. Are you suggesting I remove it and start over?

On Tuesday, December 24, 2013 8:04:08 AM UTC-6, Timothy W. Cook wrote:
>
> Since it appears that you are not too familiar with Python, this may help:
> http://www.youtube.com/watch?v=d_W02OwHa38
>
> Using a virtual environment and pip will a long way to solving many of 
> your issues.   It is considered best practice 'for a reason'. 
>
> https://zignar.net/2012/06/17/install-python-on-windows/
>
> Then, install django and other requirements inside your virtualenv.
>
>
>
> HTH,
> Tim
>
>
>
>
> On Tue, Dec 24, 2013 at 11:35 AM, Malik Rumi 
> > wrote:
>
>> Hello. This is my first post. The attached Word document tracks 
>> everything I have done this morning to get this to work. 
>>
>> Your insights, guidance, and assistance is 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...@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/dec70718-1de8-403d-9321-fbbfd760e88d%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/952e8e35-bb11-4c66-aca8-d25585606d76%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Can't Install on Windows 8.1

2013-12-25 Thread Malik Rumi
Ok, everything went smoothly and beautifully as promised. I got successful 
install messages for pip, distribute, virtualenv and django. So first, 
thank you both very much. 

However, I seem to be stuck again. I am not sure how to get from my new 
virtualenv to django, and windows seems just as confused. When I tried 
startproject, windows suddenly wanted to know if I wanted to keep using 
python to open .py files, or use notepad or some other program? I said 
python, and then it hiccuped, like it was restarting Explorer, and the 
command line went back to the prompt with no evidence it executed the 
startproject command. I looked in the directory, but saw nothing to 
indicate there was a project started. Of course, never having worked with 
either django or virtualenv before, I could have missed it. So I tried 
again.

As before, a dialog window opened asking me what program I wanted to use. 
While I was taking a screenshot to save for these notes, the dialog went 
away and the cmd line reported back that access was denied. 

Then I tried get_version and was told there was no module named django, 
even though just a few lines earlier I was told django was successfully 
installed.

Here is that last portion from my command line window:

*C:\Program Files\Ampps\python\Scripts>project_sl1\Scripts\activate*

*(project_sl1) C:\Program Files\Ampps\python\Scripts>pip install django*

*Downloading/unpacking django*

*  Downloading Django-1.6.1.tar.gz (6.6MB): 6.6MB downloaded*

*  Running setup.py egg_info for package django*

*warning: no previously-included files matching '__pycache__' found *

*under dir*

*ectory '*'*

*warning: no previously-included files matching '*.py[co]' found *

*under direct*

*ory '*'*

*Installing collected packages: django*

*  Running setup.py install for django*

*warning: no previously-included files matching '__pycache__' found *

*under dir*

*ectory '*'*

*warning: no previously-included files matching '*.py[co]' found *

*under direct*

*ory '*'*

*Successfully installed django*

*Cleaning up...*


*(project_sl1) C:\Program Files\Ampps\python\Scripts>django-admin.py *


*startproject*

* project_sl1*


*(project_sl1) C:\Program Files\Ampps\python\Scripts>django-admin.py *


*startproject*

* project_sl1*

*Access is denied.*


*(project_sl1) C:\Program Files\Ampps\python\Scripts>*

Just to be clear, I do want to get past this but I also want to understand 
what is going on, so if you can do both, that would be great. Do I need to 
change directories? Try opening a django project thrui the django gui? 
Where / how would I do that? Everything I have done so far has been thru 
the windows command line. 
Thanx.
- -

On Tuesday, December 24, 2013 11:48:22 AM UTC-6, Malik Rumi wrote:
>
>  Boy, the speedy responses on this thread are great! I can't wait to get 
> home from work so I can put this advice into practice. And now you know 
> what I want for Christmas 😄 - a working installation of django and python 
> to play with. 
>  --
> From: Tom Lockhart 
> Sent: ‎12/‎24/‎2013 9:15 AM
> To: django-users@googlegroups.com
> Subject: Re: Can't Install on Windows 8.1
>
>
>  On 2013-12-24, at 6:56 AM, Malik Rumi  wrote:
>
>  Thank you. One more question before I dive in: I already have python 
> installed. Are you suggesting I remove it and start over?
>
>
> No. What you will find is that virtualenv will pick up whatever python it 
> finds and package it in a new self-contained area. At that point you will 
> have full control over what additional things get installed. But it needs a 
> python installation somewhere else to get started.
>
> If you have put a bunch of packages into your native python installation 
> and are not sure what you have, you may want to re-install just to get a 
> clean basic installation. But I haven't had to do that and would not bother 
> unless you see other issues.
>
> hth
>
> - Tom
>
>  
> On Tuesday, December 24, 2013 8:04:08 AM UTC-6, Timothy W. Cook wrote: 
>>
>>   Since it appears that you are not too familiar with Python, this may 
>> help:
>> http://www.youtube.com/watch?v=d_W02OwHa38
>>
>> Using a virtual environment and pip will a long way to solving many of 
>> your issues.   It is considered best practice 'for a reason'. 
>>
>> https://zignar.net/2012/06/17/install-python-on-windows/
>>
>> Then, install django and other requirements inside your virtualenv.
>>
>>
>>
>> HTH,
>> Tim
>>
>>
>>
>>
>> On Tue, Dec 24, 2013 at 11:35 AM, Malik Rumi  wrote:
>>
>>> Hello. This is my first post. The attached Word document tr

Re: Can't Install on Windows 8.1

2014-01-05 Thread Malik Rumi
This is just an update to all of you, and to anyone coming after me with 
similar problems. No, I did not get what I wanted for Christmas. It turns 
out distribute has been deprecated, and I should have gotten the "new" 
setuptools instead. It seems the brilliant minds behind distribute set up a 
'fake' setuptools and deleted pkg_resources. I can't begin to understand 
all that. But my upgrade, like so many other things in this project, has 
failed. I posted to their mailing list so we'll see what happens there. I 
do not have Django or any other accessory up and running.

I did move my install to c:\Python27, and that allowed me to get PIL, which 
had failed before, but then GAE decided to insist I use a python25.dll, 
which of course caused errors. It seems this is triggered if the python 
install is in the default place. How stupid is that? anyway, I got a patch 
(not from Google) and my GAE is fine again. Nevertheless, all this has 
eaten up a lot of time. 

When and if I ever get Django running I'll be back, but I don't expect to 
have any Windows problems anymore. Thanks. 

On Wednesday, December 25, 2013 4:02:52 PM UTC-6, Felipe Coelho wrote:
>
> 2013/12/25 Malik Rumi >
>
>> Ok, everything went smoothly and beautifully as promised. I got 
>> successful install messages for pip, distribute, virtualenv and django. So 
>> first, thank you both very much. 
>>
>> However, I seem to be stuck again. I am not sure how to get from my new 
>> virtualenv to django, and windows seems just as confused. When I tried 
>> startproject, windows suddenly wanted to know if I wanted to keep using 
>> python to open .py files, or use notepad or some other program? I said 
>> python, and then it hiccuped, like it was restarting Explorer, and the 
>> command line went back to the prompt with no evidence it executed the 
>> startproject command. I looked in the directory, but saw nothing to 
>> indicate there was a project started. Of course, never having worked with 
>> either django or virtualenv before, I could have missed it. So I tried 
>> again.
>>
>>  As before, a dialog window opened asking me what program I wanted to 
>> use. While I was taking a screenshot to save for these notes, the dialog 
>> went away and the cmd line reported back that access was denied. 
>>
>> Then I tried get_version and was told there was no module named django, 
>> even though just a few lines earlier I was told django was successfully 
>> installed.
>>
>> Here is that last portion from my command line window:
>>
>> *C:\Program Files\Ampps\python\Scripts>project_sl1\Scripts\activate*
>>
>> *(project_sl1) C:\Program Files\Ampps\python\Scripts>pip install django*
>>
>> *Downloading/unpacking django*
>>
>> *  Downloading Django-1.6.1.tar.gz (6.6MB): 6.6MB downloaded*
>>
>> *  Running setup.py egg_info for package django*
>>
>> *warning: no previously-included files matching '__pycache__' found *
>>
>> *under dir*
>>
>> *ectory '*'*
>>
>> *warning: no previously-included files matching '*.py[co]' found *
>>
>> *under direct*
>>
>> *ory '*'*
>>
>> *Installing collected packages: django*
>>
>> *  Running setup.py install for django*
>>
>> *warning: no previously-included files matching '__pycache__' found *
>>
>> *under dir*
>>
>> *ectory '*'*
>>
>> *warning: no previously-included files matching '*.py[co]' found *
>>
>> *under direct*
>>
>> *ory '*'*
>>
>> *Successfully installed django*
>>
>> *Cleaning up...*
>>
>>
>> *(project_sl1) C:\Program Files\Ampps\python\Scripts>django-admin.py *
>>
>>
>> *startproject*
>>
>> * project_sl1*
>>
>>
>> *(project_sl1) C:\Program Files\Ampps\python\Scripts>django-admin.py *
>>
>>
>> *startproject*
>>
>> * project_sl1*
>>
>> *Access is denied.*
>>
>>
>> *(project_sl1) C:\Program Files\Ampps\python\Scripts>*
>>
>> Just to be clear, I do want to get past this but I also want to 
>> understand what is going on, so if you can do both, that would be great. Do 
>> I need to change directories? Try opening a django project thrui the django 
>> gui? Where / how would I do that? Everything I have done so far has been 
>> thru the windows command line. 
>> Thanx.
>> - -
>>
>
>  
> Instead of trying to  execute django-admin.py directly, explicitly tell 
> the prompt that you wa

Re: Can't Install on Windows 8.1

2014-01-15 Thread Malik Rumi
I got it done. Finally. Thanks to all.


On Mon, Jan 6, 2014 at 2:41 AM, Mike Dewhirst  wrote:

> Malik
>
> I'm confused. What are you doing with GAE and Windows 8.1? Have you given
> up Windows?
>
> Also, I think you will fare better with Pillow rather than PIL. It seems
> PIL is no longer being supported and Pillow has taken over.
>
> Mike
>
>
> On 5/01/2014 11:57pm, Malik Rumi wrote:
>
>> This is just an update to all of you, and to anyone coming after me with
>> similar problems. No, I did not get what I wanted for Christmas. It
>> turns out distribute has been deprecated, and I should have gotten the
>> "new" setuptools instead. It seems the brilliant minds behind distribute
>> set up a 'fake' setuptools and deleted pkg_resources. I can't begin to
>> understand all that. But my upgrade, like so many other things in this
>> project, has failed. I posted to their mailing list so we'll see what
>> happens there. I do not have Django or any other accessory up and running.
>>
>> I did move my install to c:\Python27, and that allowed me to get PIL,
>> which had failed before, but then GAE decided to insist I use a
>> python25.dll, which of course caused errors. It seems this is triggered
>> if the python install is in the default place. How stupid is that?
>> anyway, I got a patch (not from Google) and my GAE is fine again.
>> Nevertheless, all this has eaten up a lot of time.
>>
>> When and if I ever get Django running I'll be back, but I don't expect
>> to have any Windows problems anymore. Thanks.
>>
>> On Wednesday, December 25, 2013 4:02:52 PM UTC-6, Felipe Coelho wrote:
>>
>> 2013/12/25 Malik Rumi >
>>
>>
>> Ok, everything went smoothly and beautifully as promised. I got
>> successful install messages for pip, distribute, virtualenv and
>> django. So first, thank you both very much.
>>
>> However, I seem to be stuck again. I am not sure how to get from
>> my new virtualenv to django, and windows seems just as confused.
>> When I tried startproject, windows suddenly wanted to know if I
>> wanted to keep using python to open .py files, or use notepad or
>> some other program? I said python, and then it hiccuped, like it
>> was restarting Explorer, and the command line went back to the
>> prompt with no evidence it executed the startproject command. I
>> looked in the directory, but saw nothing to indicate there was a
>> project started. Of course, never having worked with either
>> django or virtualenv before, I could have missed it. So I tried
>> again.
>>
>> 
>>
>>
>> As before, a dialog window opened asking me what program I
>> wanted to use. While I was taking a screenshot to save for these
>> notes, the dialog went away and the cmd line reported back that
>> access was denied. 
>>
>>
>> Then I tried get_version and was told there was no module named
>> django, even though just a few lines earlier I was told django
>> was successfully installed.
>>
>> Here is that last portion from my command line window:
>>
>> /C:\Program
>> Files\Ampps\python\Scripts>project_sl1\Scripts\activate/
>>
>> /(project_sl1) C:\Program Files\Ampps\python\Scripts>pip
>>
>> install django/
>>
>> /Downloading/unpacking django/
>>
>> /  Downloading Django-1.6.1.tar.gz (6.6MB): 6.6MB downloaded/
>>
>> /  Running setup.py egg_info for package django/
>>
>> /warning: no previously-included files matching
>> '__pycache__' found /
>>
>>
>> /under dir/
>>
>> /ectory '*'/
>>
>> /warning: no previously-included files matching
>>
>> '*.py[co]' found /
>>
>> /under direct/
>>
>> /ory '*'/
>>
>> /Installing collected packages: django/
>>
>> /  Running setup.py install for django/
>>
>> /warning: no previously-included files matching
>> '__pycache__' found /
>>
>>
>> /under dir/
>>
>> /ectory '*'/
>>
>> /warning: no previously-i

I have a gap in the reported error location of template does not exist

2014-01-25 Thread Malik Rumi
I'm wondering why this is and if it is why I am getting this eror? The 
template is in the default template dir. 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/09516267-989a-4332-a9e3-a1d94d56c944%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
<>

failure of auto increment in inndb (mysql)

2014-01-27 Thread Malik Rumi
I read this on the django project site: 
>
> Since MySQL 5.5.5, the default storage engine is 
> InnoDB. 
> This engine is fully transactional and supports foreign key references. 
> It’s probably the best choice at this point. However, note that the the 
> InnoDB autoincrement counter is lost on a MySQL restart because it does not 
> remember the AUTO_INCREMENT value, instead recreating it as “max(id)+1”. 
> This may result in an inadvertent reuse of 
> AutoField
>  values.

Now to my newby senses, this is a huge problem. How can you have a primary 
key, or a foreign key, without the assurance that they are unique? But I 
did some searching around the net, and while there are some suggested fixes 
here and there, no one seems to be in a panic about this. So, my question 
is, why? Are unique primary keys not as important as I thought they were? 
How are you dealing with this, if you use mysql/innodb? Is this a reason to 
jump to nosql? Help me wrap my brain around this. Thanks.  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/ac13c90b-bed2-488b-b145-3a7cde034b3a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


moving from sqlite3 to mysql

2014-01-28 Thread Malik Rumi
This is somewhat like the question in "need help moving to production 
server" but I think the right procedure is to start a new thread. So I 
think I have done well for just starting out. With your help I've gotten 
Django running on Windows, and I completed a tutorial and got my site 
working locally with the admin. thank you.

So I thought I was ready to move up to MySQL for some heavy lifting. I 
followed the instructions I got here 
http://matthewwittering.com/blog/how-to-migrating-the-database-engine-for-django.html.
 
I did not know what to do with the NAME part, so I put in 'django-1', and 
promptly got the error message 'unknown database 'django-1'. I thought that 
made sense because I hadn’t created this database in mysql already, but I 
was just blindly following along. Having to CREATE DATABASE doesn’t make 
sense, I thought, because it defeats the purpose of Django abstraction in 
the first place. Besides, when I syncdb, it should take whatever name I 
gave it when I was using sqlite3, right?

Wrong. When I ran syncdb, this time with NAME: ' ', I got :   File 
"C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in default 
terror handlerraise errorclass, errorvalue 
django.db.utils.OperationalError: (1046, 'No database selected').

So, what am I missing here? There almost certainly is an easy solution I'm 
not seeing. Do I need to create a database in mysql? If so, must it have 
the same name as it had in sqlite3? I know that name was made from putting 
the model name together with something else, but I don't actually remember 
what it was, and it seems like a lot of extra work to install an sqlite 
browser just to get that name right. If that's what I need to do, maybe I 
can just open that file with notepad? 

Or can I create the database, (presumably directly in the shell), and then 
empty it, as these instructions say, and that will take care of it? I 
frankly didn't understand why I would need to 'empty' a new and empty 
database, but that's what it says. 

Any and all helpful advise welcome and 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/f4a6d446-7cf8-498a-8ba5-04e339dd80b9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Implementing detailed access rights for users of different elements.

2014-01-28 Thread Malik Rumi
I don't have any solutions for you, but I am VERY interested in the 
responses, since you describe some of the same issues I will have soon but 
have not gotten to yet - especially the last one, which I don't think is 
'minor' at all. So, how about it, all you experienced users out there? 
Answer this one and you get a twofer!

On Tuesday, January 28, 2014 9:59:02 AM UTC-6, Anders wrote:
>
> Dear Django developers, 
> I need a bit of advice on how to solve an authorization problem. 
>
> My site is a is still being designed in my mind but think of it as a 
> portal of mini-facebooks (Gang); 
> In each Gang there functions such as write on wall, upload pictures, 
> share links, sell/buy stuff, discuss and so on. 
>
> I see 3 basic roles; 
>  Admin (can do/see everything in a Gang) 
>  Users (can't edit/see configurations) 
>  Guest (can access a Gang if invited but only read) 
>
> A user can be a User in one Gang, a Guest in a second and Admin of a 
> third. 
>
>
> The above, I guess could solve by simply having three ManyToMany-fields 
> (admins,users,guests) on each Gang-model, referencing the User table. 
>
>
> However I would like something more fine-grained, and see the roles as 
> "templates of accessrights". 
> E.g. the access rights should be as detailed as "Allow Create Gang", 
> "Allow Invite to Gang", "Allow Write on Wall" and so on. 
>
> And of course, these access rights are only relevant for a particular 
> user in a specific Gang (with the exception of the first). 
>
> Maybe it's too complicated and not worth it, but I am willing to try and 
> of course listen to the opinions of the experienced crowd here. :) 
>
>
> Another issue that bothers me is minor, but how to use these acessrights 
> in the template system to "hide" elements on the page for users who are 
> not allowed to interact with them. 
>
> Thank you for reading so far. 
>
> Regards 
> A. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/988c4489-aa28-4b32-884a-ededf531090b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: moving from sqlite3 to mysql

2014-02-05 Thread Malik Rumi
mysql>  CREATE DATABASE django_1;

Query OK, 1 row affected (0.24 sec)

mysql> SHOW DATABASES;

++

| Database   |

++

| information_schema |

| django_1   |

| mysql  |

| performance_schema |

| test   |

++

5 rows in set (0.31 sec)

mysql> exit

Bye

python manage.py syncdb

Traceback (most recent call last):

(...)

File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in
defaulterrorhandlerraise errorclass, errorvalue

django.db.utils.OperationalError: (1046, 'No database selected')

python manage.py syncdb django_1

CommandError: Command doesn't accept any arguments

python manage.py syncdb --django_1

Usage: manage.py syncdb [options]

Create the database tables for all apps in INSTALLED_APPS whose tables
haven't already been created.

manage.py: error: no such option: --django_1

<>

Ok, so MySQL wanted a db name, even though there was no db name (at least
not one I gave it) on sqlite3

when I ran syncdb without a name, it said no db selected

When I tried pointing it to a name, I got 'doesn't accept arguments' and
then 'no such option.'

Is django now saying this new database has to be listed as an installed
app? What am I missing here?

 - and thanks for much for your help.


On Tue, Jan 28, 2014 at 8:45 PM, Ariel E. Isidro  wrote:

> "Or can I create the database, (presumably directly in the shell), and
> then empty it, as these instructions say, and that will take care of it? I
> frankly didn't understand why I would need to 'empty' a new and empty
> database, but that's what it says. "
>
> With sql lite, everything will be created for you.
> While with MySQL,  you should create the database directly in the shell,
> and this should give you an empty database.  The Django tables will be
> created after configuring your settings, and running  syncdb.
>
>
>
>
> On Wed, Jan 29, 2014 at 1:17 AM, Malik Rumi wrote:
>
>> This is somewhat like the question in "need help moving to production
>> server" but I think the right procedure is to start a new thread. So I
>> think I have done well for just starting out. With your help I've gotten
>> Django running on Windows, and I completed a tutorial and got my site
>> working locally with the admin. thank you.
>>
>> So I thought I was ready to move up to MySQL for some heavy lifting. I
>> followed the instructions I got here
>> http://matthewwittering.com/blog/how-to-migrating-the-database-engine-for-django.html.
>> I did not know what to do with the NAME part, so I put in 'django-1', and
>> promptly got the error message 'unknown database 'django-1'. I thought that
>> made sense because I hadn't created this database in mysql already, but
>> I was just blindly following along. Having to CREATE DATABASE doesn't make
>> sense, I thought, because it defeats the purpose of Django abstraction in
>> the first place. Besides, when I syncdb, it should take whatever name I
>> gave it when I was using sqlite3, right?
>>
>> Wrong. When I ran syncdb, this time with NAME: ' ', I got :   File
>> "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in default
>> terror handlerraise errorclass, errorvalue
>> django.db.utils.OperationalError: (1046, 'No database selected').
>>
>> So, what am I missing here? There almost certainly is an easy solution
>> I'm not seeing. Do I need to create a database in mysql? If so, must it
>> have the same name as it had in sqlite3? I know that name was made from
>> putting the model name together with something else, but I don't actually
>> remember what it was, and it seems like a lot of extra work to install an
>> sqlite browser just to get that name right. If that's what I need to do,
>> maybe I can just open that file with notepad?
>>
>> Or can I create the database, (presumably directly in the shell), and
>> then empty it, as these instructions say, and that will take care of it? I
>> frankly didn't understand why I would need to 'empty' a new and empty
>> database, but that's what it says.
>>
>> Any and all helpful advise welcome and 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 

Re: moving from sqlite3 to mysql

2014-02-06 Thread Malik Rumi
Ok, I got it working. And by working, I mean I got it to sync, I imported
the database.json into mysql, and when I runserver everything is there as
it should be.
So, many thanks to all my gracious and more senior django users for your
patient guidance and assistance.
A note to all newbies who may be following along and reading this days,
weeks, and years from now: Do yourself a favor and READ the documentation,
DON'T just scan it looking for a quick answer. You are bound to miss
something important.
Turns out that for all my struggling with a db name for mysql, all that
came after I had changed the settings.py to mysql. In other words, I didn't
think to go back and put the name I came up with, django_1, in settings.py.
But that was not enough. Now I had to also take off the
'--database=django_1' as that was unnecessary and maybe confusing django.
Once I did that, it all worked.

But don't worry, I'm sure I'll be back soon enough with some other
issues. :-)


On Wed, Feb 5, 2014 at 7:44 PM, Ariel E. Isidro  wrote:

> 1. before exiting mysql, you should grant permission to a user,i.e.
> grant all privileges on django_1.* to username@'localhost' identified by
> 'userpassword'
> replace username, userpassword with your own
> 2. exit mysql console
> 3. modify settings.py to add your username, password, host (localhost),
> and port (3306)
> 4. run python manage.py syncdb
>
>
> On Thu, Feb 6, 2014 at 7:52 AM, Drew Ferguson wrote:
>
>> Hi
>>
>> Just like SQLlite, you tell Django where the MySQL database is in
>> settings.py
>>
>> At the top you should have something like
>>
>> DATABASES = {
>>  'default': {
>>   'ENGINE': 'django.db.backends.mysql',
>>   'NAME': 'django_1', # Or path to database file if using sqlite3.
>> #  'USER': '',
>> #  'PASSWORD': '',
>> #  'HOST': '', # Empty for localhost
>> #  'PORT': '', # Set to empty string for default.
>>  }
>> }
>>
>>
>> On Wed, 5 Feb 2014 16:38:59 -0600
>> Malik Rumi  wrote:
>>
>> > mysql>  CREATE DATABASE django_1;
>> >
>> > Query OK, 1 row affected (0.24 sec)
>> >
>> > mysql> SHOW DATABASES;
>> >
>> > ++
>> >
>> > | Database   |
>> >
>> > ++
>> >
>> > | information_schema |
>> >
>> > | django_1   |
>> >
>> > | mysql  |
>> >
>> > | performance_schema |
>> >
>> > | test   |
>> >
>> > ++
>> >
>> > 5 rows in set (0.31 sec)
>> --
>> Drew Ferguson
>> AFC Commercial
>> http://www.afccommercial.co.uk
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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/20140205235235.53a238b1%40blacktav.fergiesontour.org
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> *Ariel E. Isidro*
> Backup your important files, click here  <http://db.tt/7cLLR7V/>
>
> DISCLAIMER: This message is for the designated recipient only and may
> contain confidential and/or privileged information. If you have received it
> in error, please delete it and advise the sender immediately. You should
> not copy or use it for any other purpose, nor disclose its contents to any
> other person.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/zpNqaA2Fji8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECOjiaW4jswaift33tcdTJc5DBwFYJhRKyZPmhn7FToC8QUvw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBxrfndqFf0t7vOsXrnTzWP5_UMYbeZr3RYvdri2jSu%3Dug%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django default settings module errors

2014-02-11 Thread Malik Rumi


My immediate goal is to port my (first) Django project to Google App 
Engine. It is running fine in Django’s runserver. However, in the GAE SDK I 
get nothing but blank white pages. I have looked at the Djangosettings
 documentation , 
the django-admin 
command, 
and the GAE Cloud-SQL Django 
documenation.
 
I am on Windows 8.1 with Django 1.6.1 and Python 2.7 and a MySQL 5.5 
backend. I have the GAE SDK 1.8.9.


One of the messages I got was that the SDK didn’t work with Django 1.6.1 so 
I set the version to ‘latest’.

When I ran django-admin.py syncdb --settings=mysite.settings from within 
the directory, I got no error messages from Django but still got the blank 
pages and the same error message from the SDK as before:


% (desc, ENVIRONMENT_VARIABLE))

ImproperlyConfigured: Requested setting MIDDLEWARE_CLASSES, but settings 
are not configured. You must either define the environment variable 
DJANGO_SETTINGS_MODULE or call settings.configure() before accessing 
settings.


Then I ran django-admin.py syncdb --settings=[absolute path] mysite.settings. 
This time I got this from the command line:


% (self.SETTINGS_MODULE, e)

ImportError: Could not import settings 'C:\Users…settings' (Is it on 
sys.path? Is there an import error in the settings file?): Import by 
filename is not supported.


The SDK still gives the same ImproperlyConfigured error. Then I tried 
putting the path directly into environmental variables myself, in PYTHONPATH 
between 
Django and App Engine, but I still get the same errors, so now I am turning 
to you. What do I do now?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/f040d157-070d-47a5-ba9d-6667a4097845%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


heroku better for django?

2014-02-11 Thread Malik Rumi


I have been trying to get my django project on Google App Engine without 
success, including posting my most recent problem on Stack Overflow and 
getting zero responses (I just reposted that question 
herein Django 
Google Groups). I am using MySQL locally and trying to use Google 
Cloud SQL when and if I get on App Engine. I find the django documentation 
on App Engine fragmentary, occasionally out of date and therefore 
inconsistent. I suspect this is because GAE support for Django has been 
slow in developing because of GAE’s preference for webapp2,  nonrel, and 
jinja2 templates. Yesterday I found a step by step guide for getting django 
on heroku using postgres, which I’ve never used, but I can learn if I have 
to. I don’t think the quality of the documentation alone tells me about the 
quality of the software or the experience of using it, but maybe it isn’t 
irrelevant, either. 

My question: Is Heroku better, or easier, for Django than App Engine? Does 
anyone here have some concrete, specific, and hopefully unbiased comparison 
experience to share?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/1668c4af-4ea1-45f8-a1ab-8a5356f34ead%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: heroku better for django?

2014-02-12 Thread Malik Rumi
Thanks to both of you. Clearly both Heroku and AWS are more welcoming to 
Django than GAE. I wasn't looking forward to running the server myself, but 
the documentation on AWS as well as Glyn's post make it seem a little less 
intimidating, so I am going to take a test flight on AWS and see what 
happens. If I crash and burn, it's hello Heroku!

On Tuesday, February 11, 2014 3:35:24 PM UTC-6, Glyn Jackson wrote:
>
> If you have a small app it's darn easy. I have personal experience with 
> Amazon AWS which is by far a better choice. 
> I wrote a guide on setup with Django if it helps:
>
> http://glynjackson.org/weblog/entry/django-15-deployement-amazon-ec2-ubuntu.html
>
> At the end of the day Heroku runs on AWS instances, why not cut out the 
> middle man. I personally don't like Platform as a Service (PaaS), AWS 
> offer Infrastructure as a Service (IaaS). 
>
> Read more: 
> http://www.quora.com/Heroku/How-easy-is-it-to-get-off-Heroku-once-you-grow-out-of-it
>
> As you can see not a big fan.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/78daa37f-c0ef-4adf-8b0b-b611bc5c1948%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: heroku better for django?

2014-02-13 Thread Malik Rumi
Glyn, I am following your guide but when I get to LoadModule I have run 
into 'Permission Denied'. As soon as I finished with 'make install' the 
system reported back that wsgi.so was chmod 644. I tried sudo chmod o+w and 
did not get an error but I still get permission denied when trying to load 
this module even if I precede the load command with sudo. Can you help, 
please? Thanks. 

On Wednesday, February 12, 2014 12:02:37 PM UTC-6, Malik Rumi wrote:
>
> Thanks to both of you. Clearly both Heroku and AWS are more welcoming to 
> Django than GAE. I wasn't looking forward to running the server myself, but 
> the documentation on AWS as well as Glyn's post make it seem a little less 
> intimidating, so I am going to take a test flight on AWS and see what 
> happens. If I crash and burn, it's hello Heroku!
>
> On Tuesday, February 11, 2014 3:35:24 PM UTC-6, Glyn Jackson wrote:
>>
>> If you have a small app it's darn easy. I have personal experience with 
>> Amazon AWS which is by far a better choice. 
>> I wrote a guide on setup with Django if it helps:
>>
>> http://glynjackson.org/weblog/entry/django-15-deployement-amazon-ec2-ubuntu.html
>>
>> At the end of the day Heroku runs on AWS instances, why not cut out the 
>> middle man. I personally don't like Platform as a Service (PaaS), AWS 
>> offer Infrastructure as a Service (IaaS). 
>>
>> Read more: 
>> http://www.quora.com/Heroku/How-easy-is-it-to-get-off-Heroku-once-you-grow-out-of-it
>>
>> As you can see not a big fan.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/40032df9-217f-4ba8-82bd-a6fbcf7838ed%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: heroku better for django?

2014-02-13 Thread Malik Rumi
Are you the same Daniel Roseman that replied to a search question of mine 
on Stack Overflow?

On Thursday, February 13, 2014 2:59:15 PM UTC-6, Daniel Roseman wrote:
>
> On Thursday, 13 February 2014 20:47:58 UTC, Malik Rumi wrote:
>>
>> Glyn, I am following your guide but when I get to LoadModule I have run 
>> into 'Permission Denied'. As soon as I finished with 'make install' the 
>> system reported back that wsgi.so was chmod 644. I tried sudo chmod o+w and 
>> did not get an error but I still get permission denied when trying to load 
>> this module even if I precede the load command with sudo. Can you help, 
>> please? Thanks. 
>>
>
> You are being very badly advised here. Firstly, for someone without 
> sysadmin experience, Heroku is a *much* better bet than trying to set up an 
> AWS server from scratch. Gondor is an equivalent alternative to Heroku.
>
> Secondly, even if you do go with AWS, there's absolutely no call to be 
> compiling mod_wsgi from scratch. If you're using an up-to-date version of 
> Ubuntu, which you should be, you can simply install mod_wsgi via apt-get. 
> Not only will that take away the problems if compiling it, it will have the 
> advantage of security updates provided via the distribution, rather than 
> relying on you to re-download and compile.
> --
> DR. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/fbb7bfa8-9234-44cd-b720-6107a2c5838b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


installing django trunk

2014-03-08 Thread Malik Rumi
I am going from 1.6.1 to 1.7a2, mostly to take advantage of the new 
migrations feature.
I followed the directions 
here 
http://django.readthedocs.org/en/latest/topics/install.html#removing-old-versions-of-django
 
Since I originally installed with pip, supposedly that would take care of 
removing the old version for me if I installed with pip now.
I changed into the subdirectory where 1.6.1 is, which is inside 
virtualenvwrapper.
The commands they gave ran and reported success. However, 1.7a2 has been 
installed at Python27/Scripts, not inside my virtualenv
1.6.1 seems to alive and well at its same original location.
What do I now? Can I just delete the 1.6.1 folder? Will pip/virtualenv know 
where to find 1.7a2 for my cuurent projects? Should I start the install 
over?
Thx.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/785364e6-231b-4e94-9392-bea55fa740ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: installing django trunk

2014-03-15 Thread Malik Rumi
First, Dan, thanks for the reply. Second, apologies for the long delay, but 
sometimes the day job gets in the way. Third, I did as you suggested, but 
Django 1.6.1 was NOT removed. My best guess is that the official 
documentation instruction that pip would take care of this for me only 
applies when going from one official release to another, not when going 
from an official release to a development release, though of course it does 
not say so explicitly.
pip did uninstall the 1.7 files from Python27/Scripts when I pointed it to 
them directly. I should add at this point that at the time of my original 
post, I did not realize that there were only 4 of them and that 
django-trunk was in the intended virtualenv alongside 1.6.1. 

However, pip would not only not uninstall django-trunk, it told me it 
wasn't installed, never mind the folder sitting there. Even better, git 
remove didn't work either. "Fatal: not a git repository"

So I deleted django-trunk the old fashioned way, through my OS. Then I 
activated the virtualenv, reconnected to git, and got django-trunk and the 
admin files where I expected them to be - in the virtualenv. When I saw 
this in my terminal window:

 Adding Django 1.7a2 to easy-install.pth file
Deleting C:\Envs\VE1\Scripts\django-admin.py
Installing django-admin-script.py script to C:\Envs\VE1\Scripts

I assumed that meant it was taking care of 1.6.1 at the same time it was 
installing 1.7a2, as I understood the install instructions to say it would 
do. But when I ran print(django.get_version()), I got 1.6.1!

Then I deleted both the django folder and the egg folder through Windows, 
but when I ran get_version again, I STILL got 1.6.1! I don't see how that 
is possible. There is another Django 1.6.1, but it is inside a DIFFERENT 
virtualenv, and when I exited the Python interpreter, I was right back to 
the VE I was working with. There is a django-admin in Python27, but when I 
opened it, it explicitly said that it was 1.7a2! Now it also had a line of 
code I didn't understand:

require('Django==1.7a2')
del require

What is this doing? Deleting a requirement as soon as it is created? I 
don't understand. 

Finally, I decided to runserver. The good news is that my site still works 
as it did before. The bad news is I have no idea how or why. Runserver also 
explicitly stated that it was running 1.6.1.

So, I guess I'll have to muddle along without migrations, which was the 
whole point of this exercise in futility. But I sure would like to 
understand what is happening here, if any of you wiser and more experienced 
heads can enlighten me. 



\
On Saturday, March 8, 2014 3:10:20 AM UTC-6, Malik Rumi wrote:
>
> I am going from 1.6.1 to 1.7a2, mostly to take advantage of the new 
> migrations feature.
> I followed the directions here 
> http://django.readthedocs.org/en/latest/topics/install.html#removing-old-versions-of-django
>  
> Since I originally installed with pip, supposedly that would take care of 
> removing the old version for me if I installed with pip now.
> I changed into the subdirectory where 1.6.1 is, which is inside 
> virtualenvwrapper.
> The commands they gave ran and reported success. However, 1.7a2 has been 
> installed at Python27/Scripts, not inside my virtualenv
> 1.6.1 seems to alive and well at its same original location.
> What do I now? Can I just delete the 1.6.1 folder? Will pip/virtualenv 
> know where to find 1.7a2 for my cuurent projects? Should I start the 
> install over?
> Thx.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/64ea91d3-f4df-470d-bad2-9c818708cb3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: installing django trunk

2014-03-19 Thread Malik Rumi
Anybody? A little help here?
Just to update, I ran a search for 'migrations' in my django folder, and
got a lot of hits, but when I tried to actually run 'makemigrations" I got
'unknown command'


On Sat, Mar 15, 2014 at 6:37 PM, Malik Rumi  wrote:

> First, Dan, thanks for the reply. Second, apologies for the long delay,
> but sometimes the day job gets in the way. Third, I did as you suggested,
> but Django 1.6.1 was NOT removed. My best guess is that the official
> documentation instruction that pip would take care of this for me only
> applies when going from one official release to another, not when going
> from an official release to a development release, though of course it does
> not say so explicitly.
> pip did uninstall the 1.7 files from Python27/Scripts when I pointed it to
> them directly. I should add at this point that at the time of my original
> post, I did not realize that there were only 4 of them and that
> django-trunk was in the intended virtualenv alongside 1.6.1.
>
> However, pip would not only not uninstall django-trunk, it told me it
> wasn't installed, never mind the folder sitting there. Even better, git
> remove didn't work either. "Fatal: not a git repository"
>
> So I deleted django-trunk the old fashioned way, through my OS. Then I
> activated the virtualenv, reconnected to git, and got django-trunk and the
> admin files where I expected them to be - in the virtualenv. When I saw
> this in my terminal window:
>
>  Adding Django 1.7a2 to easy-install.pth file
> Deleting C:\Envs\VE1\Scripts\django-admin.py
> Installing django-admin-script.py script to C:\Envs\VE1\Scripts
>
> I assumed that meant it was taking care of 1.6.1 at the same time it was
> installing 1.7a2, as I understood the install instructions to say it would
> do. But when I ran print(django.get_version()), I got 1.6.1!
>
> Then I deleted both the django folder and the egg folder through Windows,
> but when I ran get_version again, I STILL got 1.6.1! I don't see how that
> is possible. There is another Django 1.6.1, but it is inside a DIFFERENT
> virtualenv, and when I exited the Python interpreter, I was right back to
> the VE I was working with. There is a django-admin in Python27, but when I
> opened it, it explicitly said that it was 1.7a2! Now it also had a line of
> code I didn't understand:
>
> require('Django==1.7a2')
> del require
>
> What is this doing? Deleting a requirement as soon as it is created? I
> don't understand.
>
> Finally, I decided to runserver. The good news is that my site still works
> as it did before. The bad news is I have no idea how or why. Runserver also
> explicitly stated that it was running 1.6.1.
>
> So, I guess I'll have to muddle along without migrations, which was the
> whole point of this exercise in futility. But I sure would like to
> understand what is happening here, if any of you wiser and more experienced
> heads can enlighten me.
>
>
>
> \
> On Saturday, March 8, 2014 3:10:20 AM UTC-6, Malik Rumi wrote:
>>
>> I am going from 1.6.1 to 1.7a2, mostly to take advantage of the new
>> migrations feature.
>> I followed the directions here http://django.readthedocs.org/en/latest/
>> topics/install.html#removing-old-versions-of-django
>> Since I originally installed with pip, supposedly that would take care of
>> removing the old version for me if I installed with pip now.
>> I changed into the subdirectory where 1.6.1 is, which is inside
>> virtualenvwrapper.
>> The commands they gave ran and reported success. However, 1.7a2 has been
>> installed at Python27/Scripts, not inside my virtualenv
>> 1.6.1 seems to alive and well at its same original location.
>> What do I now? Can I just delete the 1.6.1 folder? Will pip/virtualenv
>> know where to find 1.7a2 for my cuurent projects? Should I start the
>> install over?
>> Thx.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/VnATClf-Wco/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/64ea91d3-f4df-470d-bad2-9c818708cb3c%40googlegroups.com<https://groups.google.com/d/msgid/django-users/64ea91d3-f4df-470d-bad2-9c818708cb3c%40googlegroups.com?utm_medium=email&utm_source

3 table many to many relationship

2014-04-23 Thread Malik Rumi


I was designing the models I will need for this project. I designed an 
intermediate table for two models, A and B, and then started to sketch out 
an intermediate table for two other models, A and C, when I realized that 
these two intermediate tables both use A, and further, the information in 
the second intermediate table will be a lot more valuable it if also shows 
the relationship C has to B. 

I looked at the Many to Many documentation on the official Django site, but 
I don’t see a discussion of this three table option. I have seen it 
elsewhere, so I assume it can be done. What I don’t assume is the impact 
this has on performance and other issues I might not even anticipate. So, 
my questions:

   Can this three sided many to many intermediate table be created in 
Django?

If it can, is it advisable, or are there better / more efficient ways 
of doing this, like with two intermediate tables as I was originally 
thinking?

thx.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/0dc423af-04ef-4e43-b177-720f9021d6d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 3 table many to many relationship

2014-04-26 Thread Malik Rumi
Merci beaucoup


On Wed, Apr 23, 2014 at 10:43 PM, Simon Charette wrote:

> Django allows you to explicitly specify an intermediary model for
> many-to-many relationships with the 
> `through<https://docs.djangoproject.com/en/1.6/ref/models/fields/#django.db.models.ManyToManyField.through>`
> option.
>
> class A(models.Model):
> b_set = models.ManyToMany('B', related_name='a_set', through='R')
> c_set = models.ManyToMany('C', related_name='a_set', through='R')
>
> class B(models.Model):
> pass
>
> class C(models.Model):
> pass
>
> class R(models.Model):
> a = models.ForeignKey('A')
> b = models.ForeignKey('B')
> c = models.ForeignKey('C')
>
> However you'll loose the ability of directly adding objects to
> relationships (A().b_set.create() won't work).
> You'll need to explicitly create `R` instances instead:
> R.objects.create(a=a, b=b, c=c).
>
> Simon
>
> Le mercredi 23 avril 2014 23:24:04 UTC-4, Malik Rumi a écrit :
>
>> I was designing the models I will need for this project. I designed an
>> intermediate table for two models, A and B, and then started to sketch out
>> an intermediate table for two other models, A and C, when I realized that
>> these two intermediate tables both use A, and further, the information in
>> the second intermediate table will be a lot more valuable it if also shows
>> the relationship C has to B.
>>
>> I looked at the Many to Many documentation on the official Django site,
>> but I don’t see a discussion of this three table option. I have seen it
>> elsewhere, so I assume it can be done. What I don’t assume is the impact
>> this has on performance and other issues I might not even anticipate. So,
>> my questions:
>>
>>Can this three sided many to many intermediate table be created in
>> Django?
>>
>> If it can, is it advisable, or are there better / more efficient
>> ways of doing this, like with two intermediate tables as I was originally
>> thinking?
>>
>> thx.
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/Z53HNI9t8Rw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2e128d84-3e70-4bab-8b70-696eaaa369c1%40googlegroups.com<https://groups.google.com/d/msgid/django-users/2e128d84-3e70-4bab-8b70-696eaaa369c1%40googlegroups.com?utm_medium=email&utm_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/CAKd6oByv_%3Dif8JTtLi%3D5%2BtzUsS8K6MSuS_AG8ooYhUqX039Cng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


i've screwed up my virtualenv

2014-05-05 Thread Malik Rumi



I have several problems. They are:

My Django project folder is 3 levels below my virtualenv.

Pip freeze:

a.on my virtualenv, in the parent folder or the Django project, only 
gives me the Django-trunk I got from github

b.but in the Django project folder, and without the virtualenv, it 
gives me all 8 packages I’ve been using on my project thus far.

c.Note this includes Django 1.6.1, not Django-trunk, which is the beta 
Django 1.7a2.

So clearly I’ve screwed up. The question is, how bad is it, and what do I 
do about it?

thx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/7c1fc205-eefe-45fb-9538-bddb1aaf321a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: i've screwed up my virtualenv

2014-05-05 Thread Malik Rumi
THANKS!
Yea, it's that 'activate' part that I kept forgetting that got me into this
mess. Maybe I should paste it to my forehead? (-:



On Mon, May 5, 2014 at 2:46 AM, Mike Dewhirst  wrote:

> On 5/05/2014 5:32 PM, Malik Rumi wrote:
>
>>
>> I have several problems. They are:
>>
>
> Try ...
>
> 1. Create a new virtualenv for your project
>
> 2. pip install all the dependencies again (if you don't have a
> requirements file) including Django 1.6
>
> 3. Retrieve your project code from the repo or backup
>
> 4. Manually copy any changed source (from three levels down) over the
> restored source
>
> 5. Repeat from 1 above except for Django 1.7 in step 2
>
> Don't forget to activate whichever virtualenv you want to work on.
>
> Good luck
>
> Mike
>
>
>
>> My Django project folder is 3 levels below my virtualenv.
>>
>> Pip freeze:
>>
>> a.on my virtualenv, in the parent folder or the Django project,
>> only gives me the Django-trunk I got from github
>>
>> b.but in the Django project folder, and without the virtualenv,
>> it gives me all 8 packages I’ve been using on my project thus far.
>>
>>
>> c.Note this includes Django 1.6.1, not Django-trunk, which is
>> the beta Django 1.7a2.
>>
>> So clearly I’ve screwed up. The question is, how bad is it, and
>>
>> what do I do about it?
>>
>> thx
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to django-users+unsubscr...@googlegroups.com
>> <mailto:django-users+unsubscr...@googlegroups.com>.
>>
>> To post to this group, send email to django-users@googlegroups.com
>> <mailto: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/7c1fc205-
>> eefe-45fb-9538-bddb1aaf321a%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/7c1fc205-
>> eefe-45fb-9538-bddb1aaf321a%40googlegroups.com?utm_medium=
>> email&utm_source=footer>.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/Jwp0yd5IXgU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/536741C3.5020802%40dewhirst.com.au.
>
> 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/CAKd6oBxPDZYPTesbgR9bTmg_0On34EgKS9kNGsSKyDE7oZSoow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


What does "+=" mean, or do?

2014-05-12 Thread Malik Rumi
I saw it 
here http://www.slideshare.net/jacobian/the-best-and-worst-of-django on 
slide 41. That's a lot to go through, I know, sorry about that. But I 
googled it and of course got nothing because Google ignores things like + 
and = now. And I know in this particular example he says 'don't do this", I 
just want to know what += means or does? Thx. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/f364291f-ae62-4b0b-a2d9-23e3f81a64e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What does "+=" mean, or do?

2014-05-12 Thread Malik Rumi
Wow, really quick replies! thanks to both of you!

On Monday, May 12, 2014 8:26:57 AM UTC-5, Tom Evans wrote:
>
> On Mon, May 12, 2014 at 2:22 PM, Malik Rumi 
> > 
> wrote: 
> > I saw it here 
> > http://www.slideshare.net/jacobian/the-best-and-worst-of-django on 
> slide 41. 
> > That's a lot to go through, I know, sorry about that. But I googled it 
> and 
> > of course got nothing because Google ignores things like + and = now. 
> And I 
> > know in this particular example he says 'don't do this", I just want to 
> know 
> > what += means or does? Thx. 
>
> + means addition 
> = means assignment 
> += means addition and assignment 
>
> Eg, a += 5 means a = a + 5 
>
> Cheers 
>
> Tom 
>
> PS - the "don't do this" is not about "+="! 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/e9a173df-ce25-44ee-9fc9-f3d0f9daa62c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Remote development on Heroku

2014-07-02 Thread Malik Rumi
Because I have not been able to get a response to this issue 

 I 
am going to use for remote development. Since I will not be giving out the 
url,will it be okay to set debug to true and use debug toolbar?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/b416bcf0-bf8b-49ba-8055-979b9b879322%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Search results in template

2017-12-19 Thread Malik Rumi
 

I am implementing search on a local Django project: Django 1.11.5, Python 
3.6.3, Ubuntu 16.04. My issue is getting the search results onto the 
template.

I am using standard CBV for everything else in the site, but for this one I 
wrote my own. It uses the same template as my ListView, which shows all 
objects fine.



def serp(request):
if request.method == 'GET' and 'searchbox' in request.GET:
q = request.GET.get('searchbox')
query = SearchQuery(q)
object_list = Entry.objects.annotate(
rank=SearchRank(F(
'search_vector'), query)).filter(
search_vector=query).order_by(
'-rank').values_list('title', 'rank')
return render(request, 'serp_list.html', {'object_list': object_list})


Django Debug Toolbar reports everything went as expected. The right 
template and view were called, as well as the right db query. I had 
previously tested this query in the shell, and it pulls up a 4 element 
queryset, as it should. 

Even though no search results show on the page, there are 4 instances of 
the html that should be surrounding each result and rows=4 loops=1 in the 
query plan. 

One thing I found curious is that the **mere change** in the variable name 
'object_list' to 'resultslist' gave me no db query! I had always thought 
variable names didn't matter in Python, 

but apparently 'object_list' is virtually a reserved word when it comes to 
views (even FBVs) and templates in Django? Here is the template:




{% for object in object_list %}
{{ object.title 
}}



{{object.chron_date}}
{{object.clock}} 

 by 
 22 
comments



{{ object.content|truncatewords:30 }}

 tag 1, tag 2, long tag 3
Read More



{% endfor %}
Any assistance in getting the search results to show up greatly appreciated.--

ps -


Despite the 99% similarity, this is not identical to my issue in 
https://groups.google.com/forum/#!searchin/django-users/template%7Csort:relevance/django-users/o4UKSTBtwyg/cU4JeRJHHgAJ
 
There I had the for variable 'i' but put the name of the list in the 
{{regular variables}}. That is not the issue this time, but clearly I have 
trouble grasping the regular and efficient use of Django context and 
templates. And yes, I have looked at the docs as well as elsewhere. So if, 
in addition to an answer, you can point me to a real clear, simple, step by 
step primer on making these two things work together, I would gladly look 
at 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6670bc0d-9f64-4b6f-9f62-a007d969e0b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search results in template

2017-12-22 Thread Malik Rumi
Thanks to both of you. The template context is what it should be, and 
putting all the view in the same block made no difference. :-(

On Wednesday, December 20, 2017 at 6:24:57 AM UTC-8, James Schneider wrote:
>
>
>
> On Dec 19, 2017 5:12 PM, "Malik Rumi" > 
> wrote:
>
> I am implementing search on a local Django project: Django 1.11.5, Python 
> 3.6.3, Ubuntu 16.04. My issue is getting the search results onto the 
> template.
>
> I am using standard CBV for everything else in the site, but for this one 
> I wrote my own. It uses the same template as my ListView, which shows all 
> objects fine.
>
>
>
> def serp(request):
> if request.method == 'GET' and 'searchbox' in request.GET:
> q = request.GET.get('searchbox')
> query = SearchQuery(q)
> object_list = Entry.objects.annotate(
> rank=SearchRank(F(
> 'search_vector'), query)).filter(
> search_vector=query).order_by(
> '-rank').values_list('title', 'rank')
> return render(request, 'serp_list.html', {'object_list': object_list})
>
>
> Django Debug Toolbar reports everything went as expected. The right 
> template and view were called, as well as the right db query. I had 
> previously tested this query in the shell, and it pulls up a 4 element 
> queryset, as it should. 
>
>
> Your view has a bug. If the first 'if' statement returns false, then the 
> view fails because the 'q' variable is never set, and your viewer will get 
> a 500 error. I think the two lines following the 'q =' line should be 
> indented inside of the if statement, and object_list should be set to an 
> empty list by default before the 'if' statement.
>
> You should also ensure that this view is the one that is actually being 
> called by the URL dispatcher.
>
> Checking what is in the template context with the DDT is the next step. If 
> the template context is incorrect, then you'll need to debug within your 
> view to determine where/why the context is not being set correctly.
>
> 'object_list' is a generic variable name used by list CBV's in the 
> template context, but should be available to FBV's since there is no magic 
> context creation.
>
> -James
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/943dcc6f-01a8-4ef2-a784-3b503b1b5c38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search results in template

2017-12-23 Thread Malik Rumi
FIRST, James, let me say how much I *greatly* appreciate you hanging in
there and trying to help me.
2nd, as to your two points about the html:
   a. This template, serp_list.html, is identical to ktab_list.html, except
that serp_list has the title 'SEARCH' at the top and some bolierplate text
about this being the search results page. Other than that they are
identical, including the template for loop.
   serp_list is supposed to be called by localhost/serp/, which points
to views.serp, which is an FBV.
   ktab_list is a vanilla implementation of ListView, called by
localhost/index/, and it shows all Entry objects as you would expect.
   The header you see is the blog post header, ie, this is where the
title and the get absoulte url to the detail page is supposed to go. On
/index/ that works like it should. On serp, well, that's why I am here.
  b. Your second point is probably well taken, that the for loop should
completely wrap the article, and that might explain why the author and
comments part of the last three posts were not the same font as the first
post. I have changed that in the html, but it has not changed the result.

3rd, just because things weren't complicated enough, now I am getting
inconsistent results. Whereas before I got views.serp called, a db query
with 4 results, on the right template, now I am getting a value error
('returns None' - how's that for a news flash?). The only difference is
that I downloaded the free version of pycharm to see if their visual
debugger would help me. So calling the page through pycharm, instead of the
regular terminal, is the only difference, and I don't think that should
make a difference. But either way, I still have no result on my page - and
oh yea, pycharm says the same thing my print statements did - that the
query was there and pulled up the expected objects. They just won't show up
on the template.

4th, I don't know how relevant this is, but the form which created the
search box has the form action = '/serp/', but despite that, if I use the
search box in /index/, I stay on /index/ and just get the query attached to
the end of that url, rather than /serp/ plus the query. I have to manually
type in /serp/ to get  views.serp called. When it stays on  /index/ plus
the query, the result shown are just Entry.objects.all(), as you would
expect on a ListView. Any thoughts on that? Is it related? Why isn't my
form action working? THANKS!



*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Fri, Dec 22, 2017 at 4:31 PM, James Schneider 
wrote:

>
> 
>> 
>>  
>>  {% for object in object_list %}
>>  {{ object.title 
>> }}
>>  
>>  
>>  
>>  > class="day">{{object.chron_date}}
>>  > class="month">{{object.clock}} 
>>  
>>  by > href="#">
>>  22 
>> comments
>>  
>>  
>>  
>>  {{ object.content|truncatewords:30 }}
>>  
>>  > class="icon-tags"> tag 1, tag 2, > href="#">long tag 3
>>  Read More
>>  
>> 
>>  
>>  {% endfor %}
>> Any assistance in getting the search results to show up greatly 
>> appreciated.--
>>
>>
> There is still an issue with the HTML from what I can see, your {% for %}
> loop starts within an  tag, but the  tag is within the
> {% for %} loop, so you are trying to create multiple article entries, but
> only the first has an opening  tag. Not sure how/if that affects
> the display of the results.
>
> The point from my previous goof still stands, do your results show within
> the rendered page HTML, but just aren't being displayed?
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/xSW1BjLXXSQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciV56ORGwDeap7nser4RwSE3gdZV
> XPgREMU%3Dzw8g6YDx2g%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 

Re: Search results in template

2017-12-26 Thread Malik Rumi
PyCharm had my project running in a separate process. Don't worry about
that. I don't think it's a huge issue


I have the right view


The template context says I have a queryset


The explanation seems right.


And so does the selection

I put print statements in the view:

##
Quit the server with CONTROL-C.
This is the value of query:  SearchQuery(eaa)
This is the value of QuerySet:  
[26/Dec/2017 18:57:31] "GET /serp/?q=eaa HTTP/1.1" 200 66580

##

Note this is all done through my simple html search form, defined in the
template. My Django Form, SearchBox(), does absolutely nothing, as if it
isn't connected to anything. I don't understand what the problem there is,
I can't show that this is related or not. I do know I'd rather have the
functionality than a pretty form.

An ordinary ListView of all objects works normally, as does my DetailView.
I have tried several times to re-write views.serp as a cbv with
get_context_data, but either context or request or Searchbox() end up being
undefined, or an ImportError.

Finally, a screenshot of my search page, with four spaces for the 4 entries
that correctly correspond to the query 'eaa'. They just aren't there.






😪



*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Sun, Dec 24, 2017 at 2:44 AM, James Schneider 
wrote:

>
>
> On Dec 23, 2017 5:36 PM, "Malik Rumi"  wrote:
>
> FIRST, James, let me say how much I *greatly* appreciate you hanging in
> there and trying to help me.
>
>
> No worries.
>
> 2nd, as to your two points about the html:
>a. This template, serp_list.html, is identical to ktab_list.html,
> except that serp_list has the title 'SEARCH' at the top and some
> bolierplate text about this being the search results page. Other than that
> they are identical, including the template for loop.
>serp_list is supposed to be called by localhost/serp/, which points
> to views.serp, which is an FBV.
>ktab_list is a vanilla implementation of ListView, called by
> localhost/index/, and it shows all Entry objects as you would expect.
>The header you see is the blog post header, ie, this is where the
> title and the get absoulte url to the detail page is supposed to go. On
> /index/ that works like it should. On serp, well, that's why I am here.
>   b. Your second point is probably well taken, that the for loop should
> completely wrap the article, and that might explain why the author and
> comments part of the last three posts were not the same font as the first
> post. I have changed that in the html, but it has not changed the result.
>
>
> Hooray, at least I've gotten something right. ;-
>
>
> 3rd, just because things weren't complicated enough, now I am getting
> inconsistent results. Whereas before I got views.serp called, a db query
> with 4 results, on the right template, now I am getting a value error
> ('returns None' - how's that for a news flash?). The only difference is
> that I downloaded the free version of pycharm to see if their visual
> debugger would help me. So calling the page through pycharm, instead of the
> regular terminal, is the only difference, and I don't think that should
> make a difference. But either way, I still have no result on my page - and
> oh yea, pycharm says the same thing my print statements did - that the
> query was there and pulled up the expected objects. They just won't show up
> on the template.
>
>
> Confused. You mentioned PyCharm affected the results but then indicated
> the same results?
>
>
> 4th, I don't know how relevant this is, but the form which created the
> search box has the form action = '/serp/', but despite that, if I use the
> search box in /index/, I stay on /index/ and just get the query attached to
> the end of that url, rather than /serp/ plus the query. I have to manually
> type in /serp/ to get  views.serp called. When it stays on  /index/ plus
> the query, the result shown are just Entry.objects.all(), as you would
> expect on a ListView. Any thoughts on that? Is it related? Why isn't my
> form action working? THANKS!
>
>
>
>
> A few (possibly dumb) questions:
>
> Have you verified that the serp.html page is the one actually being
> rendered? DDT can verify this.
>
> Have you confirmed the context being provided to the template actually
> contains the variables and query results you are expecting? DDT can also
> verify this.
>
> Can you do something simple like {{ object_list }} in your template just
> to see if anything is printed? When doing quick troubleshooting I like to
> do this:
>
> |{{ object_list }}|
>
> That way if

Re: Search results in template

2017-12-26 Thread Malik Rumi
Here is the Entry model:

class Entry(models.Model):
title = models.CharField(max_length=100, blank=False, null=False)
slug = models.SlugField(max_length=100)
content = models.TextField()
posted_date = models.DateTimeField(auto_now=True)
chron_date = models.DateField(auto_now=False, auto_now_add=False,
blank=True)
clock = models.TimeField(auto_now=False, auto_now_add=False, blank=True)

ALIGN = "Align"
CULTURE = "Culture"
EXPENSE = "Expense"
INCOME = "Income"
HUMAN_RELATIONSHIPS = "Human Relationships"
CATEGORY_CHOICES = (
(ALIGN, "Align"),
(CULTURE, "Culture"),
(EXPENSE, "Expense"),
(INCOME, "Income"),
(HUMAN_RELATIONSHIPS, "Human Relationships"),
)
category = models.CharField(max_length=25, choices=CATEGORY_CHOICES,
default=INCOME)
tags = models.ManyToManyField(Tag)
search_vector = SearchVectorField(blank=True, null=True)

class Meta:
verbose_name = "Diary Entry"
verbose_name_plural = "Diary Entries"
ordering = ["-chron_date", "clock"]
indexes = [
GinIndex(fields=['search_vector'])
]

def __str__(self):
return self.title

def get_absolute_url(self):
return reverse('detail', kwargs={"slug": self.slug})


You already have the template in my original post to start this thread.

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Tue, Dec 26, 2017 at 2:26 PM, James Schneider 
wrote:

>
>
>
> The template context says I have a queryset
>
>
> I see it there. Can you post up the model for Entry?
>
>
>
>
> And so does the selection
>
>
> Yes. It appears that you will have 4 results in your queryset.
>
>
>
> I put print statements in the view:
>
> ##
> Quit the server with CONTROL-C.
> This is the value of query:  SearchQuery(eaa)
> This is the value of QuerySet:   further review', 0.151982), ('2017-11-14  Pulling The Trigger', 0.151982),
> ('2017-10-05 A Failure of Incentive?', 0.121585), ('2017-10-20 spider
> refactor', 0.121585)]>
> [26/Dec/2017 18:57:31] "GET /serp/?q=eaa HTTP/1.1" 200 66580
>
> ##
>
>
> At this point, the view doesn't appear to be the problem. We need to start
> tracking things down in the template code.
>
>
>
>
> Note this is all done through my simple html search form, defined in the
> template. My Django Form, SearchBox(), does absolutely nothing, as if it
> isn't connected to anything. I don't understand what the problem there is,
> I can't show that this is related or not. I do know I'd rather have the
> functionality than a pretty form.
>
>
> No reason you can't have both, but let's work on the result display issue
> first.
>
> An ordinary ListView of all objects works normally, as does my DetailView.
> I have tried several times to re-write views.serp as a cbv with
> get_context_data, but either context or request or Searchbox() end up being
> undefined, or an ImportError.
>
>
> Are you overriding get_context_data() correctly? It doesn't sound like it.
>
>
> Finally, a screenshot of my search page, with four spaces for the 4
> entries that correctly correspond to the query 'eaa'. They just aren't
> there.
>
>
> This is where the problem is, I think.
>
> You should set up a simple loop in your template:
>
> 
> {% for obj in QuerySet %}
> {{obj}}
> {% empty %}
> No results
> {% endfor %}
>
> If that works, you should go deeper per your Entry model:
>
>
> 
> {% for obj in QuerySet %}
> {{obj.name}}: {{obj.weight}}
> {% empty %}
> No results
> {% endfor %}
>
> I'm using name and weight as an attribute of Entry, but you should use
> something that matches your model definition. I think the issue is that you
> are not referring to your model correctly within the search results within
> the template.
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/xSW1BjLXXSQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciWvgD7-RnqWJvpKrpYvd2SB2TGwOW2bj4UOcK
> btMJVR%3Dg%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 d

Re: Search results in template

2017-12-26 Thread Malik Rumi
*Your first suggested loop:*

This is the first page



{% for obj in QuerySet %}

{{obj}}

{% empty %}

No results

{% endfor %}

*The result:*

!DOCTYPE This is the first page

   -

   ('2017-10-09 Incentive, a further review', 0.151982)
   -

   ('2017-11-14 Pulling The Trigger', 0.151982)
   -

   ('2017-10-05 A Failure of Incentive?', 0.121585)
   -

   ('2017-10-20 spider refactor', 0.121585)


*Same template with your second loop added:*


!DOCTYPE








This is the first page




{% for obj in QuerySet %}

{{obj}}

{% empty %}

No results

{% endfor %}


And now for something completely different...




{% for obj in QuerySet %}

{{obj.title}}: {{obj.chron_date}}

{{obj.content}}

{% empty %}

No results

{% endfor %}







*And the result:*


!DOCTYPE This is the first page

   -

   ('2017-10-09 Incentive, a further review', 0.151982)
   -

   ('2017-11-14 Pulling The Trigger', 0.151982)
   -

   ('2017-10-05 A Failure of Incentive?', 0.121585)
   -

   ('2017-10-20 spider refactor', 0.121585) And now for something
   completely different...
   -

  :
  -

  :
  -

  :
  -

  :
  -



<<>>


So this looks like a variable problem, but I don't claim to understand
that, either. I mentioned earlier on this thread that different variables
gave me different results, but everyone says that can't be it.

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Tue, Dec 26, 2017 at 8:34 PM, Malik Rumi  wrote:

> Here is the Entry model:
>
> class Entry(models.Model):
> title = models.CharField(max_length=100, blank=False, null=False)
> slug = models.SlugField(max_length=100)
> content = models.TextField()
> posted_date = models.DateTimeField(auto_now=True)
> chron_date = models.DateField(auto_now=False, auto_now_add=False,
> blank=True)
> clock = models.TimeField(auto_now=False, auto_now_add=False,
> blank=True)
>
> ALIGN = "Align"
> CULTURE = "Culture"
> EXPENSE = "Expense"
> INCOME = "Income"
> HUMAN_RELATIONSHIPS = "Human Relationships"
> CATEGORY_CHOICES = (
> (ALIGN, "Align"),
> (CULTURE, "Culture"),
> (EXPENSE, "Expense"),
> (INCOME, "Income"),
> (HUMAN_RELATIONSHIPS, "Human Relationships"),
> )
> category = models.CharField(max_length=25, choices=CATEGORY_CHOICES,
> default=INCOME)
> tags = models.ManyToManyField(Tag)
> search_vector = SearchVectorField(blank=True, null=True)
>
> class Meta:
> verbose_name = "Diary Entry"
> verbose_name_plural = "Diary Entries"
> ordering = ["-chron_date", "clock"]
> indexes = [
> GinIndex(fields=['search_vector'])
> ]
>
> def __str__(self):
> return self.title
>
> def get_absolute_url(self):
> return reverse('detail', kwargs={"slug": self.slug})
>
>
> You already have the template in my original post to start this thread.
>
> *“None of you has faith until he loves for his brother or his neighbor
> what he loves for himself.”*
>
> On Tue, Dec 26, 2017 at 2:26 PM, James Schneider 
> wrote:
>
>>
>>
>>
>> The template context says I have a queryset
>>
>>
>> I see it there. Can you post up the model for Entry?
>>
>>
>>
>>
>> And so does the selection
>>
>>
>> Yes. It appears that you will have 4 results in your queryset.
>>
>>
>>
>> I put print statements in the view:
>>
>> ##
>> Quit the server with CONTROL-C.
>> This is the value of query:  SearchQuery(eaa)
>> This is the value of QuerySet:  > further review', 0.151982), ('2017-11-14  Pulling The Trigger', 0.151982),
>> ('2017-10-05 A Failure of Incentive?', 0.121585), ('2017-10-20 spider
>> refactor', 0.121585)]>
>> [26/Dec/2017 18:57:31] "GET /serp/?q=eaa HTTP/1.1" 200 66580
>>
>> ##
>>
>>
>> At this point, the view doesn't appear to be the problem. We need to
>> start tracking things down in the template code.
>>
>>
>>
>>
>> Note this is all done through my simple html search form, defined in the
>> template. My Django Form, SearchBox(), does absolutely nothing, as if it
>> isn't connected to anything. I don't understand what the problem there is,
>> I can't show that this is related or not. I do know I&#

Re: Search results in template

2017-12-26 Thread Malik Rumi
That appears to be it. I got content and all that on the simple template
this time.

I put values_list in there because that's the way it was done on the
postgres full text search tutorial I was using. I assumed it was needed for
rank, I never thought about it limiting me otherwise.
If I seem a little less enthused than I should be, it is only because I am
getting a little tired and hungry, and was emotionally prepared to put this
whole thing aside and had started working on something else.
But you have helped me tremendously, and I greatly appreciate it. Tomorrow
I will play with it some more... unless my mood changes after I eat  ;-)

THANK YOU

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Tue, Dec 26, 2017 at 9:19 PM, James Schneider 
wrote:

>
>
>
> *And the result:*
>
>
> !DOCTYPE This is the first page
>
>-
>
>('2017-10-09 Incentive, a further review', 0.151982)
>-
>
>('2017-11-14 Pulling The Trigger', 0.151982)
>-
>
>('2017-10-05 A Failure of Incentive?', 0.121585)
>-
>
>('2017-10-20 spider refactor', 0.121585) And now for something
>completely different...
>-
>
>   :
>   -
>
>   :
>   -
>
>   :
>   -
>
>   :
>   -
>
>
>
> <<>>
>
>
> So this looks like a variable problem, but I don't claim to understand
> that, either. I mentioned earlier on this thread that different variables
> gave me different results, but everyone says that can't be it.
>
>
>
> Ah. Are you still chaining .values_list() to your query in the view? That
> would explain the output above.
>
> The loop is built with the assumption that we have full objects from the
> ORM, but because we chained .value_list(), we're actually getting a list of
> tuples containing two values.
>
> Your templates are built in the same manner. Can you run the second loop
> again with .values_list() removed from the query in the view?
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/xSW1BjLXXSQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciWjdFDwUPT7-60Gk1OfaejZeoFAsDXZpgXjp0mQ26C
> 30g%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/CAKd6oBzskoyggu4LBHafufPXQ1QHeuNdQiUEZbD6zRO7-fGWOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django: text, font, and style

2018-01-01 Thread Malik Rumi
 

Apparently I completely misunderstand the built in template tags {% 
autoescape &} and {% safe %}. Either they don't do what I expect, or I 
can't get them to do what I expect. But what I am trying to do is not at 
all unusual, so this post is all about learning from the community what are 
the best practices for getting this done.


Simply put, I want to be able to put some style on any arbitrary text in 
any arbitrary article on my site. 


I have tried the version of TinyMCE built into Mezzanine. I found it both 
too limiting and too complex for my purposes. I also think the idea of 
using a wysiwg editor just to make a single word bold or with  highlighting is pretty heavy handed. There must be a better 
way. What is it?


I did stumble across a snippet for a custom template tag, 
https://www.djangosnippets.org/snippets/1242/, but it is 9 years old and 
has only one comment in all that time. Although the comment is favorable, 
that's hardly what I would call a large and happy current user base. On the 
flip side, I assume this is not very different from how {% url %} works, so 
maybe it can be hacked to do what I'm talking about?


I also looked at djangopackages, and the results were disappointing. 
Django-text looked promising, but the author wrote me that it is no longer 
in active development :-(


So, all you experts out there, how do you solve this problem? Thanks.


p.s. I am comfortable with html, but CSS and javascript, not so much. 
Doesn't mean I can't or won't learn if that's your go to option, I'm just 
letting you know where I am.


p.s.s. HAPPY NEW YEAR TO ALL!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/0b700a53-7812-4a64-a690-0f606980179f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django: text, font, and style

2018-01-01 Thread Malik Rumi
I'm sorry, James. What the heck is 'steering' in this context?

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Jan 1, 2018 at 3:11 PM, James Schneider 
wrote:

>
>
>
> Have you verified that object.content contains un-escaped (raw) HTML? Is
> it possible that the steering is being escaped before it is saved?
>
>
> s/steering/string/
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/qYY7V0h2E0k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciXfmc-hPagjV24bmBH_
> ffZ6R2JscNrEnq61U96Jq9aezw%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/CAKd6oByed24Y9gphNM5LpqxMR_kd4Jdrnf3uCr3_YHCRuhCr8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django: text, font, and style

2018-01-01 Thread Malik Rumi
Mike,

Thank you, I think we are now on to something. I've heard of bleach, but
never used it and frankly forgot about it until now. I will go read up on
it. I also have never heard of Django's own mark_safe, so I will check that
out, too.

I did a little more experimenting with autoescape while waiting for these
answers, and I may now have a better grasp on how it works, but still not
so much with safe. But this is a good start. thx!

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Jan 1, 2018 at 6:00 PM, Malik Rumi  wrote:

> I'm sorry, James. What the heck is 'steering' in this context?
>
> *“None of you has faith until he loves for his brother or his neighbor
> what he loves for himself.”*
>
> On Mon, Jan 1, 2018 at 3:11 PM, James Schneider 
> wrote:
>
>>
>>
>>
>> Have you verified that object.content contains un-escaped (raw) HTML? Is
>> it possible that the steering is being escaped before it is saved?
>>
>>
>> s/steering/string/
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/django-users/qYY7V0h2E0k/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CA%2Be%2BciXfmc-hPagjV24bmBH_ffZ6R2JscNrEnq
>> 61U96Jq9aezw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXfmc-hPagjV24bmBH_ffZ6R2JscNrEnq61U96Jq9aezw%40mail.gmail.com?utm_medium=email&utm_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/CAKd6oBwFyaVJNd%3DLz4jBbpb3UCYLrz3f_QH01o2nmaO2Waqz_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django: text, font, and style

2018-01-01 Thread Malik Rumi
I even tried putting this at the top of my detail template, inside {& block
content %}:



p }

color: red;
}



But the result was the same:

This is all just to help me understand. I put this

So what am I doing wrong, here?

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Jan 1, 2018 at 2:47 PM, Malik Rumi  wrote:

> This also fails, and renders exactly as you now see it on my web page:
>
> {% autoescape off %}
> Yea, that's going to be a monster
> {% endautoescape %}
>
> *“None of you has faith until he loves for his brother or his neighbor
> what he loves for himself.”*
>
> On Mon, Jan 1, 2018 at 2:28 PM, Malik Rumi  wrote:
>
>> Well, as I said at the beginning, I don't seem to 'get' autoescape and
>> safe. For example, I put this in my template:
>>
>> {{ object.content|linebreaks|safe }}
>>
>> But the result in my web page is:
>>
>>  Friday, November 17, 2017
>>
>>  5:36 pm
>>
>>  pga4 and mezz
>>
>>  I am happy to report.
>>
>> So what am i doing wrong here? (I didn't know I could use safe in a view.
>> Haven't tried that yet.)
>>
>> *“None of you has faith until he loves for his brother or his neighbor
>> what he loves for himself.”*
>>
>> On Mon, Jan 1, 2018 at 1:32 PM, Jani Tiainen  wrote:
>>
>>> Hi.
>>>
>>> By default all strings processed through Django templating language are
>>> considered as unsafe. IOW all strings gets HTML escaped properly.
>>>
>>> To get around that you can either use safe filter or declare particular
>>> string as a safe in a view.
>>>
>>> 1.1.2018 20.47 "Malik Rumi"  kirjoitti:
>>>
>>>> Apparently I completely misunderstand the built in template tags {%
>>>> autoescape &} and {% safe %}. Either they don't do what I expect, or I
>>>> can't get them to do what I expect. But what I am trying to do is not at
>>>> all unusual, so this post is all about learning from the community what are
>>>> the best practices for getting this done.
>>>>
>>>>
>>>> Simply put, I want to be able to put some style on any arbitrary text
>>>> in any arbitrary article on my site.
>>>>
>>>>
>>>> I have tried the version of TinyMCE built into Mezzanine. I found it
>>>> both too limiting and too complex for my purposes. I also think the idea of
>>>> using a wysiwg editor just to make a single word bold or with >>> color=yellow> highlighting is pretty heavy handed. There must be a better
>>>> way. What is it?
>>>>
>>>>
>>>> I did stumble across a snippet for a custom template tag,
>>>> https://www.djangosnippets.org/snippets/1242/, but it is 9 years old
>>>> and has only one comment in all that time. Although the comment is
>>>> favorable, that's hardly what I would call a large and happy current user
>>>> base. On the flip side, I assume this is not very different from how {% url
>>>> %} works, so maybe it can be hacked to do what I'm talking about?
>>>>
>>>>
>>>> I also looked at djangopackages, and the results were disappointing.
>>>> Django-text looked promising, but the author wrote me that it is no longer
>>>> in active development :-(
>>>>
>>>>
>>>> So, all you experts out there, how do you solve this problem? Thanks.
>>>>
>>>>
>>>> p.s. I am comfortable with html, but CSS and javascript, not so much.
>>>> Doesn't mean I can't or won't learn if that's your go to option, I'm just
>>>> letting you know where I am.
>>>>
>>>>
>>>> p.s.s. HAPPY NEW YEAR TO ALL!
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> 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/ms
>>>> gid/django-users/0b700a53-7812-4a64-a690-0f606980179f%40goog
>>>&

Re: Django: text, font, and style

2018-01-01 Thread Malik Rumi
This also fails, and renders exactly as you now see it on my web page:

{% autoescape off %}
Yea, that's going to be a monster
{% endautoescape %}

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Jan 1, 2018 at 2:28 PM, Malik Rumi  wrote:

> Well, as I said at the beginning, I don't seem to 'get' autoescape and
> safe. For example, I put this in my template:
>
> {{ object.content|linebreaks|safe }}
>
> But the result in my web page is:
>
>  Friday, November 17, 2017
>
>  5:36 pm
>
>  pga4 and mezz
>
>  I am happy to report.
>
> So what am i doing wrong here? (I didn't know I could use safe in a view.
> Haven't tried that yet.)
>
> *“None of you has faith until he loves for his brother or his neighbor
> what he loves for himself.”*
>
> On Mon, Jan 1, 2018 at 1:32 PM, Jani Tiainen  wrote:
>
>> Hi.
>>
>> By default all strings processed through Django templating language are
>> considered as unsafe. IOW all strings gets HTML escaped properly.
>>
>> To get around that you can either use safe filter or declare particular
>> string as a safe in a view.
>>
>> 1.1.2018 20.47 "Malik Rumi"  kirjoitti:
>>
>>> Apparently I completely misunderstand the built in template tags {%
>>> autoescape &} and {% safe %}. Either they don't do what I expect, or I
>>> can't get them to do what I expect. But what I am trying to do is not at
>>> all unusual, so this post is all about learning from the community what are
>>> the best practices for getting this done.
>>>
>>>
>>> Simply put, I want to be able to put some style on any arbitrary text in
>>> any arbitrary article on my site.
>>>
>>>
>>> I have tried the version of TinyMCE built into Mezzanine. I found it
>>> both too limiting and too complex for my purposes. I also think the idea of
>>> using a wysiwg editor just to make a single word bold or with >> color=yellow> highlighting is pretty heavy handed. There must be a better
>>> way. What is it?
>>>
>>>
>>> I did stumble across a snippet for a custom template tag,
>>> https://www.djangosnippets.org/snippets/1242/, but it is 9 years old
>>> and has only one comment in all that time. Although the comment is
>>> favorable, that's hardly what I would call a large and happy current user
>>> base. On the flip side, I assume this is not very different from how {% url
>>> %} works, so maybe it can be hacked to do what I'm talking about?
>>>
>>>
>>> I also looked at djangopackages, and the results were disappointing.
>>> Django-text looked promising, but the author wrote me that it is no longer
>>> in active development :-(
>>>
>>>
>>> So, all you experts out there, how do you solve this problem? Thanks.
>>>
>>>
>>> p.s. I am comfortable with html, but CSS and javascript, not so much.
>>> Doesn't mean I can't or won't learn if that's your go to option, I'm just
>>> letting you know where I am.
>>>
>>>
>>> p.s.s. HAPPY NEW YEAR TO ALL!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> 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/ms
>>> gid/django-users/0b700a53-7812-4a64-a690-0f606980179f%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/0b700a53-7812-4a64-a690-0f606980179f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/django-users/qYY7V0h2E0k/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-user

Re: Django: text, font, and style

2018-01-01 Thread Malik Rumi
Well, as I said at the beginning, I don't seem to 'get' autoescape and
safe. For example, I put this in my template:

{{ object.content|linebreaks|safe }}

But the result in my web page is:

 Friday, November 17, 2017

 5:36 pm

 pga4 and mezz

 I am happy to report.

So what am i doing wrong here? (I didn't know I could use safe in a view.
Haven't tried that yet.)

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Jan 1, 2018 at 1:32 PM, Jani Tiainen  wrote:

> Hi.
>
> By default all strings processed through Django templating language are
> considered as unsafe. IOW all strings gets HTML escaped properly.
>
> To get around that you can either use safe filter or declare particular
> string as a safe in a view.
>
> 1.1.2018 20.47 "Malik Rumi"  kirjoitti:
>
>> Apparently I completely misunderstand the built in template tags {%
>> autoescape &} and {% safe %}. Either they don't do what I expect, or I
>> can't get them to do what I expect. But what I am trying to do is not at
>> all unusual, so this post is all about learning from the community what are
>> the best practices for getting this done.
>>
>>
>> Simply put, I want to be able to put some style on any arbitrary text in
>> any arbitrary article on my site.
>>
>>
>> I have tried the version of TinyMCE built into Mezzanine. I found it both
>> too limiting and too complex for my purposes. I also think the idea of
>> using a wysiwg editor just to make a single word bold or with > color=yellow> highlighting is pretty heavy handed. There must be a better
>> way. What is it?
>>
>>
>> I did stumble across a snippet for a custom template tag,
>> https://www.djangosnippets.org/snippets/1242/, but it is 9 years old and
>> has only one comment in all that time. Although the comment is favorable,
>> that's hardly what I would call a large and happy current user base. On the
>> flip side, I assume this is not very different from how {% url %} works, so
>> maybe it can be hacked to do what I'm talking about?
>>
>>
>> I also looked at djangopackages, and the results were disappointing.
>> Django-text looked promising, but the author wrote me that it is no longer
>> in active development :-(
>>
>>
>> So, all you experts out there, how do you solve this problem? Thanks.
>>
>>
>> p.s. I am comfortable with html, but CSS and javascript, not so much.
>> Doesn't mean I can't or won't learn if that's your go to option, I'm just
>> letting you know where I am.
>>
>>
>> p.s.s. HAPPY NEW YEAR TO ALL!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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/ms
>> gid/django-users/0b700a53-7812-4a64-a690-0f606980179f%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/0b700a53-7812-4a64-a690-0f606980179f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/qYY7V0h2E0k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAHn91of%3DZkDbjJGXqeRGP48_
> Xufz9ULXc8myaLiCBS%3Da1QR15w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHn91of%3DZkDbjJGXqeRGP48_Xufz9ULXc8myaLiCBS%3Da1QR15w%40mail.gmail.com?utm_medium=email&utm_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/CAKd6oBwsqoa2M7xk4z7Qhx%2BC83_LjEv1%3DXUkvoBU0_P78uH%3DKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django: text, font, and style

2018-01-01 Thread Malik Rumi
Yea, I disconnected that feature on my phone.

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Jan 1, 2018 at 7:03 PM, James Schneider 
wrote:

>
>
> On Jan 1, 2018 6:01 PM, "Malik Rumi"  wrote:
>
> I'm sorry, James. What the heck is 'steering' in this context?
>
>
> It's not, my phone auto corrected it to steering. It was supposed to be
> 'string'.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/qYY7V0h2E0k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciWXeUy8UCfkbXBaWdqETDBJL-
> D3doW80gJD-OH%3DTOn4ww%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWXeUy8UCfkbXBaWdqETDBJL-D3doW80gJD-OH%3DTOn4ww%40mail.gmail.com?utm_medium=email&utm_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/CAKd6oBwZf8aHg6LsiLS88VtXBN7hv6vDx_pTVvf1o_vD%2Bkf79g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Using Django create() on a time.field

2018-01-07 Thread Malik Rumi


I am trying to process some text files and feed the result directly into a 
django model using create(). As so often seems to happen with me, this 
turns out to not be as simple as I thought it would be. Specifically, I 
can’t seem to get any data into ‘clock’, the time field in my model. When I 
tried making the input data a string, it rejected it. When I tried making 
it a function, it told me it was expecting a string, and no version of int, 
float, or decimal got past Pylint. What is the right way to get this done, 
or do I need to do direct db inserts instead? Here is my code. Thanks.

As a string ***

from io import TextIOBase

from os import environ

import textract

import django

environ['DJANGO_SETTINGS_MODULE'] = 'chronicle.settings'

django.setup()

from ktab.models import Entry


text = textract.process('/home/malikarumi/010417_odt_tests/2018-01-01 
psycopg2-error-at-or-near.odt', encoding='utf_8')

b = TextIOBase(text)

b.write(Entry.objects.create(

   title='2018-01-01 psycopg2-error-at-or-near', content=b, 
chron_date='2018-01-05',

   clock='23:59:59'))

b.save()

(lifeandtimes) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ 
python django_textract_7.py

Traceback (most recent call last):

 File "django_textract_7.py", line 17, in 

   clock='23:59:59'))

io.UnsupportedOperation: write

--

As a function ***

from time import time, localtime

from io import TextIOBase

from os import environ

import textract

import django

environ['DJANGO_SETTINGS_MODULE'] = 'chronicle.settings'

django.setup()

from ktab.models import Entry


text = textract.process('/home/malikarumi/010417_odt_tests/2018-01-01 
psycopg2-error-at-or-near.odt', encoding='utf_8')

b = TextIOBase(text)

b.write(Entry.objects.create(

   title='2018-01-01 psycopg2-error-at-or-near', content=str(b), 
chron_date='2018-01-05',

   clock=localtime(time(

b.save()

(lifeandtimes) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ 
python django_textract_10.py

Traceback (most recent call last):

 File "django_textract_10.py", line 18, in 

   clock=localtime(time(

<...snip…>

File 
"/home/malikarumi/Projects/lifeandtimes/lib/python3.6/site-packages/django/utils/dateparse.py",
 
line 76, in parse_time

   match = time_re.match(value)

TypeError: expected string or bytes-like object

(lifeandtimes) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ 

--

As a string that evaluates to the past ***

(lifeandtimes) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ 
python django_textract_9.py

Traceback (most recent call last):

 File "django_textract_9.py", line 17, in 

   clock='04:04:04'))

io.UnsupportedOperation: write

***Back to the same old error. How can it not support writing to a single 
field when it writes to all the others? ***
Django 1.11.5 Postgres 9.4, Psycopg2, Python 3.6.3

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/94714f16-9f9d-42e6-add4-5798a9389f09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get Foreign Key Objects programmatically?

2018-02-27 Thread Malik Rumi
Did you ever find an answer? If so, do you mind sharing it? Thanks.

On Sunday, October 29, 2017 at 9:33:10 AM UTC-7, rmschne wrote:
>
> I'm using Django as front end to a MySQL database. User interface is a 
> terminal program, not a web site.
>
> I've written a very simple generic function to edit the fields of one 
> record of a Django "object".  It works fine for editing editable fields. 
> User specifies which field, then is shown the current value, raw_input() 
> for the new value, then save() the record.
>
> For fields that connect to Foreign Keys, what I want to do is present to 
> user a simple list of Foreign Key records, from which the user will pick 
> the relevant ID.  I know, given a list and the ID, how to then edit the 
> record by doing a Django get(id=ID) on the Foreign Key table.  What I'm 
> having trouble doing is figuring how
>
> 1. Identify into a variable the name of the Foreign Key table/object
> 2. Then with that variable do a call to the relevant Foreign Key table, 
> e.g. ForeignKeyTable.objects.all()
>
> See code below for <===WHAT I DO NOT KNOW HOW TO DO IN CODE Below.  I 
> think I need some Django function that gives me the foreign key table in 
> some useable generic form.
>
> Hope all this makes sense. 
>
> --rms
>
> def EditDjangoObjectData(djangoobject,show=False,editonerecord=False):
> """
> EditDjangoObjectData()
> djangoojbect=a django object, e.g. a record in a table
> """
> print "\nToDo Note: This routine not yet working on fields with 
> foreign keys!"
> changelist=[]
> ok=True
> while ok:
> change=None
> fields = [(f.name, f.editable) for f in 
> djangoobject._meta.get_fields()]
> if show:
> print "\nfields:\n",fields
> print "django object:\n",djangoobject
> s="\nEditable Fields ('enter' to return): \n"
> fieldlist=[]
> for i in fields:
> if i[1]:   # only for 'editable' fields
> if i[0].lower() <> "id":
> s=s+i[0]+", "
> fieldlist.append(i[0])
> s=s+"DELETE or '?'"
> fieldok=False
> while not fieldok:
> fieldtochange=raw_input("Enter field name to change:\n"+s+": ")
> if not fieldtochange:
> return None
> elif fieldtochange.upper()=="DELETE":
> ans=raw_input("...Confirm DELETE by typing 'DELETE': ")
> try:
> if ans=="DELETE":
> rtn=djangoobject.delete()
> print "Deleted. ",rtn
> return rtn
> except:
> print "***DELETE Failed.",sys.exc_info()[0]
> ans=raw_input("Press 'Enter' to continue ... ")
> elif fieldtochange=="?":
> PrintObjectDetails(djangoobject)
> elif fieldtochange in fieldlist:
> fieldok=True
> else:
> print "\nError. ",fieldtochange,"is not in list. Try 
> again."
> print "Current Value of Field to 
> Change:",fieldtochange,"is:",getattr(djangoobject, fieldtochange)
> **
> ** In here add some code to show a list of the foreign key records for 
> user to select, e.g. ID, Description, 
> **for r in ForeignKey.objects.all():   <== WHAT I DO NOT KNOW HOW TO DO IN 
> CODE.
> **print i.id, i.description
> **ID=raw_input("Enter ID:)
> **foreignkeyobject=ForeignKey.objects.get(id=ID)<== WHAT I DO NOT KNOW 
> HOW TO DO IN CODE.
> ** ... then put that object into the relevant field 
> newvalue=raw_input("Enter New Value: ")
> change="changed ["+fieldtochange+"]"
> print "\nTo Save   :",djangoobject
> print "The Change:",change,"to",newvalue
> if not newvalue:
> return None
> elif newvalue.lower()=="none":
> newvalue=None
> elif newvalue.lower()=="true":
> newvalue==True
> elif newvalue.lower()=="false":
> newvalue=False
> setattr(djangoobject, fieldtochange, newvalue)
> try:
> djangoobject.save()
> print ": Success. Saved:",change,"to",newvalue
> print ": New Object:",djangoobject
> changelist.append(change)
> print "ChangeList:",changelist
> except:
> print "***Save Failed.",sys.exc_info()[0]
> ans=raw_input("Press 'Enter' to continue ... ")
> if editonerecord:
> ok=False
> return changelist
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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 vis

Clarification on Foreign Keys requested

2018-03-05 Thread Malik Rumi
Hello all,

Up to now, (admittedly not long - I'm not a total newbie but I still have a 
LOT to learn) when making a foreign key I would just put the pk of that 
instance in the fk field, as the docs suggest:

By default ForeignKey will target the pk of the remote model but this behavior 
can be changed by using the ``to_field`` argument.

*https://docs.djangoproject.com/en/2.0/_modules/django/db/models/fields/related/#ForeignKey
 
*

However, recently while working with a scrapy pipeline, these fields 
started catching errors, which told me

"...must be an instance of ...(foreign object)"

And sure enough, if I did a get queryset for the one specific instance in 
question, that worked. My question is why, or maybe it should be, what's 
the difference, or maybe even, what's going on here, or wtf?

Any light you can shed on this for me would, as always, 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f9399d4-6a48-450a-b2bd-2e33a296b1b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clarification on Foreign Keys requested

2018-03-05 Thread Malik Rumi
I tried the to_field argument, that was a mistake, and I put it back.

I was just inserting the pk of the foreign object. However, as things are
moving through the pipeline, I used uuid.uuid4() to create additional pks
as needed at it went along.

Example:

def process_item(self, item, spiders):
itemcasebycase['case_arrow'] = item['uniqid']
itemcasebycase['uniqid'] = get_u

But this is what works in the pipeline:

scotus = Jurisdiction.objects.get(
uniqid='5e4dd0c2-5cc9-4d08-ab43-fcf0e84dfc44')
item['jurisdiction'] = scotus

And this is the error message I got:

ValueError: Cannot assign "UUID('5e4dd0c2-5cc9-4d08-ab43-fcf0e84dfc44')":
"Case.jurisdiction" must be a "Jurisdiction" instance

Finally, yes, under normal circumstances, my pk uuids are made
automatically. Thanks

*“None of you has faith until he loves for his brother or his neighbor what
he loves for himself.”*

On Mon, Mar 5, 2018 at 2:16 PM, Bill Freeman  wrote:

> Are you specifying the to_field argument, or are you letting it default?
>
> And is the pk of the other model made by Django by default, or are you
> explicitly specifying a foreign key constraint on some field of your own.
>
> Things might be better in 2.0, but I've had my troubles with pk that isn't
> an AutoField (such as made by default).
>
> If you're only doing the standard (defaulted) stuff, it's a mystery.
> Either way folks probably need to see some of your code to help out.
>
> On Mon, Mar 5, 2018 at 5:06 PM, Malik Rumi  wrote:
>
>> Hello all,
>>
>> Up to now, (admittedly not long - I'm not a total newbie but I still have
>> a LOT to learn) when making a foreign key I would just put the pk of that
>> instance in the fk field, as the docs suggest:
>>
>> By default ForeignKey will target the pk of the remote model but this 
>> behavior
>> can be changed by using the ``to_field`` argument.
>>
>> *https://docs.djangoproject.com/en/2.0/_modules/django/db/models/fields/related/#ForeignKey
>> <https://docs.djangoproject.com/en/2.0/_modules/django/db/models/fields/related/#ForeignKey>
>> *
>>
>> However, recently while working with a scrapy pipeline, these fields
>> started catching errors, which told me
>>
>> "...must be an instance of ...(foreign object)"
>>
>> And sure enough, if I did a get queryset for the one specific instance in
>> question, that worked. My question is why, or maybe it should be, what's
>> the difference, or maybe even, what's going on here, or wtf?
>>
>> Any light you can shed on this for me would, as always, 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/5f9399d4-6a48-450a-b2bd-2e33a296b1b5%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/5f9399d4-6a48-450a-b2bd-2e33a296b1b5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/GDuwEZXyQ3k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAB%2BAj0vGREMexQPAg8tpAaMP_3iL8QNPCk9WbQFZSZ9hrsksHw%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAB%2BAj0vGREMexQPAg8tpAaMP_3iL8QNPCk9WbQFZSZ9hrsksHw%40mail.gmail.com?utm_medium=email&utm_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/CAKd6oBzJcSgdBfD3AJ0oY-Sg1pQjYF3yzt5kV5QB%3DZzxMC0iTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multi-table Inheritance: How to add child to parent model?

2016-06-22 Thread Malik Rumi
This thread is obviously very old, but since it helped me find the answer, 
I thought I would share that for the benefit of others mystified by the 
lack of information on 
https://docs.djangoproject.com/en/1.9/topics/db/models/#multi-table-inheritance.
 


It turns out that although Derek's link to the docs was way out of date 
(the page does not exist anymore) his solution was still close to correct. 
The full documentation can be found here: 
https://docs.djangoproject.com/en/1.9/topics/db/examples/one_to_one/



On Thursday, November 4, 2010 at 1:25:25 PM UTC-7, Nan wrote:
>
> I have an existing model that I want to extend using multi-table 
> inheritance.  I need to create a child instance for each parent 
> instance in the database, but I can't figure out how.  I've scoured 
> google and haven't come up with anything other than Ticket #7623[1]. 
> Here are some of the things I've tried... 
>
> Let's adapt the Place / Restaurant example from the docs: 
>
> class Place(models.Model): 
> name = models.CharField(max_length=50) 
> address = models.CharField(max_length=80) 
>
> class Restaurant(Place): 
> place = models.OneToOneField(Place, parent_link=True, 
> related_name='restaurant') 
> serves_hot_dogs = models.BooleanField() 
> serves_pizza = models.BooleanField() 
>
> I want to do the following, in essence: 
>
> for place in Place.objects.all(): 
>   restaurant = Restaurant(**{ 
> 'place': place, 
> 'serves_hot_dogs': False, 
> 'serves_pizza': True, 
>   }) 
>   restaurant.save() 
>
> Of course, doing this tries to also create a new Place belonging to 
> the new Restaurant, and throws an error because no values have been 
> specified for the name and address fields.  I've also tried: 
>
> for place in Place.objects.all(): 
>   restaurant = Restaurant(**{ 
> 'serves_hot_dogs': False, 
> 'serves_pizza': True, 
>   }) 
>   place.restaurant = restaurant 
>   place.save() 
>
> This, however, doesn't create any records in the restaurant table. 
>
> Any suggestions? 
>
> [1] http://code.djangoproject.com/ticket/7623 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/59c7977a-697c-4218-9f6d-157330267f66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


"canonical" views.py in Django Unleashed book, Chapter 22

2016-06-29 Thread Malik Rumi
Although I love the book (so far) for its level of detail and addressing a 
LOT of issues I am currently dealing with, I have run across a problem. 
Specifically, the views.py and urls.py in the github repo are NOT the same 
as the snippets of views.py and urls.py in the book. Now, since I started 
in Chapter 20, because that's where my issues are, it is possible that all 
of this is explained and cleared up elsewhere, but a quick search in the 
online version of the book did not reveal same to me, so,as the author 
himself asks, I am posting here. 

Github views.py

starting at line 128:
@class_login_required 
class ProfileDetail( 
ProfileGetObjectMixin, DetailView): 
model = Profile


views.py book example 22.13
 26   from core.utils import UpdateView
...
134   @class_login_required
135   class ProfileUpdate(
136   ProfileGetObjectMixin, UpdateView)
:137   fields = ('about',)
138   model = Profile

There is no core.utils or UpdateView in the github version


views.py in book example 22.19
134   class PublicProfileDetail(DetailView):
135   model = Profile

There is no PublicProfileDetail in the github version


urls.py in book example 22.20
 10   from .views import ( 
11   ActivateAccount, CreateAccount, 
12   DisableAccount, ProfileDetail, ProfileUpdate, 
13   PublicProfileDetail, ResendActivationEmail)  .   
... 
67   urlpatterns = [  .  
 ...
114   url(r'^(?P[\w\-]+)/$',
115   PublicProfileDetail.as_view(),
116   name='public_profile'),
117   ]

Again, there is no PublicProfileDetail in the github version, which stops 
at line 111

There may be more, but that's what I have right now. It does not make sense 
to me that the author would go to all this trouble to talk about Public 
Profiles and then omit them, especially since allowing users to both have 
them and edit them themselves makes so much sense. Now, I do have the code 
from the book, which is why I framed my question as the "canonical" version 
of these codes. 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/cf3568a8-5190-4c92-8e9b-9c88b612e14a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "canonical" views.py in Django Unleashed book, Chapter 22

2016-06-30 Thread Malik Rumi
1. I don't know if it makes any difference, but I don't have the physical 
book. I am reading it online thru my safarionline subscription.
2. Once I got to your repo, I just clicked around to go to views or urls or 
whatever. I didn't think of looking for different commits, because I 
assumed, wrongly, that there would only be one, final, 'canonical' version 
of the code.
3. Looking specifically at urls.py on githhub, I can now see that the link 
you pointed me to is at a different url and has a different commit than the 
one I had looked at. Compare

https://github.com/jambonrose/DjangoUnleashed-1.8/blob/a1d420b17a/user/urls.py
https://github.com/jambonrose/DjangoUnleashed-1.8/blob/83167965e86b82a86a25504c82285dccd79b9e32/user/urls.py

So that must be the issue. Not sure what you can do about that except put a 
lot of notes in the repo. Cloning the whole thing is probably a good idea.

For your marketing fyi, I found out about you and the book after looking at 
your DjangoCon talk about the request response cycle. It so happens I have 
an immediate need to swap out the default user, so those chapters were 
right on time for me. 

Thanks. 

On Wednesday, June 29, 2016 at 5:13:42 PM UTC-7, Malik Rumi wrote:
>
> Although I love the book (so far) for its level of detail and addressing a 
> LOT of issues I am currently dealing with, I have run across a problem. 
> Specifically, the views.py and urls.py in the github repo are NOT the same 
> as the snippets of views.py and urls.py in the book. Now, since I started 
> in Chapter 20, because that's where my issues are, it is possible that all 
> of this is explained and cleared up elsewhere, but a quick search in the 
> online version of the book did not reveal same to me, so,as the author 
> himself asks, I am posting here. 
>
> Github views.py
>
> starting at line 128:
> @class_login_required 
> class ProfileDetail( 
> ProfileGetObjectMixin, DetailView): 
> model = Profile
>
>
> views.py book example 22.13
>  26   from core.utils import UpdateView
> ...
> 134   @class_login_required
> 135   class ProfileUpdate(
> 136   ProfileGetObjectMixin, UpdateView)
> :137   fields = ('about',)
> 138   model = Profile
>
> There is no core.utils or UpdateView in the github version
>
>
> views.py in book example 22.19
> 134   class PublicProfileDetail(DetailView):
> 135   model = Profile
>
> There is no PublicProfileDetail in the github version
>
>
> urls.py in book example 22.20
>  10   from .views import ( 
> 11   ActivateAccount, CreateAccount, 
> 12   DisableAccount, ProfileDetail, ProfileUpdate, 
> 13   PublicProfileDetail, ResendActivationEmail)  .   
> ... 
> 67   urlpatterns = [  .  
>  ...
> 114   url(r'^(?P[\w\-]+)/$',
> 115   PublicProfileDetail.as_view(),
> 116   name='public_profile'),
> 117   ]
>
> Again, there is no PublicProfileDetail in the github version, which stops 
> at line 111
>
> There may be more, but that's what I have right now. It does not make 
> sense to me that the author would go to all this trouble to talk about 
> Public Profiles and then omit them, especially since allowing users to both 
> have them and edit them themselves makes so much sense. Now, I do have the 
> code from the book, which is why I framed my question as the "canonical" 
> version of these codes. 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/5c7186c9-6caf-42c4-a062-f9d58798a3e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "canonical" views.py in Django Unleashed book, Chapter 22

2016-06-30 Thread Malik Rumi
p.s. -

I did have a couple of other questions, if you don't mind:

1. You end 22.6 by saying

In an actual website, you likely won’t interact with the auth in the way we 
> have. You’ll rely on third-party apps to provide object-level permissions 
> or else on authentication with other services such as Twitter and Facebook. 
>

I found that surprising, but then I'm somewhat isolated so don't claim to 
know what other folks are doing. Why is this the common practice? Just to 
save time because the tools are available?

2. In 22.5, you recommended a static url for profile pages.  Quite apart 
from how often people may update their pages, I didn't understand why you 
suggest that for an otherwise dynamic website. I guess I just assumed 
static urls and static (or 'flat'. as Django likes to call them) pages go 
together, like About Us, and that such pages would be the exception. Was 
this just to make the profiles easy to find and/or bookmark for end users?

Thanks again.




On Wednesday, June 29, 2016 at 5:13:42 PM UTC-7, Malik Rumi wrote:
>
> Although I love the book (so far) for its level of detail and addressing a 
> LOT of issues I am currently dealing with, I have run across a problem. 
> Specifically, the views.py and urls.py in the github repo are NOT the same 
> as the snippets of views.py and urls.py in the book. Now, since I started 
> in Chapter 20, because that's where my issues are, it is possible that all 
> of this is explained and cleared up elsewhere, but a quick search in the 
> online version of the book did not reveal same to me, so,as the author 
> himself asks, I am posting here. 
>
> Github views.py
>
> starting at line 128:
> @class_login_required 
> class ProfileDetail( 
> ProfileGetObjectMixin, DetailView): 
> model = Profile
>
>
> views.py book example 22.13
>  26   from core.utils import UpdateView
> ...
> 134   @class_login_required
> 135   class ProfileUpdate(
> 136   ProfileGetObjectMixin, UpdateView)
> :137   fields = ('about',)
> 138   model = Profile
>
> There is no core.utils or UpdateView in the github version
>
>
> views.py in book example 22.19
> 134   class PublicProfileDetail(DetailView):
> 135   model = Profile
>
> There is no PublicProfileDetail in the github version
>
>
> urls.py in book example 22.20
>  10   from .views import ( 
> 11   ActivateAccount, CreateAccount, 
> 12   DisableAccount, ProfileDetail, ProfileUpdate, 
> 13   PublicProfileDetail, ResendActivationEmail)  .   
> ... 
> 67   urlpatterns = [  .  
>  ...
> 114   url(r'^(?P[\w\-]+)/$',
> 115   PublicProfileDetail.as_view(),
> 116   name='public_profile'),
> 117   ]
>
> Again, there is no PublicProfileDetail in the github version, which stops 
> at line 111
>
> There may be more, but that's what I have right now. It does not make 
> sense to me that the author would go to all this trouble to talk about 
> Public Profiles and then omit them, especially since allowing users to both 
> have them and edit them themselves makes so much sense. Now, I do have the 
> code from the book, which is why I framed my question as the "canonical" 
> version of these codes. 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/b9f5f11e-c6b5-4c2d-b0fe-097005294486%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Unleashed, custom user model

2016-07-05 Thread Malik Rumi
Hello, Andrew

All of our Tag, Startup, NewsLink, and Post will be right back in the 
database thanks to our data migrations. Example 22.40


Why? a) you dumped the whole database, and b) you only did makemigrations 
for the User app.

we opt to remove the CreateModel operation for Profile and move it into its 
own migration file. Example 22.39


I followed your example, but got this error

*CommandError: Conflicting migrations detected; multiple leaf nodes in the 
migration graph: (0002_profile, 0001_user in account). To fix them run 
'python manage.py makemigrations –merge'*

What happened here? The only obvious difference between your examples and 
mine is the Python version, and I don't see how that's relevant here. It 
seems to be purely a Django migrations thing.

thx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/41d9d43e-84a8-4233-a8c6-faa7d9d42c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Unleashed, custom user model

2016-07-07 Thread Malik Rumi
Waited as long as I thought I could to hear from you. So here's my result:

(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py 
makemigrations --merge

Traceback (most recent call last):

…

raise ValueError("Could not find common ancestor of %s" % migration_names)

ValueError: Could not find common ancestor of set([u'0002_profile', 
u'0001_user'])

(...so I re-merged them back into a single document...)

(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py 
makemigrations account
No changes detected in app 'account'
(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py migrate
Operations to perform:
  Apply all migrations: admin, account, contenttypes, auth, sessions
Running migrations:
  Rendering model states... DONE
  Applying account.0001_initial... OK
The following content types are stale and need to be deleted:

auth | user

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

Type 'yes' to continue, or 'no' to cancel: no
(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ 

I thought you should be aware of these differing results. 

On Tuesday, July 5, 2016 at 6:49:01 PM UTC-7, Malik Rumi wrote:
>
> Hello, Andrew
>
> All of our Tag, Startup, NewsLink, and Post will be right back in the 
> database thanks to our data migrations. Example 22.40
>
>
> Why? a) you dumped the whole database, and b) you only did makemigrations 
> for the User app.
>
> we opt to remove the CreateModel operation for Profile and move it into 
> its own migration file. Example 22.39
>
>
> I followed your example, but got this error
>
> *CommandError: Conflicting migrations detected; multiple leaf nodes in the 
> migration graph: (0002_profile, 0001_user in account). To fix them run 
> 'python manage.py makemigrations –merge'*
>
> What happened here? The only obvious difference between your examples and 
> mine is the Python version, and I don't see how that's relevant here. It 
> seems to be purely a Django migrations thing.
>
> thx
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/be050074-7844-47d8-8e24-03bb85e73053%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TemplateSyntaxError at /

2016-07-09 Thread Malik Rumi

Invalid template name in 'extends' tag: ''. Got this from the 'baseX.html' 
variable.

The first line in index.html is: 
{% extends baseX.html %}



I got this error when trying out a new template package I bought. I thought 
it was telling me something was wrong with the name of the base template 
being extended, but changing the name numerous times always brings the same 
error. 

I tried using a functional view instead, but I still got the same error. 

Debug Toolbar says:

Templates
>
> index.html
> /home/malikarumi/Projects/cannon/jamf/static/index.html
> ▶ Toggle context
> None
> 
>

That's when I figured out that the error was with baseX itself. The 
traceback points to line 141 in loader_tags.py, which is the get_parent 
function:


def get_parent(self, context):
parent = self.parent_name.resolve(context)
if not parent:
error_msg = "Invalid template name in 'extends' tag: %r." % 
parent
if self.parent_name.filters or\
isinstance(self.parent_name.var, Variable):
error_msg += " Got this from the '%s' variable." %\
self.parent_name.token
raise TemplateSyntaxError(error_msg)
if isinstance(parent, Template):
# parent is a django.template.Template
return parent
if isinstance(getattr(parent, 'template', None), Template):
# parent is a django.template.backends.django.Template
return parent.template
return self.find_template(parent, context)



Both baseX and index are in the same folder. Somehow Django has decided my 
baseX is not a django.template.django.Template. I don't know what makes a 
template qualify as a django.Template, and wasn't able to find anything on 
that. baseX is a pre-made template I liked and bought online. The designer 
doesn't know anything about Django. As far as I can tell, it is just html, 
css, and javascript, like any other template. It is bootstrap, just like 
the template I was using before. I have searched around, there's lots of 
stuff about templates in general, but I haven't found anything on this 
particular issue. 

I did come across django-bootstrap3, but I see no reason why that's 
required to use bootstrap. I didn't have it with the previous bootstrap 
theme I was using and that worked. 

Your insights appreciated.
ubuntu 15.10, Python 2.7.10, Django 1.9.1, Bootstrap 3.3.6

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/6c528bab-c13e-4a37-8fab-eb6bfd11c263%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Tutor / Teacher

2016-07-09 Thread Malik Rumi
Where can I find a well qualified Django expert to work with me one on one 
on my site? I'm willing to pay, of course. I looked at Codementor, but once 
I picked several people, I got this "so and so has not been responding 
recently,...". I'd rather have someone in my time zone (California) and 
with good English skills. 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/ae8abc78-3244-45c5-a6e4-d50dfcbffe15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: TemplateSyntaxError at /

2016-07-09 Thread Malik Rumi
God damn. That was it - something silly and obvious, but only to a fresh
set of eyes. Thank you!

On Sat, Jul 9, 2016 at 6:44 PM, James Schneider 
wrote:

>
> On Jul 9, 2016 6:38 PM, "Malik Rumi"  wrote:
> >
> >
> > Invalid template name in 'extends' tag: ''. Got this from the
> 'baseX.html' variable.
> >
> > The first line in index.html is:
> > {% extends baseX.html %}
> >
>
> Try adding quotes around "baseX.html", your referring to it as a variable,
> not as the name of the template.
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/Wm5gJTbSD8Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXZHCechLYWnP8ewkr9H%3D0asJne7KRMQjH1OsvXyYUgPQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXZHCechLYWnP8ewkr9H%3D0asJne7KRMQjH1OsvXyYUgPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

"Every time you see a black kid wearing a hoodie, you say: There's a thug.
If you see a white kid wearing hoodie, you say: There's Mark Zuckerberg,"
Jones told USA TODAY
<http://www.usatoday.com/story/tech/2015/01/19/van-jones-yes-we-code-diversity-technology/21889543/>
last
year.

"I said, 'That's because of racism. And Prince said, 'Maybe so, *or maybe
you civil rights guys haven't created enough Mark Zuckerbergs.' "*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/CAKd6oByt5ahfSsk91F041qHnBc9McPODtpGPT%2B%3DCR31_dPe4_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


static files suspicious operation, os error, and list of paths

2016-07-11 Thread Malik Rumi
Well, I'm stuck again. I am still trying to get my dev site to work with 
this new bootstrap theme. Debug toolbar is telling me over 1,000 
staticfiles have been found, but none were used. So if they are found, why 
aren't they used? I ran findstatic and got this traceback:

(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py 
> findstatic /static/bootstrap/css/bootstrap.css
> Traceback (most recent call last):
> 
>   File 
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/utils/_os.py",
>  
> line 78, in safe_join
> 'component ({})'.format(final_path, base_path))
> django.core.exceptions.SuspiciousFileOperation: The joined path 
> (/static/bootstrap/css/bootstrap.css) is located outside of the base path 
> component (/home/malikarumi/Projects/cannon/jamf/static)
> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ 
>


So I took '/static' off the front of the path, because in my settings I 
have:

STATICFILES_DIRS = [
> os.path.join(BASE_DIR, 'static'),
>

and I thought perhaps that was causing a problem, but it made no 
difference:

django.core.exceptions.SuspiciousFileOperation: The joined path 
(/bootstrap/css/bootstrap.css) is located outside of the base path 
component (/home/malikarumi/Projects/cannon/jamf/static)


Then, following 
https://docs.djangoproject.com/en/1.9/ref/settings/#staticfiles-dirs, I 
made a list of all the paths with bootstrap stuff in them, but then I got a 
new error:

  File 
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>  
> line 299, in listdir
> for entry in os.listdir(path):
> OSError: [Errno 2] No such file or directory: 
> '/home/Projects/cannon/jamf/static/bootstrap'
>

Note, the string in STATICFILES_DIRS does have the slash after bootstrap, 
but that seems to make no difference:

   '/home/Projects/cannon/jamf/static/bootstrap/',

   
Finally, taking yet another look at the docs, I took the os.dir line out 
and made it another path in the list, but still that made no difference:

  File 
> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>  
> line 299, in listdir
> for entry in os.listdir(path):
> OSError: [Errno 2] No such file or directory: 
> '/home/Projects/cannon/jamf/static'
>

   
Need I also say the directory does in fact exist? What's going on here? 
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/4ca8a3ac-9646-4b30-b950-20ac0402f8c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-11 Thread Malik Rumi
yes.

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'



On Monday, July 11, 2016 at 2:56:06 PM UTC-7, Malik Rumi wrote:
>
> Well, I'm stuck again. I am still trying to get my dev site to work with 
> this new bootstrap theme. Debug toolbar is telling me over 1,000 
> staticfiles have been found, but none were used. So if they are found, why 
> aren't they used? I ran findstatic and got this traceback:
>
> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py 
>> findstatic /static/bootstrap/css/bootstrap.css
>> Traceback (most recent call last):
>> 
>>   File 
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/utils/_os.py",
>>  
>> line 78, in safe_join
>> 'component ({})'.format(final_path, base_path))
>> django.core.exceptions.SuspiciousFileOperation: The joined path 
>> (/static/bootstrap/css/bootstrap.css) is located outside of the base path 
>> component (/home/malikarumi/Projects/cannon/jamf/static)
>> (cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ 
>>
>
>
> So I took '/static' off the front of the path, because in my settings I 
> have:
>
> STATICFILES_DIRS = [
>> os.path.join(BASE_DIR, 'static'),
>>
> 
> and I thought perhaps that was causing a problem, but it made no 
> difference:
>
> django.core.exceptions.SuspiciousFileOperation: The joined path 
> (/bootstrap/css/bootstrap.css) is located outside of the base path 
> component (/home/malikarumi/Projects/cannon/jamf/static)
>
>
> Then, following 
> https://docs.djangoproject.com/en/1.9/ref/settings/#staticfiles-dirs, I 
> made a list of all the paths with bootstrap stuff in them, but then I got a 
> new error:
>
>   File 
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>>  
>> line 299, in listdir
>> for entry in os.listdir(path):
>> OSError: [Errno 2] No such file or directory: 
>> '/home/Projects/cannon/jamf/static/bootstrap'
>>
>
> Note, the string in STATICFILES_DIRS does have the slash after bootstrap, 
> but that seems to make no difference:
>
>'/home/Projects/cannon/jamf/static/bootstrap/',
>
>
> Finally, taking yet another look at the docs, I took the os.dir line out 
> and made it another path in the list, but still that made no difference:
>
>   File 
>> "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/files/storage.py",
>>  
>> line 299, in listdir
>> for entry in os.listdir(path):
>> OSError: [Errno 2] No such file or directory: 
>> '/home/Projects/cannon/jamf/static'
>>
>
>
> Need I also say the directory does in fact exist? What's going on here? 
> 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/faf2b2eb-c8b1-4084-a5a6-cc82ea2d1369%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-12 Thread Malik Rumi
UPDATE:

I got it back to where runserver comes up and I get no errors, but the 
staticfiles are still not being served. 


The paths are in the right *format* to satisfy the STATICFILES_DIR in 
SETTINGS, and so that they can be *found*, according to debug toolbar, and 
they *pass* the checks in runserver, collectstatic, and findstatic, but not 
so they can be *used*. 


I have to assume that safe_join is still running around somewhere in the 
background, even though it is now failing silently. 


I need to make safe join see these paths the same way it saw the single 
file bootstrap.css when it passed findstatic, but I don't know how to do 
that. 


One could ask why I get all those 404's from runserver, but I think that's 
explained by the fact that safe_join is still blocking them. 

Ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/310bc4fc-c7ec-4fac-aea4-aac1db2546ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-12 Thread Malik Rumi
Michal,

> , it looks like somewhere, you're calling ``os.path.join(a, b)``, where
the second argument starts with a slash

I've tried it both ways. The way I got findstatic to work was by taking off
the leading slash, but so far I haven't figured out how to make that work
so that the files are called.

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'essell',
'csvimport2',
'debug_toolbar',
'account',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'static/bootstrap'),
os.path.join(BASE_DIR, 'static/bootstrap/css/'),
os.path.join(BASE_DIR, 'static/bootstrap/fonts/'),
os.path.join(BASE_DIR, 'static/bootstrap/js/'),
os.path.join(BASE_DIR, 'static/css/'),
os.path.join(BASE_DIR, 'static/email_templates/'),
os.path.join(BASE_DIR, 'static/fonts/'),
os.path.join(BASE_DIR, 'static/images/'),
os.path.join(BASE_DIR, 'static/js/'),
os.path.join(BASE_DIR, 'static/less/'),
os.path.join(BASE_DIR, 'static/plugins/'),
    os.path.join(BASE_DIR, 'static/videos/'),
]

# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'




On Tue, Jul 12, 2016 at 3:03 AM, Michal Petrucha <
michal.petru...@konk.org> wrote:

> On Tue, Jul 12, 2016 at 12:40:11AM -0700, Malik Rumi wrote:
> > UPDATE:
> >
> > I got it back to where runserver comes up and I get no errors, but the
> > staticfiles are still not being served.
> >
> >
> > The paths are in the right *format* to satisfy the STATICFILES_DIR in
> > SETTINGS, and so that they can be *found*, according to debug toolbar,
> and
> > they *pass* the checks in runserver, collectstatic, and findstatic, but
> not
> > so they can be *used*.
> >
> >
> > I have to assume that safe_join is still running around somewhere in the
> > background, even though it is now failing silently.
> >
> >
> > I need to make safe join see these paths the same way it saw the single
> > file bootstrap.css when it passed findstatic, but I don't know how to do
> > that.
> >
> >
> > One could ask why I get all those 404's from runserver, but I think
> that's
> > explained by the fact that safe_join is still blocking them.
> >
> > Ideas?
>
> Could you please post all the settings that are in any way related to
> static files in full? That means things like STATICFILES_*, and
> everything that's used in those (like BASE_DIR, etc). Please, don't
> leave any part of them out. If you are not certain, just post the
> entire settings module, only remove secret values.
>
> Also, could you provide the exact URL of a request that is resulting
> in a SuspiciousFileOperation, including a full traceback?
>
> Based on the error message you posted in the initial post, it looks
> like somewhere, you're calling ``os.path.join(a, b)``, where the
> second argument starts with a slash – that might be the reason, but
> it's hard to tell whether this is the case, because you haven't shown
> us the full settings.
>
> Cheers,
>
> Michal
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/MoWUYN4SJmk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to thi

Django Multi Table Inheritance and Preserving Child and Child History

2016-08-30 Thread Malik Rumi
Note: I originally posted this 
to 
http://dba.stackexchange.com/questions/147680/django-multi-table-inheritance-and-preserving-child-and-child-history,
 
 but 7 days and ZERO responses is not working for me. 

Place can have many different one to one fields, that’s why it can have 
bookstore, restaurant, and hardware store. But can the same place be both a 
bookstore and a restaurant at the same time? Now if the bookstore and 
restaurant tables don't have the same pk as place, I would think the answer 
is yes. But I also know that unless you put parent_link=True on it, erasing 
the child row automatically deletes the parent row.


My use case is to preserve the history of Restaurant despite it’s having 
now become a Bookstore, and if a Restaurant is simultaneously a Bookstore, 
to be able to keep both places in my db. Is the best way to do this with a 
fk to each of the bookstores, restaurants and hardware stores instead of 
either a OneToOne or multi table inheritance? Or is there some other way 
I’m not aware of? 


This has to be a solved problem, but so far I haven't found it. I'm 
currently looking at NFL databases because players can be on more than one 
team, (albeit not at the same time), and they have a recorded history of 
their team and individual stats - to see if I can hack those into what I 
want.


I'm even willing to consider an ArrayField or Hstore. I'm on Postgres 9.4 
and trying to maintain 3NF. All wisdom accepted. 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/3be1a01c-5682-429b-b461-0cfbcccbc795%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Model Inheritance across apps

2016-09-29 Thread Malik Rumi
Assume two models, class Parent(models.Model): and Child(Parent):

Assume they are both in the same Project

Can Child be in a different app than Parent? In most cases the answer seems 
to be yes.

Each app has many other models to which Parent and Child, respectively, are 
closely tied - which is why they are in those apps.

If so, what is the best practices way of doing so, and

how does one avoid or minimize circular imports?

For example, if Child.models.py imports Parent in order to facilitate the 
inheritance, what do you do if another model in Parent.models.py has a fk 
to another model in Child.models.py?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/01251136-3cfb-4069-862c-78e118475958%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Context * 3

2016-12-16 Thread Malik Rumi
 

Greetings, sports fans.

There is an old saying, three strikes and you're out. They also say the 
third time is the charm. Let’s see which one this is for me, shall we?


This is the 3rd time in the last two years that I have been stuck for more 
than a few *days* on a problem getting my data onto a template. (I’m 
obviously not a full time developer). Although the symptom is the same, 
they do not all seem to be precisely the same cause, but I don’t think that 
matters. What matters here is that clearly, I just plain don’t understand 
context. It seems like a simple concept, but I can’t seem to execute it 
*routinely 
and effectively*. 


Here’s my view:


#!/usr/bin/python
#-*- coding: utf-8 -*- 

from django.shortcuts import render 
from .models import Jurisdiction 

def statehome(request, twodigit): 
 state = Jurisdiction.objects.all() 
 ace = 'spades' 
 context={'state':state, 'ace':ace} 
 return render (request, 'statehome.html', context)



Twodigit is just the postal code that I use in the url. Nothing related to 
state or jurisdiction displays on the template. I put ‘ace’ in there just 
as a test, and ‘spades’ shows up bright and bold just like it should. Here 
is the relevant portion of the template:

 {{state.name}}{{ ace }}


this is what I get in the shell:


In [23]: J=Jurisdiction.objects.all()

In [27]: for state in J: 
 ...: print(state.name) 
 ...: 
United States of America 
Alabama 
Alaska 
Arizona 
...etc…



It is not called for in this particular template, but I decided to put a 
for loop in there, too, just to test it:


{% for state in states %}

{{ state.name }}

{% endfor %}


You guessed it! Nothing.


According to Django Debug Toolbar, I have this context in my template:


{'ace': 'spades', 'state': '<>'}


But that same Toolbar also says I only executed two sql queries: one for 
the session and one for the user.


Earlier, I discovered that *a queryset of one is not the same as a single 
objec*t, and that it always helps to get the right name of your object:


In [3]: Jurisdiction.objects.filter(name="United States")

Out[3]: 



In [5]: Jurisdiction.objects.get(name="United States")

DoesNotExist: Jurisdiction matching query does not exist.


In [6]: Jurisdiction.objects.get(name="United States of America")

Out[6]: 


In [7]: us=Jurisdiction.objects.get(name="United States of America")


In [8]: us.name

Out[8]: 'United States of America'


So when I used ‘get’ instead of ‘filter’ in my view, it worked. But that 
does *not* solve my problem.* What happens when I want a list of objects? **Or 
several different objects and their attributes? Isn’t that supposed to be a 
queryset? Then how do I make them show up in the template? Why does my for 
loop and state.name work in the shell with objects.all(), but neither works 
in the template?*


I don’t understand. I’m sure it is staring me right in the face, and is 
obvious to you, but *I just plain don’t get it*. So if I could get an 
explanation, and a how to, that would be great. And if you can point to a 
book, website, tutorial, whatever – not the official docs, thank you, I can 
recite them in my sleep and clearly I’m not getting it – that explains all 
this slowly, step by step, big picture and little picture, with examples 
and an explanation of vocabulary, that would be really great. Thanks. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11932523-c612-4938-bb27-0bd1527e3ed8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Context * 3

2016-12-16 Thread Malik Rumi
Dylan,

I would name my firstborn after you, but she's gotten used to her name 
already. ;-). THANK YOU!

On Friday, December 16, 2016 at 10:37:07 AM UTC-8, Dylan Reinhold wrote:
>
> In your view you have state singular and in your template you are looping 
> on states plural.
>
> Dylan
>
> On Fri, Dec 16, 2016 at 10:02 AM, Malik Rumi  > wrote:
>
>> Greetings, sports fans.
>>
>> There is an old saying, three strikes and you're out. They also say the 
>> third time is the charm. Let’s see which one this is for me, shall we?
>>
>>
>> This is the 3rd time in the last two years that I have been stuck for 
>> more than a few *days* on a problem getting my data onto a template. 
>> (I’m obviously not a full time developer). Although the symptom is the 
>> same, they do not all seem to be precisely the same cause, but I don’t 
>> think that matters. What matters here is that clearly, I just plain don’t 
>> understand context. It seems like a simple concept, but I can’t seem to 
>> execute it *routinely and effectively*. 
>>
>>
>> Here’s my view:
>>
>>
>> #!/usr/bin/python
>> #-*- coding: utf-8 -*- 
>>
>> from django.shortcuts import render 
>> from .models import Jurisdiction 
>>
>> def statehome(request, twodigit): 
>>  state = Jurisdiction.objects.all() 
>>  ace = 'spades' 
>>  context={'state':state, 'ace':ace} 
>>  return render (request, 'statehome.html', context)
>>
>>
>>
>> Twodigit is just the postal code that I use in the url. Nothing related 
>> to state or jurisdiction displays on the template. I put ‘ace’ in there 
>> just as a test, and ‘spades’ shows up bright and bold just like it should. 
>> Here is the relevant portion of the template:
>>
>>  {{state.name}}{{ ace }}
>>
>>
>> this is what I get in the shell:
>>
>>
>> In [23]: J=Jurisdiction.objects.all()
>>
>> In [27]: for state in J: 
>>  ...: print(state.name) 
>>  ...: 
>> United States of America 
>> Alabama 
>> Alaska 
>> Arizona 
>> ...etc…
>>
>>
>>
>> It is not called for in this particular template, but I decided to put a 
>> for loop in there, too, just to test it:
>>
>>
>> {% for state in states %}
>>
>> {{ state.name }}
>>
>> {% endfor %}
>>
>>
>> You guessed it! Nothing.
>>
>>
>> According to Django Debug Toolbar, I have this context in my template:
>>
>>
>> {'ace': 'spades', 'state': '<>'}
>>
>>
>> But that same Toolbar also says I only executed two sql queries: one for 
>> the session and one for the user.
>>
>>
>> Earlier, I discovered that *a queryset of one is not the same as a 
>> single objec*t, and that it always helps to get the right name of your 
>> object:
>>
>>
>> In [3]: Jurisdiction.objects.filter(name="United States")
>>
>> Out[3]: 
>>
>>
>>
>> In [5]: Jurisdiction.objects.get(name="United States")
>>
>> DoesNotExist: Jurisdiction matching query does not exist.
>>
>>
>> In [6]: Jurisdiction.objects.get(name="United States of America")
>>
>> Out[6]: 
>>
>>
>> In [7]: us=Jurisdiction.objects.get(name="United States of America")
>>
>>
>> In [8]: us.name
>>
>> Out[8]: 'United States of America'
>>
>>
>> So when I used ‘get’ instead of ‘filter’ in my view, it worked. But that 
>> does *not* solve my problem.* What happens when I want a list of 
>> objects? **Or several different objects and their attributes? Isn’t that 
>> supposed to be a queryset? Then how do I make them show up in the template? 
>> Why does my for loop and state.name <http://state.name> work in the shell 
>> with objects.all(), but neither works in the template?*
>>
>>
>> I don’t understand. I’m sure it is staring me right in the face, and is 
>> obvious to you, but *I just plain don’t get it*. So if I could get an 
>> explanation, and a how to, that would be great. And if you can point to a 
>> book, website, tutorial, whatever – not the official docs, thank you, I can 
>> recite them in my sleep and clearly I’m not getting it – that explains all 
>> this slowly, step by step, big picture and little picture, with examples 
>> and an explanation of vocabulary, that would be really great. Thanks. 
>>
>> -- 
>> You rec

Dynamic querysets?

2016-12-16 Thread Malik Rumi
 

I already got one fast and helpful answer today, so I’m going to be greedy 
and press my luck.


I have this website. Each state has their own home/landing page off the 
site’s main page, and from there you will be able to get detail pages about 
various tidbits about the state of your choice. I have implemented this 
with a urlconf that looks for the state’s 2 digit postal name:


 url(r'^(?P[A-Z]{2})', include('bench.urls', namespace=twodigit)),

It will come as no surprise that the views and templates associated with 
each state are identical. However, in order to be DRY, I wanted the view to 
take the twodigit argument from the url and call the right state’s 
queryset. To this end, I created a dict
{'AK': 'Alaska', 
'AL': 'Alabama', 
'AR': 'Arkansas', 
...etc…}


naively thinking I would be able to do something like


for k,v in statedict:
 if twodigit == k: 
 state = Jurisdiction.objects.get(v)


However, this does not work. I’m not sure why. Here are some of the various 
results I’ve gotten as I tried tweaking it:
for k,v in statedict: 
 if 'VA' == k: # I was thinking of this as almost a default value 
 state = Jurisdiction.objects.get(v)


However, this gets an unbound local error because of the scope, and I don’t 
know how to assign the variable so that it is accessible outside the scope 
of the for loop.


k='NE' 
print(v) 
k=="US" 
print(v)


returned

U 
U


Clearly, there is no ‘U’ in Nebraska, so I don’t know what happened there.


This works


print(statedict['US'])
(aishah) malikarumi@Tetuoan2:~/Projects/aishah/jamf35$ python statedict.py 
United States 


But this does not


File "statedict.py", line 63, in 
 if statedict['k']: 
KeyError: 'k'


And this


for k, v in statedict:
 if k: 
 print('v')


Gets me a ‘v’ for every state.


Variations on


Jurisdiction.objects.filter(statedict[’v']) and
 Jurisdiction.objects.filter(name='v’)


also failed, and nothing I have found on the internet has helped. Ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/8bc1bfcb-4de5-45c9-b447-d1290e20c4d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What Did I Do Right? (url and domain name change)

2015-08-06 Thread Malik Rumi
I have 1 model from my django project up and running on django. Before 
adding more models and content, I wanted to use my actual domain name, 
instead of whatever.herokuapp.com. So after I got that straight, I realized 
that while the home page was mysite.com, the links were still 
mystite.herokuapp.com, which I think is a problem. But I also thought there 
had to be an easy fix for this, especially after I saw a post while I was 
searching for solutions that said django only cares about the stuff that 
comes *after* the domain name. So the first thing I did was change a 
hardcoded link in my navbar from mysite.herokuapp/newpage to mysite/newpage 
in my dev site. But testing it the url still said 
mysite.herokuapp.com/newpage. Then I got an idea, and I just manually 
changed the url to mysite/newpage and what do you know, it came up 
correctly. then I clicked around and suddenly all the pages on my model are 
coming up that way, which they were not half an hour ago. So the question: 
What did I do right?

Here are my working theories:

1. The dns change, which I also did half an hour ago, worked for the home 
page immediately (I tested it at the time) but needed to propagate more for 
the other pages to work, which they do now.

2. By changing the url manually, django just fed the pages as requested 
without concern about the domain part of the url. If I start from 
mysite.herokuapp.com home page, the links still come up with that domain 
name.

But how do I make this both universal and permanent?

A. I could change allowed hosts setting, taking the herokuapp part out

B. Do nothing, it works now and I should leave well enough alone.

C. ? Your answer here ...


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/3ded9a89-b20f-489d-aadb-667ab62fdb53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What Did I Do Right? (url and domain name change)

2015-08-07 Thread Malik Rumi
I like the 'definitely not' to the do nothing option. Thanks to both of you!

On Thu, Aug 6, 2015 at 5:41 PM, Aaron C. de Bruyn 
wrote:

> 1. DNS doesn't really work that way in most situations.  Your browser
> should cache it, your computer should cache it (especially Windows),
> and your upstream DNS (usually your router) should cache it.  Your
> computer literally stores 'mysite.com' = '1.2.3.4'.  It doesn't store
> it per-page, but for the whole domain name.
>
> 2. How are the URLs generated in your application?  If your HTML
> template literally has:  http://mysite.herokuapp.com/{% url
> 'home' %}">Home pagethen the only way to update the URLs for
> your app would be to edit the template and fix them.  If you are
> relying on django-sites to 'know' the base URL for your site, go into
> the admin section and click on 'Sites'.  I think it's best practice to
> not prefix my URLs with http://whatever...  Just use {% url 'home' %}
> as it should return something like '/' for the URL (without
> http://mysite.com).
>
> A. Your ALLOWED_HOSTS setting should probably have both domains if you
> want your transition to be smooth.  (i.e. the site works through both
> URLs).  ALLOWED_HOSTS has no affect on what URLs you application
> displays.
>
> B. Definitely not.  Tweak, break, learn.  ;)
>
> Hope that helps.
>
> -A
>
>
> On Thu, Aug 6, 2015 at 2:03 PM, Malik Rumi  wrote:
> > I have 1 model from my django project up and running on django. Before
> > adding more models and content, I wanted to use my actual domain name,
> > instead of whatever.herokuapp.com. So after I got that straight, I
> realized
> > that while the home page was mysite.com, the links were still
> > mystite.herokuapp.com, which I think is a problem. But I also thought
> there
> > had to be an easy fix for this, especially after I saw a post while I was
> > searching for solutions that said django only cares about the stuff that
> > comes after the domain name. So the first thing I did was change a
> hardcoded
> > link in my navbar from mysite.herokuapp/newpage to mysite/newpage in my
> dev
> > site. But testing it the url still said mysite.herokuapp.com/newpage.
> Then I
> > got an idea, and I just manually changed the url to mysite/newpage and
> what
> > do you know, it came up correctly. then I clicked around and suddenly all
> > the pages on my model are coming up that way, which they were not half an
> > hour ago. So the question: What did I do right?
> >
> > Here are my working theories:
> >
> > 1. The dns change, which I also did half an hour ago, worked for the home
> > page immediately (I tested it at the time) but needed to propagate more
> for
> > the other pages to work, which they do now.
> >
> > 2. By changing the url manually, django just fed the pages as requested
> > without concern about the domain part of the url. If I start from
> > mysite.herokuapp.com home page, the links still come up with that domain
> > name.
> >
> > But how do I make this both universal and permanent?
> >
> > A. I could change allowed hosts setting, taking the herokuapp part out
> >
> > B. Do nothing, it works now and I should leave well enough alone.
> >
> > C. ? Your answer here ...
> >
> >
> > 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/3ded9a89-b20f-489d-aadb-667ab62fdb53%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/OMkN_I__30Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEE%2BrGrft480OFiVv2%3DMLCqxZ

null datetime field and json fixtures

2016-02-16 Thread Malik Rumi
There are a ton of answers to this question out there - if you can wade 
through all the ones that refer to forms and not models. The consensus 
seems to be that datetime has to be set to both blank=true and null=true. 
And when I put in one test row of data manually through the admin, I could 
leave my datetime field blank with no problems. But when I tried to load 
the 89 other instances through a fixture, I got error after error.

As near as I can tell, if you leave a json value blank, loaddata says it 
isn't a json document. But if you put the empty string, '', Null, None, 
"Null", "None" or "-00-00" in there, it is rejected as not valid date 
format. Therefore, it seems there is no way to do this through a fixture. 
My question: Is this correct? If so, is there any alternative to doing it 
all manually? 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/db367bcf-8cbf-4001-8976-f602e93576d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-17 Thread Malik Rumi
First, thank you to both Avraham and James. In my view, it isn't said often
enough on the internet, and I've had many questions go without a response
at all. So please understand that I mean it very much when I say I deeply
appreciate the time you took to help me.

Now as to the matter at hand: The field in question is 'sunsetdate',
referring to the date something ends. It must be optional since most of my
objects/data don't, or haven't, ended. The first time I tried this I had
the empty string, '', in all rows in that column.

(cannon)malikarumi@Tetuoan2:~/Projects/cannon/jamf$ python manage.py
loaddata essell/fixtures/test22byhand.json

Traceback (most recent call last):

File
"/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/serializers/python.py",
line 174, in Deserializer

 raise base.DeserializationError.WithData(e, d['model'],
d.get('pk'), field_value)

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
[u"'' value has an invalid date format. It must be in -MM-DD format."]:
(essell.Code:pk=None) field_value was ''

I replaced “”, - the empty string - with ',', that is, nothing, no string,
no quote, nothing but the comma

File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode

raise ValueError("No JSON object could be decoded")

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
No JSON object could be decoded

So now I assume this is because there are no quotes on sunsetdate. Note how
that one error in that one field makes the whole document 'not json'.

Now I have to put the date in the way they want it, which is not what I
want but not the end of the world since I don't have to display this field
if there is no actual sunset date.

File
"/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/core/serializers/python.py",
line 174, in Deserializer

 raise base.DeserializationError.WithData(e, d['model'],
d.get('pk'), field_value)

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
[u"'null' value has an invalid date format. It must be in -MM-DD
format."]: (essell.Code:pk=None) field_value was 'null'

django.core.serializers.base.DeserializationError: Problem installing
fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
[u"'-00-00' value has the correct format (-MM-DD) but it is an
invalid date."]: (essell.Code:pk=None) field_value was '-00-00'

Last night before posting I hacked serializers/python.py to make an
exception for sunsetdate, and that apparently worked, but now I have this:

File
"/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
line 2390, in get_db_prep_value

 value = uuid.UUID(value)

 File "/usr/lib/python2.7/uuid.py", line 134, in __init__

 raise ValueError('badly formed hexadecimal UUID string')

ValueError: Problem installing fixture
'/home/malikarumi/Projects/cannon/jamf/essell/fixtures/test22byhand.json':
badly formed hexadecimal UUID string

The only uuid currently in this fixture is the one I got from Django when I
put another model (only one row) in with a fixture (no date field) and it
worked. I needed the uuid of that object to put into the foreign key of the
model I am having trouble with now.

Finally, this morning after reading your responses I decided to try putting
in null with no comma, since I had already tried it with no quotes, and of
course that didn't work. But then in fooling with it I put null in right
next to the colon, with no spaces or quotes, followed by a comma, and this
time null turned blue in my code editor, which suggests it was working. But
then I got the 'badly formed hexadecimal UUID string error again.

In sum, there is a special syntax to using null which is not obvious, but
thanks for making me take another look and try again. The uuid error seems
to be something else. There is a bugfix on github from November of 2014, so
I don't (yet) know why I'm having this issue. I may post that later as a
separate question. Thanks again!

On Wed, Feb 17, 2016 at 3:51 AM, James Schneider 
wrote:

>
>
> On Tue, Feb 16, 2016 at 4:35 PM, Malik Rumi 
> wrote:
>
>> There are a ton of answers to this question out there - if you can wade
>> through all the ones that refer to for

Github v code.djangoproject for bug reports

2016-02-18 Thread Malik Rumi
Does it matter if a bug is reported to one and not the other? Is there any 
difference between the two? Do the issue tracking numbers between the two 
line up?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/94622ce2-0ed0-4c6b-9c5d-dc8a2a947a56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-18 Thread Malik Rumi
James,

I used csvkit csvkit.readthedocs.org/en/latest/index.html to convert the 
csv to json.

On Wednesday, February 17, 2016 at 7:05:59 PM UTC-6, James Schneider wrote:
>
>
>> The uuid.UUID() function is somewhat forgiving when it comes to providing 
> values. See https://docs.python.org/3.5/library/uuid.html. Does the UUID 
> in your JSON data match any of those formats? The only common format for a 
> UUID that I've seen that doesn't match any of those formats would be 
> '----' which is a string that contains 
> dashes, but no surrounding braces. I believe that's the format that is 
> pulled when using UUID's from Django installations by default. I'm actually 
> surprised the Python UUID library doesn't support it, but maybe it's one of 
> those RFC things that specifies the formats that must be accepted.
>

Okay, THIS really bothers me for a couple of reasons. 1) Yes, my uuids are 
in the 8-4-4-4-12 format. 2) Yes, this comes from using the uuidfield as 
recommended in the 
docs https://docs.djangoproject.com/es/1.9/ref/models/fields/#uuidfield 3) 
You're right, this 8-4-4-4-12 format IS NOT on the Python docs page you 
referred me to. 

How can Django say this is based on the Python uuid module when it does not 
comply? What GOOD is it if it does not comply? Now maybe there is some 
internal workings that hack a valid Python format. My guess is UUID(
'urn:uuid:12345678-1234-5678-1234-567812345678'). It wouldn't be that hard 
to strip off the urn:uuid, and I know for a fact, because I've seen it with 
my own eyes, there is code to strip out the dashes. But essentially you are 
saying that my problems are NOT JSON (which I had started to suspect 
anyway, see 
http://stackoverflow.com/questions/35463713/badly-formed-hexadecimal-uuid-string-error-in-django-fixture-json-uuid-conversi
 
 2nd Update. But you also seem to be saying this is not a bug, but a 
'feature', because Django knows their uuid format does not comply. But that 
doesn't make sense to me. How is it to be effectively used without 
universal Python compliance? Why isn't this lack of compliance documented? 
What is the workaround, or does it just mean junk the Django uuid 
altogether as not ready for prime time and save yourself days and days of 
work, like the days I wasted all last week on this thing?!
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/4810488c-0464-4709-9d55-f7a547a7f8dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >