Re: Create ModelForms to create ModelForms

2017-08-02 Thread bobhaugen
We're using Fobi in https://github.com/FreedomCoop/valuenetwork
Works pretty well. Does what it promises. Dev has been responsive to issues.

On Wednesday, August 2, 2017 at 5:55:21 AM UTC-5, Thiago Luiz Parolin wrote:
>
> Hi,
> Try using this app:
> Django-fobi https://github.com/barseghyanartur/django-fobi
>
> I've never used it, but it looks very promising.
>
> 2017-08-01 21:15 GMT-03:00 Shazia Nusrat  >:
>
>> I need to create a frontend app where I can use forms to create forms 
>> such as Google Surveys or Survey Monkey kind of application. Can someone 
>> point me to any reusable app or something similar or someone can guide me 
>> that would be a great help.
>>
>> Regards,
>>
>> Shazia
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAD83tOzVsD004ZO%3Ddu%3DGZnpPnAScKxqm9mdks%2BjLCmhV4x1BKQ%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/eb670990-f179-4b41-949e-b4eac42477c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-cruds-adminlte 0.0.4 is out

2017-05-10 Thread bobhaugen

On Tuesday, May 9, 2017 at 1:04:41 PM UTC-5, Óscar M. Lage wrote:
>
> I would like to say that django-cruds-adminlte 0.0.4 is out (
> https://github.com/oscarmlage/django-cruds-adminlte). We're requesting 
> for collaboration but if not (dunno what happens, maybe the goal of the 
> project is not too attractive for the community) I would be so pleased to 
> receive any kind of opinion, comment or feedback from your side.
>
>
I plan to try both this and django-cruds some time in the next month. Will 
ping when I do. 

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


Re: Testing a Django library

2017-03-21 Thread bobhaugen
Very interesting topic. We will be facing the same problem soon, and will 
hope to learn from your experience. Got a code repository yet?
We're at https://github.com/django-rea
If and when we have some good answers, I'll report back here.

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


Re: Request for advice on refactoring a big Django project

2017-03-07 Thread bobhaugen
> But don't be dismayed if no one responds. 

I'm not at all dismayed, and knew it was a shot in the dark, but might as 
well try for somebody who likes to discuss Django refactoring, or might be 
interested in the stuff we are building. And thanks again for the responses 
to my question about why no responses. 

On Monday, March 6, 2017 at 10:10:53 AM UTC-6, mark wrote:
>
> I echo Vijay's comment. Lists like this are really great for very specific 
> questions and short code segments or error message that a more experienced 
> person can answer off the top of their head. Your question is very broad 
> and requires a large time commitment from the reader to respond. With that 
> said, there is nothing wrong with posting your question as you may get 
> someone who has some free time to dive in and try to help. Or someone who 
> has done a lot of refactoring and can give you some pointers. But don't be 
> dismayed if no one responds. 
>
> You could also rephrase your question to be more like "I am in the process 
> of refactoring a large project. What recommendations would you make as far 
> as how to tackle this project? We built the project using Django x.x.x, so 
> where would you recommend we start with this project." More along the lines 
> of best practices for refactoring django projects, or what has the reader 
> learned after refactoring django projects. This question does not require 
> the reader to dive into your code, but to relate what they know about the 
> topic. Easier and much less time consuming for the reader.
>
> You could also offer to pay someone to help kick start your project, and 
> then if someone responds, take the discussion offline.
>
> As you refactor the project and run into issues, be sure to post those 
> very specific questions and short code segments/error message to the list. 
> The folks here are very friendly, extremely knowledgeable, and very willing 
> to help as long as you make it super easy for them to help you figure out 
> the answer to a specific question.
>
> God luck!
>
> Mark. 
>
> On Mon, Mar 6, 2017 at 5:13 AM, Vijay Khemlani <vkhe...@gmail.com 
> > wrote:
>
>> Also, this type mailing lists are usually for specific questions about
>> the framework
>>
>> "How do I make this particular query with the ORM"
>> "Why isn't this variable getting rendered in the template"
>>
>> etc
>>
>> Your question is kinda broad
>>
>> On 3/6/17, Bob Haugen <bob.h...@gmail.com > wrote:
>> > Antonis, thank you very much for the feedback! You are absolutely
>> > correct! I apologize to you and the list, and will strive to follow
>> > your suggestions in the future.
>> >
>> > I suspect, however, that the very long explanation that would have
>> > been required to avoid the links would have been offputting, too. This
>> > might be a request that was just inappropriate for this list.
>> >
>> > As for now, we're charging happily ahead.
>> >
>> > On Mon, Mar 6, 2017 at 5:45 AM, Antonis Christofides
>> > <ant...@djangodeployment.com > wrote:
>> >> Hi,
>> >>
>> >> I, like many people, am busy. I will generally not spend too much time 
>> on
>> >> the messages of this list. I delete most of them after only reading the
>> >> subject line. If I do choose to read the body, I expect to understand
>> >> what
>> >> it is about after a few seconds of reading. But all I can see in your
>> >> original message is that you have a big Django project that needs
>> >> refactoring, and several links with the code and your discussions about
>> >> them. Essentially the message I'm getting is "I can't tell you what I
>> >> want
>> >> in this email message, but if you click on these links and study them 
>> for
>> >> about half an hour, you'll get it".
>> >>
>> >> Likewise, it would have been way better to include your original 
>> message
>> >> in
>> >> the reply. In order to find your original message I had to dig in my
>> >> Trash
>> >> folder. I would normally not do that, and I would have ignored your 
>> reply
>> >> as
>> >> well. It just happens that I'm travelling and I'm quite relaxed.
>> >>
>> >> Bottom line: you need to make it very easy for me to help you, and I
>> >> believe
>> >> the same goes for other people as well.
>> >>
>> >> Regards,
>> >>
>> >> Antonis
>> >>
>> &g

Re: Request for advice on refactoring a big Django project

2017-03-06 Thread bobhaugen
I was disappointed to get no response on this topic, and would be grateful 
for any feedback on why that might have been.

Too big? Big ball of mud? Stupid project? ? (I have very little 
touchiness...)

I hope people did not think we wanted to get them to do all or even very 
much work for us. We are charging ahead here:
https://github.com/django-rea

We did find, and are using, some delicious advice from Marty Alchin:
http://martyalchin.com/2008/jan/10/simple-plugin-framework/
And upgrading to the latest version of django, changing to class-based 
views, and breaking up both models and views into several files.

Next: a bunch of abstract base classes.

After that: more API work and a mobile app to use 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/a3e12fd2-fc27-447a-a5f5-e394c3d67cff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Request for advice on refactoring a big Django project

2017-02-23 Thread bobhaugen


Dear Django people,


We are working on an open-source Django system that has grown both in terms 
of user and developer communities and also size of code base. It is in 
production with 370 users that we know of.


It has several names, but one is NRP, which stands for Network Resource 
Planning system, as contrasted with ERP, which stands for Enterprise 
Resource Planning. NRP has the same scope as ERP, but is for economic 
networks, not single enterprises. And it is aimed at communities who are 
experimenting with cooperative economic systems.


We want to refactor the system. It has become too big and unmanagable. So 
we are looking for advice on how to refactor.


Here's the original repo: https://github.com/valnet/valuenetwork which is 
being used byhttp://www.sensorica.co/
Here are the active forks:
* https://github.com/FreedomCoop/valuenetwork used by 
https://freedomcoop.eu/
* https://github.com/gopacifia/DEEP planning to be used by 
http://gopacifia.org/en/


Here's an overview slide deck of the the original system. The forks have 
added other features, including digital currencies.
https://speakerdeck.com/mikorizal/1-nrp-overview


We think if we refactor this software, many of the features could be 
reusable by other projects that are not necessarily aimed at the same kinds 
of user communities. For example, any supply chain or business joint 
venture is an economic network, and many LLCs are actually networks under 
the covers. Moreover, we think that economic networks and ecosystems are 
the wave of the future, more than individual companies. But some of the 
features of this software base would also be useable by individual 
organizations.


The system is based on the Resource-Event-Agent (REA) model 
, 
which is a much simpler basis for business systems than the usual ERP 
model. Here's how REA applies to supply chains 
, for 
example.


Here's our current discussion about how to do the refactoring: #215 



Anyway, we will be grateful for any advice, and if anybody wants to help, 
that would be even better.

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


Re: Moving from django 1.3 to 1.9

2017-01-27 Thread bobhaugen
I agree with all the advice to go a step at a time. 

Here's a bunch of clues and chatter in github issues about how we upgraded 
from 1.4 to 1.8, one minor version at a time.
https://github.com/FreedomCoop/valuenetwork/issues?q=is%3Aclosed+label%3Aupgrade

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


Re: Maintaining old django code

2016-09-06 Thread bobhaugen
We migrated a huge codebase from 1.4 to 1.8 like this:
https://github.com/FreedomCoop/valuenetwork/issues?q=is%3Aissue+is%3Aclosed+label%3Aupgrade
 

Might give you some clues. Short version: one release at a time.

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


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread bobhaugen
Michal, thanks for following up.

I'll try your suggested code from your other response upthread and see if 
it solves the problem as well as the form.__init__.

And do more digging about how Python does things. I am a self-taught 
programmer who focuses on community economic development and I usually just 
learn as much about software as I need to do what I want to do. Sometimes 
that is not enough learning...;-)

On Friday, August 19, 2016 at 8:13:08 AM UTC-5, Michal Petrucha wrote:
>
> On Fri, Aug 19, 2016 at 02:38:02PM +0200, Michal Petrucha wrote: 
> > On Fri, Aug 19, 2016 at 05:02:39AM -0700, bobhaugen wrote: 
> > > On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote: 
> > > These questions remain unanswered, although I intend to do a bunch 
> more 
> > > testing: 
> > > 
> > >1. How pervasive is this problem? Does it affect template variables 
> like 
> > >{{ object.foreign_key_method }} where the foreign_key_method 
> returns a 
> > >queryset? 
> > >2. Is this behavior clearly documented anywhere? 
> > 
> > Honestly, I'm not sure what exactly you're asking here. Your 
> > implementation of ``with_user`` was hard-wiring a queryset filter 
> > based on the state of the database at the time ``with_user`` was 
> > called. The rest is just standard Python behavior – since the method 
> > was called during import (in the ModelForm definition), the result of 
> > that call was used for the rest of the process' lifetime. 
>
> Actually, let me rephrase that. This problem you encountered here 
> wasn't a case of “you need to set the ``queryset`` argument of 
> ``ModelChoiceField`` in your form's ``__init__``,” but rather a case 
> of “don't do too much filtering in your Python code – let your 
> database do the filtering”. 
>
> Using ``__init__`` to set the queryset is not really a very standard 
> thing to do. It's just a workaround to make a form work if it uses a 
> manager or queryset method that does not behave entirely correctly. 
>
> Does this help make things at least a little bit clearer? 
>
> Michal 
>

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


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread bobhaugen
On Friday, August 19, 2016 at 7:38:45 AM UTC-5, Michal Petrucha wrote:
>
> Honestly, I'm not sure what exactly you're asking here. Your 
> implementation of ``with_user`` was hard-wiring a queryset filter 
> based on the state of the database at the time ``with_user`` was 
> called. The rest is just standard Python behavior – since the method 
> was called during import (in the ModelForm definition), the result of 
> that call was used for the rest of the process' lifetime. 
>
 
Ok, so from your response and that of Coues Ludovic upthread, I clearly 
need to study Python more deeply. Will do.

Thanks for all the responses.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/bde5f813-155b-438b-9850-4311be2541b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread bobhaugen
On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote:
>
> Could you show us the code of with_user? Maybe it does not return an 
> unevaluated queryset? 
>
>  
def with_user(self):
all_agents = EconomicAgent.objects.all()
ua_ids = []
for agent in all_agents:
if agent.users.all():
ua_ids.append(agent.id)
return EconomicAgent.objects.filter(id__in=ua_ids)

Moving the call to with_user to form.__init__ solved the problem in the 
form ModelChoiceField.

These questions remain unanswered, although I intend to do a bunch more 
testing:

   1. How pervasive is this problem? Does it affect template variables like 
   {{ object.foreign_key_method }} where the foreign_key_method returns a 
   queryset?
   2. Is this behavior clearly documented anywhere?

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


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-18 Thread bobhaugen
Yes, that's what I did. It worked for the form field.

But, still, how pervasive is this behavior? (That was the question in the 
message you answered).

On Thursday, August 18, 2016 at 2:18:00 PM UTC-5, Sergiy Khohlov wrote:
>
> Hello,
> This is trivial mistake. Use form.__init__ if you would like to change it 
> dynamically
>
> 18 серп. 2016 22:14 "bobhaugen" <bob.h...@gmail.com > пише:
>
>> Also, how pervasive is this behavior? Does it affect all querysets 
>> generated by model methods? I do that all over the place. This could be bug 
>> heaven!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/16924d52-c9e7-4666-b80d-7baaa49e59e7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/16924d52-c9e7-4666-b80d-7baaa49e59e7%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-18 Thread bobhaugen
Also, how pervasive is this behavior? Does it affect all querysets 
generated by model methods? I do that all over the place. This could be bug 
heaven!

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


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-18 Thread bobhaugen
Looks like it works if I "specify queryset=None when declaring the form 
field and then populate the queryset in the form’s__init__() method:"

Does that make sense to you?

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


Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-18 Thread bobhaugen
On Thursday, August 18, 2016 at 1:34:29 PM UTC-5, Tim Graham wrote:
>
> I'd guess you're doing a query for the form field's choices at the module 
> level which will be executed once and cached for as long as the server 
> runs. See if 
> https://docs.djangoproject.com/en/stable/ref/forms/fields/#fields-which-handle-relationships
>  
> helps, otherwise please post the code for the form in question.
>
> Ohhh, Tim! You might just have nailed it! Yes I am.

Here's the relevant code for the form field:
 
```
from_agent = forms.ModelChoiceField(
required=False,
queryset=EconomicAgent.objects.with_user(),
```

with_user() is a method of
class AgentManager(models.Manager)


 executed once and cached for as long as the server runs.
>

Is that behavior documented anywhere? Regardless, got any ideas how to 
avoid it?

But thank you very much for the likely suspect. 

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


Odd problem: some database updates do not appear on other pages until server restart

2016-08-18 Thread bobhaugen
I'm running django 1.8.14, I have an odd problem, that I have reproduced 
both locally using runserver and sqlite, and also using Apache with 
Postgres.

I create a new model instance on one page, and go to another page where 
that same object should appear in a form selection list. It does not.

After I restart the server (both with runserver and Apache) it appears.

I also see other places where the same odd behavior with template variables 
showing  foreign key relationships, like {{ object.foreign_key_field }}.

This is not on all pages, just some. It happens in both of the situations I 
mentioned above (form selection choices and template variables for foreign 
key fields).

I grepped for cache. None in my code, a lot in site-packages, but I have no 
idea where to look and what to look for.

I would gratefully follow any clues.

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/e3d375e3-dffd-43f7-a7ea-409a15e5381c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8.13 saving new user gets error NOT NULL constraint failed: auth_user.last_login

2016-07-21 Thread bobhaugen
Hah! You are right! My fault.

On Thursday, July 21, 2016 at 11:55:29 AM UTC-5, Simon Charette wrote:
>
> If you upgraded from Django 1.7 you should make sure to run all auth 
> migrations.
>
> If you're using a custom user model make sure to makemigrations for its 
> app and proceed to migrate it.
>
> Simon
>
> Le jeudi 21 juillet 2016 11:46:37 UTC-4, bobhaugen a écrit :
>>
>> NOT NULL constraint failed: auth_user.last_login
>>>
>>>
>>>
>> This is a new user. Why should it have a last_login value? 
>>
>> I coded around it by giving the new user a fictitious last_login value, 
>> but still...
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/2866e047-43e6-4801-86a7-e5cbb2a115d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.8.13 saving new user gets error NOT NULL constraint failed: auth_user.last_login

2016-07-21 Thread bobhaugen

>
> NOT NULL constraint failed: auth_user.last_login
>
>
>
This is a new user. Why should it have a last_login value? 

I coded around it by giving the new user a fictitious last_login value, but 
still...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/10b0a641-0557-4602-954c-95892b526be2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrating an unmigrated database from 1.6 to 1.7

2016-07-07 Thread bobhaugen
Thank you all for all your suggestions and your quick responses. I think 
the 1.6-South idea would work, and likewise adding the field by hand using 
SQL. 

Problem with sqlmigrate is that all we got now is the initial migration, 
with all the fields. We don't have a django migration for the new field, 
that's back in South and 1.6.

In the meantime, I charged ahead with a dump, recreated db, and reloaded 
the data. Had to comment out the new field temporarily to do the dump. 
I do feel slightly dirty, but have done worse. I think it's ok, but we're 
doing a bunch of testing.

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


Migrating an unmigrated database from 1.6 to 1.7

2016-07-07 Thread bobhaugen
We're upgrading an app from django 1.4 step-by-step through all the 
versions at least to 1.8. Got a self-inflicted problem with the new 
migrations in 1.7.

Before we went to 1.7, we added a new field to a model, and migrated the db 
using South. Then when we went to 1.7, we restarted all the migrations.

Unfortunately, we had one database that did not get the South migration 
with the new field.

When we merge in the new code with the new field and try a migrate on the 
unmigrated database, it does nothing. I suppose because all we got now is 
the new-in-1.7 initial migration.

And of course when I try to run the new code against the unmigrated db, I 
get an error about the missing field.

I know we did wrong to leave that db unmigrated. But do we have any options 
for recovery now? Other than dump the data, recreate the db, and reload?

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


Re: Hi - I'm new to Python and DJango

2016-06-13 Thread bobhaugen
On Thursday, June 2, 2016 at 9:30:46 AM UTC-5, luisza14 wrote:
>
>
> There is some development in ERP but nothing stable or usable (not that I 
> known).
>
> So if you are interested in develop something could be great know about.   
>
 
>

This is NRP (Network Resource Planning), not ERP, but it was developed by 
people with deep ERP experience.
https://github.com/valnet/valuenetwork

Sortof a proof of concept, but it works and is being used in production by 
two networks with more getting started. 

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


Re: Django API CSRF Issues - Need Help

2016-05-21 Thread bobhaugen
Chris, I understood you were logged into the django system when you tried 
these posts. Correct? I thought that would cover authentication thru DRF. 
But I am also a noob to Javascript client post -> DRF server.

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


Re: Migrating older 1.4 project to 1.9

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

On Tuesday, March 29, 2016 at 4:19:59 PM UTC-5, Roger Dunn wrote:
>
> I've inherited a moderately large project written 2 years ago using Django 
> 1.4, and wondering if it is worth creating a fresh 1.9 project and porting 
> in the old code, or doing an in-place upgrade to 1.9?
>
> I have it running on 1.4 'as is' but if I run* python manage.py migrate* 
> it comes unglued as a lot of stuff has changed since 1.4.
>
>
>
>

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


Re: Django Forms vs Angularjs

2016-03-22 Thread bobhaugen
Maybe you already know this, but you can do a lot of form tinkering in 
__init__, like so:

def __init__(self, permissions_parameter=None, *args, **kwargs):
super(FormName, self).__init__(*args, **kwargs)
if permissions_parameter:
#do a bunch of form tinkering

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


Re: Django Forms vs Angularjs

2016-03-19 Thread bobhaugen
Questions interspersed below:

On Friday, March 18, 2016 at 11:38:59 AM UTC-5, Gorkem Tolan wrote:
>
> I am a new comer to Django. Last four weeks I have been working on web 
> application purely created with Django framework. 
> I realized that Django forms are very cumbersome to use. 
>

What is cumbersome about them? Can you post some of your form code that you 
find cumbersome? Maybe you are doing something that is more complicated 
than it needs to be.

My experience with Django forms is that they get something up and running 
very quickly and very easily and run into problems when I try to do 
something more complicated. And then the main problem for me is if I have a 
lot of forms on the same page: the page starts to render very slowly. But 
the code is still fairly simple.
 

> I'd rather have DRF (rest framework) and just angularjs form. I am sure 
> alot users will bombard me tons of oppositions. 
>

DRF is awesome!  If you are more familiar with Angular than Django, it 
might be a good way for you to go.

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


Re: Scaling Django

2016-02-04 Thread bobhaugen
This is a sidelight to the OP, but he did mention django forms in one 
message. They are a dog. I have profiled a couple of slow pages with a lot 
of small forms and that's where all the time was spent (rendering forms on 
the server). We're moving those to DRF-serving-json to a javascript 
client-side framework. Not done yet, but the same data from DRF is way 
faster.

I would still be interested in some tips for speeding up django forms, 
though, because they are really great for speed of development, and they do 
work.

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


Re: Windows browser vs Django app running on Ubuntu in a VirtualBox

2015-12-06 Thread bobhaugen
Remco, thanks a lot for the response, and your answer makes sense to me. 
Unfortunately, I am not Chris, and I do not have a Windows box, so I need 
to wait until he gets time to try it out to validate it. But when he 
responds, I will, This is just to thank you for your answer and let you 
know that a proper response will be forthcoming.

On Saturday, December 5, 2015 at 4:10:17 PM UTC-6, Remco Gerlich wrote:
>
> He is running it with "./manage.py runserver", which listens to the local 
> interface only (the 127.0.0.1 IP address).
>
> To get it to listen to the external address instead, use "./manage.py 
> runserver 192.168.56.101:8000" and then it will work. Or "0.0.0.0:8000" 
> to listen to all interfaces.
>
> Greetings,
> Remco Gerlich
>
> On Sat, Dec 5, 2015 at 10:07 PM, bobhaugen <bob.h...@gmail.com 
> > wrote:
>
>> Our friend Chris Troutner installed our Django 1.4 app on Windows  in 
>> a VirtualBox running Ubuntu.
>>
>> He could access the Django app from the browser in Ubuntu, but not from 
>> the Windows browser.
>>
>> He writes:
>>
>>- While you can access the front end in the Ubuntu VM, you can't 
>>access it from the windows desktop. You should be able to by pointing 
>> your 
>>Windows browser at http://192.168.56.101:8000, but that didn't work 
>>for me. 192.168.56.101 was the IP address Virtual Box assigned to its 
>>Host-Adapter. I can ping that address and SSH to it, but I can't bring up 
>>Django.
>>
>>This is most likely a simple fix with the network settings, but as of 
>>this writing, I haven't figured out a fix yet.
>>
>> Here's his whole story: 
>> http://christroutner.com/blog/post/open-value-networks
>>
>> Anybody got any ideas so he can finish the story? 
>> Thanks for any help you can offer.
>>
>> -- 
>> You received this message because you are subscribed 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/3cc31a21-fd27-4f3f-a4a7-767a028b72b5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/3cc31a21-fd27-4f3f-a4a7-767a028b72b5%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/699c00d5-536f-4b3c-9b4a-875e06db6c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Windows browser vs Django app running on Ubuntu in a VirtualBox

2015-12-05 Thread bobhaugen
Our friend Chris Troutner installed our Django 1.4 app on Windows  in 
a VirtualBox running Ubuntu.

He could access the Django app from the browser in Ubuntu, but not from the 
Windows browser.

He writes:

   - While you can access the front end in the Ubuntu VM, you can't access 
   it from the windows desktop. You should be able to by pointing your Windows 
   browser at http://192.168.56.101:8000, but that didn't work for me. 
   192.168.56.101 was the IP address Virtual Box assigned to its Host-Adapter. 
   I can ping that address and SSH to it, but I can't bring up Django.
   
   This is most likely a simple fix with the network settings, but as of 
   this writing, I haven't figured out a fix yet.

Here's his whole 
story: http://christroutner.com/blog/post/open-value-networks

Anybody got any ideas so he can finish the story? 
Thanks for any help you can offer.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/3cc31a21-fd27-4f3f-a4a7-767a028b72b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Timer for online examination

2015-11-18 Thread bobhaugen
That should have been runTimer and retryTimer

On Tuesday, November 17, 2015 at 7:43:02 AM UTC-6, bobhaugen wrote:
>
> On Tuesday, November 17, 2015 at 12:29:02 AM UTC-6, Arindam sarkar wrote:
>>
>> I am developing an online examination website. And having difficulty 
>> implementing the timer .
>> Any one have done it or something related to countdown timer in django ?
>>
>>
> Here is an example of what everybody is telling you to do in javascript:
>
> https://github.com/valnet/valuenetwork/blob/master/valuenetwork/templates/valueaccounting/work_now.html
>  
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fvalnet%2Fvaluenetwork%2Fblob%2Fmaster%2Fvaluenetwork%2Ftemplates%2Fvalueaccounting%2Fwork_now.html=D=1=AFQjCNGCrkRJO6GdDZA2aqyp9V4DqFeGxQ>
>
> Look for runTime and retryTimer 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/d3898c3a-1031-45ab-a8a2-d5eda89f39bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Timer for online examination

2015-11-17 Thread bobhaugen
On Tuesday, November 17, 2015 at 12:29:02 AM UTC-6, Arindam sarkar wrote:
>
> I am developing an online examination website. And having difficulty 
> implementing the timer .
> Any one have done it or something related to countdown timer in django ?
>
>
Here is an example of what everybody is telling you to do in javascript:
https://github.com/valnet/valuenetwork/blob/master/valuenetwork/templates/valueaccounting/work_now.html

Look for runTime and retryTimer 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/635f5faa-257f-4aa0-b6e0-9be706032223%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to develop a frontend web app for using REST services

2015-10-18 Thread bobhaugen
krmane, are you posting these same questions in the REST framework forum?

I'm guessing they would like a SQLAlchemy plugin.

Unlike you, however, I like their documentation, and have found the DRF 
gang to be responsive to issues.  That being said, I haven't actually used 
it in production yet. Just experimenting.

On Saturday, October 17, 2015 at 9:28:33 AM UTC-5, krmane wrote:
>
> Hi again,
> Xavier, I have gone through the main DRF documentation and also seen your 
> blog.
> I am wondering if you can send me an off line email which can explain the 
> relation between serializer and viewset?
> I have not got the concept clear, I am beginner to REST and all I 
> understand is that the response is generally in form of json.
> happy hacking.
> Krishnakant.
>
>
> On Friday 16 October 2015 03:39 PM, Xavier Ordoquy wrote:
>
> Hi, 
>
> I wrote a short blog post about getting most of Django REST framework 
> without using Django models.
>
> https://medium.com/@linovia/django-rest-framework-viewset-when-you-don-t-have-a-model-335a0490ba6f
>
> You will loose the integration with the Django Models and will need to do 
> a few things by yourself (pagination for example) but it’s still perfectly 
> possible to do that.
> Note that most of the documentation covers Django Models because it’s 
> where most of the options are. When you don’t use them, it’s up to the 
> developers to provide the content which will be very different from a 
> project to another.
>
> Hope this will help,
>
> Regards,
> Xavier,
> Linovia.
>
>
> Le 16 oct. 2015 à 12:00, kk < krm...@gmail.com > 
> a écrit :
>
> hello again,
> I haven't got my doubts solved but a few got added.
> I was again going through the tutorial on Django REST framework.
> I am trying to know if I can use a serialiser without tying it to the 
> DJango ORM or for that matter without tying it to any thing?
> I prefer using SQLAlchemy and get the data out using sql expression 
> language.
> Then I would like to convert this data to json format for sending as 
> response.
> Is this possible?
> Happy hacking.
> Krishnakant
>
>
> On Friday 16 October 2015 11:39 AM, kk wrote:
>
> Dear all.
> I got some very important suggestions from members of this list on using 
> Django for an accounting and inventory system, including Point of Sale.
> After the POS topic was discussed,
> OUr team decided to write a RESTfull server with all the business logic in 
> API.
> We plan to do this using some thing like Flask micro framework and then 
> write a complete web app using Django to consume these services.
> Of course it could be argued that why not use Django REST framework?
> But here I am a bit surprised as well as a bit disappointed.
> Contrary to what we have all seen and experienced about Django's 
> documentation, the rest framework is not at all comprehensively documented.
> I am still not totally understood the use of 
>
> serializers.HyperlinkedModelSerializer.
>  viewset is also not totally explained properly.  the tutorial is pretty fast 
> and confusing.
> I think a better example would have served it more understandable.
> Or perhaps the documentation there asumed that every one who reads it is a 
> Django as well as REST expert, even then it is confusing.
> Any ways coming back to the topic.
> So What suggestions could I get about my main query?
> happy hacking.
> Krishnakant.
>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@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/5620CACC.2060702%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@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/9872C498-CD0B-44A3-B64E-62A34F312C02%40linovia.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 

Re: is Django right choice for a financial app

2015-10-12 Thread bobhaugen
krmane, google is misbehaving and will not allow me to reply to your reply 
to me, so I'll fake it and do some cutnpasting.

You wrote:
>  I did not get the react concept.
https://facebook.github.io/react/

I wrote:

We use the django ORM, not sqlalchemy, but that would probably just make it 
all better.

And you replied: Oh is that so?

And now I am stuck in a box. But anyway, I think my comment 
miscommunicated. I meant sqlalchemy would probably make it better.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/7b50ec0f-4064-44f6-8b11-935204e32042%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: is Django right choice for a financial app

2015-10-12 Thread bobhaugen
On Sunday, October 11, 2015 at 10:33:03 PM UTC-5, krmane wrote:
>
> The said project is an enterprise accounting (book keeping ) system. 
> It is not mere dynamic content such as that served by news rooms (the 
> very foundation of Django's origin ). 
> It is going to be lot of dynamic views which actually have to 
> conditionally serve ad-hock dynamic data. 


We're doing the equivalent of an ERP system in django.
https://github.com/valnet/valuenetwork

The django backend works great, and has handled probably more complex 
processing than you will do. Or at least, very complex, like event-driven 
MRP. It also does multi-party accounting.

Main problem we have is that complex pages with lots of django forms get 
way too slow. We plan to use django-restframework to create an API which 
will be consumed by something like React in the browser. 

We use the django ORM, not sqlalchemy, but that would probably just make it 
all better.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/c4d38614-621c-4cc2-ad74-2e4744725fc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-16 Thread bobhaugen
You gotta give PHP credit here. They did deployment better than anybody.

Django as a community could stand to put more concentrated work into 
deployment.

On Tuesday, September 15, 2015 at 3:27:49 PM UTC-5, Nikolas 
Stevenson-Molnar wrote:
>
> I second the nginx/gunicorn/django/supervisor stack. I've used it many 
> times; it's relatively easy to get everything installed and set up, and all 
> the involved components are ready for prime time.
>
> I think the "difficult to set up" sentiment is probably in comparison to 
> something like PHP. So many servers have already have the LAMP stack, so 
> deployment is just dropping your source in the correct directory and making 
> sure the permissions are right. So it's not that Django is *unnecessarily* 
> difficult, but it's certainly a bit more involved than a PHP app.
>
> On 9/15/2015 1:02:36 PM, Michiel Overtoom  
> wrote:
> Hi Hugo, 
>
> > I keep hearing that Django deployment is unnecessarily difficult. 
>
> Who says this? And what are the reasons they give for it? 
>
>
> > For a website with very little traffic, and for somebody who's new to it 
> all, what is the best way to deploy? And how should I go about deploying! 
>
> I can tell you how I do it, which is not necessarily the simplest way nor 
> especially suited to low traffic. But it's not that hard. On the server 
> machine, I install nginx, gunicorn, django and supervisor. Nginx will be 
> the frontend, gunicorn will be the webserver, django is the application 
> server, and supervisor will be used to start/stop/restart the web 
> application. 
>
> I basically did the same as Shawn. In my supervisord.conf I have these 
> lines: 
>
> [program:myapp] 
> command=/usr/local/bin/gunicorn myapp.wsgi -b 127.0.0.1: 
> directory=/wwwapp/myapp/my 
> environment=PATH="%(ENV_PATH)s:/usr/local/bin" 
> user=root 
> autostart=true 
> autorestart=true 
> stdout_logfile=NONE 
> stderr_logfile=NONE 
>
> I also wrote a blog article about this subject: 
> http://www.michielovertoom.com/freebsd/flask-gunicorn-nginx-supervisord/ 
> which uses Flask as an example, but as Shawn said, it's easy to plug in 
> your Django app instead. 
>
> -- 
> You received this message because you are subscribed 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/6DFD6635-480E-43A1-B7CC-2C5FA826185C%40xs4all.nl.
>  
>
> 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/f1692b82-4894-4c1f-bd88-3a7f32005fd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Turn off migrations completely in Django 1.7

2015-08-25 Thread bobhaugen
I agree that migrations should be optional, for all the reasons listed in 
this thread, but hope it doesn't now turn into a religious war between 
models-first and database-first. Not relevant to the issue.

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/b4510e75-6b88-4168-9d34-320e44fbe60f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'admin/index.html' does not exist

2015-08-13 Thread bobhaugen
Tried another install using pip 7.1.0 on another computer, ubuntu 12.04, 
and django installed only once, in vn/lib/python2.7/site-packages, with its 
templates etc intact.

So I don't know what happened the previous time. We just fixed it by moving 
the files on the 14.04 box, so it's not an urgent problem. But it would 
still be interesting to learn if anybody else has seen it.

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


'admin/index.html' does not exist

2015-08-13 Thread bobhaugen
TemplateDoesNotExist at /admin/

admin/index.html


Created a new virtualenvironment.
pip install Django==1.4.21

Pip installs two django directories.
One in the base virtualenv directory (e.g vn/django), another in 
vn/lib/python2.7/site-packages.

The in the base virtualenv directory has admin/templates, the one under 
site-packages does not.

This is different from previous installations, which only had django under 
site-packages, with the admin/templates.

We're running in Ubuntu 14.04. pip --version 7.1.0

This is a different (newer) version of pip than we've used before. Anybody 
seen this behavior?

More details:

Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
1.4.21Exception Type:TemplateDoesNotExistException Value:

admin/index.html

Exception 
Location:/home/lynn/Envs/vn/local/lib/python2.7/site-packages/django/template/loader.py
 
in select_template, line 193Python 
Executable:/home/lynn/Envs/vn/bin/pythonPython 
Version:2.7.6Python Path:

['/home/lynn/Envs/vn/valuenetwork',
 '/home/lynn/Envs/vn/lib/python2.7',
 '/home/lynn/Envs/vn/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/lynn/Envs/vn/lib/python2.7/lib-tk',
 '/home/lynn/Envs/vn/lib/python2.7/lib-old',
 '/home/lynn/Envs/vn/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/lynn/Envs/vn/local/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/dist-packages/pip-7.1.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Server time:Thu, 13 Aug 2015 13:13:08 +
Template-loader postmortem

Django tried loading these templates, in this order:

   - Using loader django.template.loaders.filesystem.Loader:
  - 
  /home/lynn/Envs/vn/valuenetwork/valuenetwork/templates/admin/index.html 
(File 
  does not exist)
   - Using loader django.template.loaders.app_directories.Loader:
  - 
  
/home/lynn/Envs/vn/local/lib/python2.7/site-packages/pinax_theme_bootstrap_account/templates/admin/index.html
 (File 
  does not exist)
  - 
  
/home/lynn/Envs/vn/local/lib/python2.7/site-packages/pinax_theme_bootstrap/templates/admin/index.html
 (File 
  does not exist)
  - 
  
/home/lynn/Envs/vn/local/lib/python2.7/site-packages/django_forms_bootstrap/templates/admin/index.html
 (File 
  does not exist)
  - 
  
/home/lynn/Envs/vn/local/lib/python2.7/site-packages/metron/templates/admin/index.html
 (File 
  does not exist)
  - 
  
/home/lynn/Envs/vn/local/lib/python2.7/site-packages/django_extensions/templates/admin/index.html
 (File 
  does not exist)
  - 
  
/home/lynn/Envs/vn/local/lib/python2.7/site-packages/notification/templates/admin/index.html
 (File 
  does not exist)
  - 
  
/home/lynn/Envs/vn/valuenetwork/valuenetwork/valueaccounting/templates/admin/index.html
 (File 
  does not exist)
   

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/847e33d9-11d2-4560-8e18-0880c3195860%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Invalid HTTP_HOST, can someone explain why I am getting this?

2015-05-16 Thread bobhaugen
I've gotten this error now and then when I have updated the software on a 
webfaction-hosted site and restarted Apache. Then it goes away after maybe 
a couple more restarts. It's like the software has not quite gotten itself 
together yet. I have no idea why this should be, and since it goes away, I 
have not opened a ticket on webfaction. 

On Wednesday, May 13, 2015 at 5:45:43 PM UTC-5, Russell Keith-Magee wrote:
>
>
> Is there a setting to turn of a warning that someone is attempting to 
> access your site in a potentially malicious way? No.
>
> When you get a warning like this, you investigate the cause, and fix the 
> problem. You don't just silence the warning.
>
> Yours,
> Russ Magee %-)
>
> On Thu, May 14, 2015 at 3:44 AM, frocco  
> wrote:
>
>> Thanks for getting back to me.
>> I am on django 1.5. Is there a setting I can use to avoid getting these 
>> emails?
>> I get at least 5 a week.
>>
>>
>>
>> On Tuesday, March 17, 2015 at 6:58:00 PM UTC-4, Russell Keith-Magee wrote:
>>>
>>> Hi,
>>>
>>> It's possible that you're getting this error for the exact reason that 
>>> the check was added - someone is submitting requests to your site with a 
>>> manipulated HTTP_HOST header. This may not be malicious - it could just be 
>>> a badly configured robot making web requests.
>>>
>>> It might also point at a problem with your hosting provider - especially 
>>> if you're sharing an IP address with g3suprimentos.com.br, or if 
>>> g3suprimentos.com.br once had the same IP that you're currently using. 
>>>
>>> Without more details, it's hard to say for certain. But is someone 
>>> trying to hack your site? Almost certainly not. If you were being hacked, 
>>> you wouldn't have described the problem as "I see this error from time to 
>>> time" - you would have said "I just received a thousand of these in the 
>>> last 10 minutes". Attackers aren't noted for their subtlety - they will 
>>> generally try every possible backdoor and exploit that they know of, all at 
>>> once. 
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>> On Tue, Mar 17, 2015 at 11:45 PM, frocco  wrote:
>>>
 I am concerned because I have a value in ALLOWED_HOSTS, but it is not 
 this value.


 On Tuesday, March 17, 2015 at 9:17:15 AM UTC-4, frocco wrote:
>
> SuspiciousOperation: Invalid HTTP_HOST header (you may need to set 
> ALLOWED_HOSTS): www.g3suprimentos.com.br
>
> I keep getting this error from time to time.
>
> Is someone trying to hack my site?
>
> Thanks
>
  -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/5550dde0-4230-4068-a8b5-196f0bd844fc%40googlegroups.com
  
 
 .

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

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

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


Re: Django Admin should really support Twitter Bootsrap

2015-04-15 Thread bobhaugen
On Monday, April 13, 2015 at 5:16:40 PM UTC-5, Patrick Lemiuex wrote:
>
> It's about time, the django admin tool should support twitter bootstrap 
> markups and styling. This is the third django project where I've had to 
> deal with custom form widgets because the admin tool supports kind of an 
> outdated layout scheme in the admin template.
>
> This also affects a lot of third party apps as well. It would be something 
> worth contributing to the community by me.
>

You don't like any of these?
https://www.djangopackages.com/grids/g/admin-interface/ 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/906251c1-d95e-4e2b-bc2b-25cfa4e3f8ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A sample project showing server side rendering with React and Django

2015-01-26 Thread bobhaugen
Ustun, thanks a lot. I think I start to get it. So if I don't care about 
server-side rendering of React templates (which I will try avoid in the 
beginning stages, anyway), I can skip node.js.

Learning React is on my todo list. Then I'll need to dig deeper. I suppose 
then I might change my mind...;-)

On Monday, January 26, 2015 at 10:14:33 AM UTC-6, Ustun Ozgur wrote:
>
> Hi Bob,
>
> On Sunday, January 25, 2015 at 5:52:00 PM UTC+2, bobhaugen wrote:
>>
>> Ustun,
>>
>> Please say more about the advantages? As in, what can you do by adding a 
>> node.js server to the mix (and so requiring everybody else who wants to use 
>> your Django project to do the same, learn and manage node.js, etc.) that 
>> you could not do with just plain Django on the server and React.js on the 
>> client? 
>>
>
> The main issue here is duplication of templates, if you use plain Django 
> on the server and React.js on the client. If you don't want to have any 
> server side rendering, that's OK for some projects, for example in the 
> current project I'm working on, we don't have that requirement, so Django 
> mainly serves as an api; we use the template system of django very 
> sparingly.
>
> Note that the amount of node.js in this project is very small, rather I 
> assume the programmer is familiar with both react and django.
>
>
>
>> And why you would not just want to bite the bullet and use node.js 
>> instead of django in the first place?
>>
>
>  
> As to why django instead of node.js, that's dependent on the requirements 
> and age of a project. For most brown-field projects, that's not an option. 
> Besides that, I believe that outside templating system, remaining parts of 
> Django (models, managers etc) are solid, so I still prefer that as opposed 
> to a node.js solution. But that's clearly a personal preference.
>
> Ustun
>
>
>
>
>>
>> On Sunday, January 25, 2015 at 9:41:33 AM UTC-6, Ustun Ozgur wrote:
>>>
>>>
>>>
>>> On Sunday, January 25, 2015, bobhaugen <bob.h...@gmail.com> wrote:
>>>
>>>> Ustun, do you think it is necessary to use a node.js server to interact 
>>>> with react.js on the client side? Seems like a lot of added complexity. 
>>>> But 
>>>> I could be missing something important...
>>>>
>>>
>>> Hi Bob,
>>>
>>> This is definitely not the only way but I don't  think it adds that much 
>>> complexity considering the advantages. You could have multiple node.js 
>>> renderers, gain fault tolerance and performance via some distribution 
>>> scheme like round-robin.  The nodejs renderer here is stateless and could 
>>> be made even faster through memoization or caching (or cache could be 
>>> handled on python side too before communicating with node)
>>>
>>> Another alternative would be to use something like queues to handle 
>>> communication between node and django, but that is more complex. 
>>>
>>> The other alternative would be to fork a nodejs process on each call, 
>>> for a high traffic site, speed might be more of an issue there. Some 
>>> projects take that approach, I recently saw another django-react 
>>> integration that uses that. (See django-node for this)
>>>
>>> If you are on jvm, it is possible to use nashorn to do in process 
>>> rendering. 
>>>
>>> Best,
>>>
>>> Üstün
>>>
>>>
>>>
>>>  
>>>
>>>>
>>>>
>>>> On Saturday, January 24, 2015 at 7:13:56 AM UTC-6, Ustun Ozgur wrote:
>>>>>
>>>>> Last year I gave a conference talk at Djangocon EU where I introduced 
>>>>> React.js to the community. Since then, I have been getting some emails 
>>>>> asking for some sample code.
>>>>>
>>>>> I just published a sample project that simply uses a node.js server to 
>>>>> delegate server side rendering from Django. Hope that this is useful to 
>>>>> some newcomers. (Note that this sample doesn't show server side rendering 
>>>>> via react-router, the route on the clientside is a single one) 
>>>>>
>>>>> I'm planning to write a blog post explaining the code if there is any 
>>>>> interest.
>>>>>
>>>>> https://github.com/ustun/django-react-integration
>>>>>
>>>>>
>>>>> Ustun
>>>>>
>>>>
>>>
>>>
>>>
>>>  
>>>
>>&g

Re: A sample project showing server side rendering with React and Django

2015-01-25 Thread bobhaugen
Ustun,

Please say more about the advantages? As in, what can you do by adding a 
node.js server to the mix (and so requiring everybody else who wants to use 
your Django project to do the same, learn and manage node.js, etc.) that 
you could not do with just plain Django on the server and React.js on the 
client? 

And why you would not just want to bite the bullet and use node.js instead 
of django in the first place?

On Sunday, January 25, 2015 at 9:41:33 AM UTC-6, Ustun Ozgur wrote:
>
>
>
> On Sunday, January 25, 2015, bobhaugen <bob.h...@gmail.com > 
> wrote:
>
>> Ustun, do you think it is necessary to use a node.js server to interact 
>> with react.js on the client side? Seems like a lot of added complexity. But 
>> I could be missing something important...
>>
>
> Hi Bob,
>
> This is definitely not the only way but I don't  think it adds that much 
> complexity considering the advantages. You could have multiple node.js 
> renderers, gain fault tolerance and performance via some distribution 
> scheme like round-robin.  The nodejs renderer here is stateless and could 
> be made even faster through memoization or caching (or cache could be 
> handled on python side too before communicating with node)
>
> Another alternative would be to use something like queues to handle 
> communication between node and django, but that is more complex. 
>
> The other alternative would be to fork a nodejs process on each call, for 
> a high traffic site, speed might be more of an issue there. Some projects 
> take that approach, I recently saw another django-react integration that 
> uses that. (See django-node for this)
>
> If you are on jvm, it is possible to use nashorn to do in process 
> rendering. 
>
> Best,
>
> Üstün
>
>
>
>  
>
>>
>>
>> On Saturday, January 24, 2015 at 7:13:56 AM UTC-6, Ustun Ozgur wrote:
>>>
>>> Last year I gave a conference talk at Djangocon EU where I introduced 
>>> React.js to the community. Since then, I have been getting some emails 
>>> asking for some sample code.
>>>
>>> I just published a sample project that simply uses a node.js server to 
>>> delegate server side rendering from Django. Hope that this is useful to 
>>> some newcomers. (Note that this sample doesn't show server side rendering 
>>> via react-router, the route on the clientside is a single one) 
>>>
>>> I'm planning to write a blog post explaining the code if there is any 
>>> interest.
>>>
>>> https://github.com/ustun/django-react-integration
>>>
>>>
>>> Ustun
>>>
>>
>
>
>
>  
>
>>  -- 
>> 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/-7oLnG_MaGE/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/b7cca6c2-2b51-4bf0-8ade-d2776e3e77b7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/b7cca6c2-2b51-4bf0-8ade-d2776e3e77b7%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Ustun Ozgur
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/85b38d81-5df6-48b7-b3f6-8c7d808cb12b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A sample project showing server side rendering with React and Django

2015-01-25 Thread bobhaugen
Ustun, do you think it is necessary to use a node.js server to interact 
with react.js on the client side? Seems like a lot of added complexity. But 
I could be missing something important...

On Saturday, January 24, 2015 at 7:13:56 AM UTC-6, Ustun Ozgur wrote:
>
> Last year I gave a conference talk at Djangocon EU where I introduced 
> React.js to the community. Since then, I have been getting some emails 
> asking for some sample code.
>
> I just published a sample project that simply uses a node.js server to 
> delegate server side rendering from Django. Hope that this is useful to 
> some newcomers. (Note that this sample doesn't show server side rendering 
> via react-router, the route on the clientside is a single one) 
>
> I'm planning to write a blog post explaining the code if there is any 
> interest.
>
> https://github.com/ustun/django-react-integration
>
>
> Ustun
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/b7cca6c2-2b51-4bf0-8ade-d2776e3e77b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-10-30 Thread bobhaugen
On Wednesday, October 29, 2014 12:26:01 PM UTC-5, Chris Hawkes wrote:
>
> All this being said, there is definitely a trend towards SPA's.  
>
>
Does anybody else besides me hate the SPA trend?  I much prefer apps that 
are separated into logical components where each component has its own URL, 
rather than an a seemingly-infinite scroll.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/89172ae2-33de-4b36-8c36-d579fc31c8c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: Upgrading Django (to 1.7)

2014-09-28 Thread bobhaugen
Fred, thanks a jillion for the excellent advice! I obviously missed that 
bit in the data migration boilerplate.

On Saturday, September 27, 2014 9:29:10 AM UTC-5, Fred Stluka wrote:
>
>  Bob,
>  
> Are you referring directly to the models by name in the data 
> migrations?  That could be the problem, because yes, the migration
> would be using the latest models at the time that the migration is
> executed, not the models as they stood at the time that the 
> migration was written.
>
> There's a warning in a comment in the boilerplate code generated
> for each data migration by the command:
> % manage datamigration  
>
> It says:
>
> def forwards(self, orm):
> "Write your forwards methods here."
> # Note: Don't use "from appname.models import ModelName". 
> # Use orm.ModelName to refer to models in this application,
> # and orm['appname.ModelName'] for models in other applications.
>
> and there is a dictionary of the models as they existed at that
> time shown later in the same file.
>
> If you always follow this advice and manipulate orm.ModelName 
> instead of appname.models.ModelName, it should solve exactly 
> the problem you are describing.
>
> Hope this helps,
> --Fred 
> --
> Fred Stluka -- mailt...@bristle.com  -- 
> http://bristle.com/~fred/ 
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service! 
> Open Source: Without walls and fences, we need no Windows or Gates. 
> --
>  
> On 9/27/14 10:00 AM, bobhaugen wrote:
>  
> The problem we ran into was not with the order of migrations, it was that 
> all of the migrations were running with the latest models.py code. The data 
> migration was trying to move data from one model field to another model 
> field, and the "from" field had been deleted from models.py.  
>
> This was awhile ago, and my memory might be faulty. Do the latest 
> migrations give you any way to deal with that situation? I mean, do they 
> migrate the models in models.py in sync with the the database schema 
> migrations? 
>
> I can see where a data migration might work in a schema migration sequence 
> if you expressed it all in SQL, just dealing with the database alone, but 
> we of course wrote in Python using the Django ORM.
>
> On Friday, September 26, 2014 10:04:49 AM UTC-5, Fred Stluka wrote: 
>>
>>  Bob,
>>
>> You can control the order in which migrations run.
>>
>> For South, see "depends_on" and "needed_by":
>> - http://south.readthedocs.org/en/latest/dependencies.html
>>
>> For Django 1.7 migrations, see "dependencies":
>> - https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies
>>
>> --Fred 
>> --
>>
>>
>
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/ddd6b3c9-71ba-4396-8c1d-9558eefd815a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-09-27 Thread bobhaugen
The problem we ran into was not with the order of migrations, it was that 
all of the migrations were running with the latest models.py code. The data 
migration was trying to move data from one model field to another model 
field, and the "from" field had been deleted from models.py.  

This was awhile ago, and my memory might be faulty. Do the latest 
migrations give you any way to deal with that situation? I mean, do they 
migrate the models in models.py in sync with the the database schema 
migrations? 

I can see where a data migration might work in a schema migration sequence 
if you expressed it all in SQL, just dealing with the database alone, but 
we of course wrote in Python using the Django ORM.

On Friday, September 26, 2014 10:04:49 AM UTC-5, Fred Stluka wrote:
>
>  Bob,
>
> You can control the order in which migrations run.
>
> For South, see "depends_on" and "needed_by":
> - http://south.readthedocs.org/en/latest/dependencies.html
>
> For Django 1.7 migrations, see "dependencies":
> - https://docs.djangoproject.com/en/dev/topics/migrations/#dependencies
>
> --Fred 
> --
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/418bd491-1068-4688-af2a-9754802b988c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-09-26 Thread bobhaugen
Andrew, thanks for the article, and the more-to-come.

When you get to data migrations, you might want to cover a problem I ran 
into with them: when I had a data migration in the middle of a sequence of 
other migrations, and then later wanted to set up a new environment, which 
meant running all of the migrations in sequence from the beginning, the 
data migration was now running in the latest models.py code, not the code 
in which it initially worked. So it did not work any more.

In particular, the data migration was a precursor to another schema 
migration were a field would be removed. The data migration was to move the 
existing data in the field-to-be-removed to a different field. So when the 
data migration ran in the longer sequence, the field it was trying to move 
data from was now gone from the code. 

I suspect there are a lot of other ways to shoot yourself in the foot with 
data migrations, so we have stopped using them and just use our own data 
migration scripts outside of the sequence of schema migrations.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/9f4e1b6a-4051-478d-9a09-43318266ed7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slow page load performance with a large number of formsets (over 25)

2014-09-21 Thread bobhaugen
We have had the same problem, but with a large number of forms. I have 
profiled the situation and the load time is dominated by form rendering on 
the server. 

I remember vaguely something about caching forms so they don't need to be 
re-rendered, but can't find it now. And I don't understand the tradeoffs 
anyway. (Maybe somebody does?)

We're looking at moving away from Django forms to passing Json back and 
forth between Javascript thingies. Recently used http://handsontable.com/ 
to replace a formset. Much faster, much more flexible. You lose some of the 
niceties of model forms, need to do a lot of javascript validations which 
can be cranky, and of course need to do all of your updating in procedural 
code in views.  As always, tradeoffs.

On Friday, September 19, 2014 10:26:04 PM UTC-5, Jason wrote:
>
> We are new to the Django framework and are currently building an 
> application in PythonAnywhere. We have a couple of html pages where the 
> volume of formsets that we are loading up varies from 25 to 100. We find 
> that when we use a small number of formsets, the page loads very quickly. 
> However, performance seems to degrade as the numbers increase. 
>
> It's not an issue with our SQL queries as when we load the same data into 
> a HTML table instead of using formsets, it loads very quickly. 
>
> We need to load the data using formsets because we expect updates to each 
> row from the user.
>
> Has anyone encountered this problem? If so, is there a way to improve the 
> performance of the formsets or are formsets not intended to be used with 
> large volumes of data? If not, are there alternative options that we can 
> use that allow users to modify the data in multiple rows returned by the 
> query? Note - we don't want to send the user to a 'Pop-Up' or another 
> screen to update data. Note 2 - We are using "Model" formsets, in 
> particular "inlineformset_factory".
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/3929fd47-cd26-40c2-a6d7-93483ad59b34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: loaddata not looking for natural keys

2014-03-24 Thread bobhaugen
Ok, problem resolved.

I must have done something else wrong the last time I did loaddata, because 
I tried the whole sequence again with the natural_keys as tuples, and it 
all worked.

Sorry to bother the list so much.

But to summarize, natural_keys must be tuples, not single unicode 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/29732733-a521-45c4-b609-bae4cd92155b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: loaddata not looking for natural keys

2014-03-24 Thread bobhaugen
Not a tuple, it's now a json array. (Still not seeing things accurately...)

So I would think it would deserialize with __iter__, but I still get the 
same deserialization error message.

On Monday, March 24, 2014 8:38:52 AM UTC-5, bobhaugen wrote:
>
> Got a clue. I re-read the doc and it says the natural  key value must be a 
> tuple.  Missed that before.
>
> So I changed it like this:
> def natural_key(self):
> return (self.name,)
>
> In the shell, that properly returns a tuple:
>
> (u'Cash Contribution',)
>
>
> But in the dumpdata results, it is not a tuple:
> {
> "pk": 22, 
> "model": "valueaccounting.patternfacetvalue", 
> "fields": {
> "facet_value": 4, 
> "pattern": 9, 
> "event_type": [
> "Cash Contribution"
> ]
> }
> }, 
>
> So I am still 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/6d01a7a4-dc26-462f-8784-69302c1cce1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: loaddata not looking for natural keys

2014-03-24 Thread bobhaugen
Got a clue. I re-read the doc and it says the natural  key value must be a 
tuple.  Missed that before.

So I changed it like this:
def natural_key(self):
return (self.name,)

In the shell, that properly returns a tuple:

(u'Cash Contribution',)


But in the dumpdata results, it is not a tuple:
{
"pk": 22, 
"model": "valueaccounting.patternfacetvalue", 
"fields": {
"facet_value": 4, 
"pattern": 9, 
"event_type": [
"Cash Contribution"
]
}
}, 

So I am still 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/15fc6896-3576-41e3-be12-9d18d9ade2af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: loaddata not looking for natural keys

2014-03-23 Thread bobhaugen
Ok, now I am really confused.

Here's the code where the error originates in 
django/core/serializers/python.py:

   # Handle FK fields
elif field.rel and isinstance(field.rel, models.ManyToOneRel):
if field_value is not None:
import pdb; pdb.set_trace()
if hasattr(field.rel.to._default_manager, 
'get_by_natural_key'):
if hasattr(field_value, '__iter__'):
obj = 
field.rel.to._default_manager.db_manager(db).get_by_natural_key(*field_value)
value = getattr(obj, field.rel.field_name)
# If this is a natural foreign key to an object 
that
# has a FK/O2O as the foreign key, use the FK 
value
if field.rel.to._meta.pk.rel:
value = value.pk
else:
value = 
field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
data[field.attname] = value
else:
data[field.attname] = 
field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
else:
data[field.attname] = None



Here's what pdb says:

(Pdb) p field

(Pdb) p field_value
u'Cash Contribution'
(Pdb) p hasattr(field.rel.to._default_manager, 'get_by_natural_key')
True
(Pdb) n
> 
/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/core/serializers/python.py(109)Deserializer()
-> if hasattr(field_value, '__iter__'):
(Pdb) p hasattr(field_value, '__iter__')
False
(Pdb) p field_value
u'Cash Contribution'
(Pdb) p type(field_value)

(Pdb) n
> 
/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/core/serializers/python.py(117)Deserializer()
-> value = 
field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
(Pdb) n
ValidationError: Validati...teger."])
> 
/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/core/serializers/python.py(117)Deserializer()
-> value = 
field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)


I thought unicode fields had iterators? But here's one in ipython:

In [15]: field_value = u'Cash Contribution'

In [16]: field_value.__iter__()
---
AttributeErrorTraceback (most recent call last)

/home/bob/.virtualenvs/vn2/valuenetwork/ in ()

AttributeError: 'unicode' object has no attribute '__iter__'







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/3b3e1377-bb7f-4b6c-812d-52a5d274ee40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: loaddata not looking for natural keys

2014-03-22 Thread bobhaugen
Oh, and I am using Django 1.4.5.

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


loaddata not looking for natural keys

2014-03-22 Thread bobhaugen
loaddata error message:

File 
"/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/core/serializers/json.py",
 
line 47, in Deserializer
raise DeserializationError(e)
DeserializationError: [u"'Cash Contribution' value must be an integer."]


Here's how I dumped the data:

./manage.py dumpdata valueaccounting.AgentType  valueaccounting.Facet 
valueaccounting.FacetValue valueaccounting.ProcessPattern 
valueaccounting.PatternFacetValue  valueaccounting.Project --natural 
--indent=4 > starters.json


Then I did syncdb and migrate.

Then I tried loaddata:

./manage.py loaddata starters.json


Here's the offending json:

{
"pk": 22, 
"model": "valueaccounting.patternfacetvalue", 
"fields": {
"facet_value": 4, 
"pattern": 9, 
"event_type": "Cash Contribution"
}
}, 


Here's the relevant natural key code:

class EventTypeManager(models.Manager):

def get_by_natural_key(self, name):
return self.get(name=name)

class EventType(models.Model):
[...]
objects = EventTypeManager()

def natural_key(self):
return (self.name)


So what am I missing?  (I put a pdb trace in the get_by_natural_key method, 
never got called.) 

I am stumped. But I expect it is some stupid mistake that I can't see...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/4023a879-c7e5-458e-8235-72a517102572%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using Django without templates?

2014-02-28 Thread bobhaugen
On Thursday, February 27, 2014 8:37:45 PM UTC-6, somecallitblues wrote:

> You do have to be careful with templates if you're using too many 
> inclusions or if you have too much logic in them. There's a good django 
> debug toolbar add-on that informs you about the time a template takes to 
> compile.
>
https://github.com/orf/django-debug-toolbar-template-timings

I'm currently having performance problems with templates that have many 
small django forms in them.  Plan to try something like Angular.js instead 
of django templates and see if it's better.

The reference to "full stack" ~might~ have meant something like Meteor, a 
framework that uses javascript on both server and client.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/3dbe90fd-e04c-49f9-ac86-2fb2e80caf1e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-29 Thread bobhaugen
I think I agree with James (below). I'm about to graft a javascript MVC 
library or framework on top of a Django server, to make up for some 
problems with Django templates and forms. Haven't done it yet, but need to 
do something different. So I may come back here and repent...;)

I have worked on server-side javascript before the current trend (e.g. 
before node.js). I liked it, but it was still clear that the server and the 
browser were different domains, and they still have an impedance mismatch. 
 Just using the same language did not hide it, or when it did, it was a 
leaky covering.  Apparently Meteor thinks they have solved that mismatch. 
 Anybody tried it? But I do *not* want to develop single-page apps or use a 
NoSQL db, so they have quite a few assumptions that don't work for me. So 
I'll stick with Django on the server.

On Tuesday, January 28, 2014 10:21:47 AM UTC-6, James wrote:
>
> I think in the next year or two we will be talking about a MV > MVC 
> paradigm. Where the MV is django / rails / flask / node  and where the MVC 
> is the client side. Right now the only MVC client side frameworks are 
> written in javascript because the only way to manipulate the DOM is with 
> JS. Therefore, if you are a startup or even an established company and you 
> need to go out and hire some resources, it's more cost effective in the 
> beginning to hire one person who knows javascript will and through them 
> into node.js and backbone (or whatever).
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/a1f43977-cb4c-4b0d-b57a-327c8da01594%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to automatically test Django apps

2013-12-17 Thread bobhaugen
That's interesting, but how about making it free for open-source apps who 
give you a credit on their repos?

On Tuesday, December 17, 2013 1:26:05 AM UTC-6, Michael Herrmann wrote:
>
> On Monday, December 16, 2013 1:54:01 PM UTC+1, rush wrote:
>>
>>  
>> According to http://heliumhq.com/files/helium_license.txt it is not.
>>
>> Furthermore it is not free. According to their price page you have to pay 
>> at least 200 euro per year to use it.
>>
>
> We added a Social License yesterday that is in fact free. :-) Check it out 
> on http://heliumhq.com/purchase
>
> M 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/9d94ed84-218b-485b-82fc-b03d9ec60757%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to test django app

2013-11-20 Thread bobhaugen
Recommend:
https://pycon-2012-notes.readthedocs.org/en/latest/testing_and_django.html
http://webtest.pythonpaste.org/en/latest/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.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/1150354d-fb07-4279-ae4a-c0b610e0caca%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: client side tests

2013-07-15 Thread bobhaugen
Any current faves for client-side testing that do not require Java?
>
>   

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




Re: Data Structure - Orders and multiple items

2013-04-02 Thread bobhaugen
There's a reason ERP systems have an order detail table.

It might look something like:

class OrderDetail(models.Model): 
order = models.ForeignKey(Order) 
item = models.ForeignKey('Item') 
quantity = models.DecimalField(max_digits=8, decimal_places=2)
etc.

(That's just to explain the idea, not necessarily exactly how you would do 
it.)

On Sunday, March 31, 2013 11:07:36 PM UTC-5, Eric Lovrien wrote:
>
> I am not sure of how or the best way to structure my data in models.py. I 
> would like to have an order and allow multiple items / products to be added 
> to an order. I know I can do a ManyToMany field but not sure how I would 
> connect a qty to that. I am sure there is some simple way of doing this, or 
> a better way to model the data. I know in many ERP systems they have an 
> orders table and then an orders details table. Below is just a quick 
> mock-up of how i was thinking on to do it until I started thinking about 
> the many items and qty to an single order issue came up. Can any one give 
> me some tips on how to accomplish this? 
>
>
>
> class Item(models.Model): 
> name = models.CharField(max_length200) 
> description = models.TextField(blank=True) 
>
> def __unicode__(self): 
>  return self.name 
>
> class Customer 
> first_name = models.CharField(max_length=100) 
> last_name = models.CharField(max_length=100) 
> address = models.CharField(max_length=200) 
>
> def __unicode__(self): 
> return self.name 
>
> class order(models.Model): 
> order = models.IntegerField(unique=True) 
> customer = models.ForeignKey('Customer') 
>

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




Re: Django project - Allow users to write a custom function and store in DB

2013-02-15 Thread bobhaugen
I found this useful in doing something like that:
http://lybniz2.sourceforge.net/safeeval.html
http://effbot.org/zone/librarybook-core-eval.htm

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




Problems doing ajax post with ImageField

2013-02-10 Thread bobhaugen
Here's the relevant parts of the model:

class Resource(models.Model):
photo = ThumbnailerImageField(_("photo"),
upload_to='photos', blank=True, null=True)

This works fine in admin and with regular form posts.

Trying to use jquery.post in one situation to post a photo without 
suffering a page reload.

With the regular post, the photo field returns like this (in 
form.cleaned_data):
'photo': 

And request.FILES is like this:
]}>

With the jquery post, photo is None and the MultiValueDict is empty.  

In both cases the form is set up with enctype="multipart/form-data", 
and the form is instantiated in the view with 
form = ResourceForm(request.POST, request.FILES)

What am I doing wrong?

Here's the javascript:

$("#detailForm").submit(function(event) {
event.preventDefault();

var $form = $( this ),
url = $form.attr( 'action' );

var formData = $form.serialize();
saveResource(url, formData); 

});

function saveResource(url, formData)
{
notifySaving();
var jqxhr = $.post( url, formData,
function( data ) {
$('#detailModal').modal('hide');
notifySaved();
resourceSaved = true;
})
.fail(function() 
{ 
$('#detailModal').modal('hide');
notifyProblem(); 
resourceSaved = false;
startRetrying();
}
);
}

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




Re: Object level permissions implementation

2013-02-06 Thread bobhaugen
I'm not sure this is the best way to do it, but for what I think is a 
similar situation, I created a template tag and a model instance method.

The template tag asks the model instance method whether the user has 
permission.

Here's the template tag:
https://github.com/bhaugen/localecon/blob/master/clusters/templatetags/permissions.py

Here's the instance method:
https://github.com/bhaugen/localecon/blob/master/clusters/models.py#L176

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




Re: getting "DateTimeField received a naive datetime" error but have no DateTimeFields

2012-12-18 Thread bobhaugen
Tom, thank you for that very useful tip!  My feeble python-fu has now been 
strengthened.

On Monday, December 17, 2012 8:27:28 AM UTC-6, Tom Evans wrote
>
>
> Following the thread I see that you have figured out where and why 
> this is coming from. There is a simple tip you can use to speed this 
> up in future, simply run python with warnings set to error, and any 
> Warnings will be converted into RuntimeErrors - so you get a lovely 
> stack trace showing exactly how and when the warning was issued. 
>
> You can configure python to stop only on certain Warnings, but the 
> simplest way is to turn all Warnings into Errors: 
>
> python -W error manage.py  
>
> Full details on what you can specify with -W here: 
>
> http://docs.python.org/2/library/warnings.html#the-warnings-filter 
>
> Cheers 
>
> Tom 
>

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



Re: getting "DateTimeField received a naive datetime" error but have no DateTimeFields

2012-12-16 Thread bobhaugen
Wrapping this up:  the problem was caused by South, happened in migrate 
(found via stack trace).  When I upgraded South, the problem went away.

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



Re: getting "DateTimeField received a naive datetime" error but have no DateTimeFields

2012-12-14 Thread bobhaugen
Oh, and Django 1.4.1...sorry.

On Friday, December 14, 2012 1:43:09 PM UTC-6, bobhaugen wrote:
>
> Thanks for the reply.
>
> On Friday, December 14, 2012 1:27:03 PM UTC-6, Chris Cogdon wrote:
>>
>> Would be nice to know what function's raising that error, and where the 
>> value came from. Requesting traceback, database type (tried it with more 
>> than one database type), and other information.
>>
>> It's in a test.   No real traceback, just a bunch of the same error 
> messages:
>
> ./manage.py test valueaccounting
> Creating test database for alias 'default'...
> /home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/db/models/fields/__init__.py:808:
>  
> RuntimeWarning: DateTimeField received a naive datetime (2012-12-14 
> 19:41:27.469600) while time zone support is active.
>   RuntimeWarning)
> /home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/db/models/fields/__init__.py:808:
>  
> RuntimeWarning: DateTimeField received a naive datetime (2012-12-14 
> 19:41:27.507916) while time zone support is active.
>   RuntimeWarning)
>
> Database is sqlite. 
>

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



Re: getting "DateTimeField received a naive datetime" error but have no DateTimeFields

2012-12-14 Thread bobhaugen
Thanks for the reply.

On Friday, December 14, 2012 1:27:03 PM UTC-6, Chris Cogdon wrote:
>
> Would be nice to know what function's raising that error, and where the 
> value came from. Requesting traceback, database type (tried it with more 
> than one database type), and other information.
>
> It's in a test.   No real traceback, just a bunch of the same error 
messages:

./manage.py test valueaccounting
Creating test database for alias 'default'...
/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2012-12-14 
19:41:27.469600) while time zone support is active.
  RuntimeWarning)
/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/db/models/fields/__init__.py:808:
 
RuntimeWarning: DateTimeField received a naive datetime (2012-12-14 
19:41:27.507916) while time zone support is active.
  RuntimeWarning)

Database is sqlite. 

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



getting "DateTimeField received a naive datetime" error but have no DateTimeFields

2012-12-14 Thread bobhaugen
RuntimeWarning: DateTimeField received a naive datetime (2012-12-14 
17:39:38.878379) while time zone support is active.

This is happening in my tests, but not in normal code.

>From dropping a trace in, it looks like it is happening before the test 
setup even runs.

I double-checked my models,  not a DateTimeField in the lot. Nor anywhere 
else in my code except for South migrations, where it is found in 
models['auth.user']. (But I'm not creating any Users in my test code, 
either...)

The tests run ok, but the error messages will be disconcerting to people 
who install my open-source project code.

Any clues?

Thanks.

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



Re: Lab notebook in Django?

2012-11-28 Thread bobhaugen
Michele,

Thanks a ton!  Checking it out...

-Bob

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



Lab notebook in Django?

2012-11-28 Thread bobhaugen
Anybody made a lab notebook in Django?

Or do any of the authors or users of any other Django package (maybe one of 
the CMS's) think their fave would be good for creating a lab notebook?

Or does anybody else have ideas for, or interest in, a Django lab notebook 
app?  (To be open source, for sure.)

Thanks,
Bob Haugen

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



Re: perfectionists... motto doesn't fit

2012-10-12 Thread bobhaugen
On Friday, October 12, 2012 7:56:52 AM UTC-5, Russell Keith-Magee wrote:

> The reason I jumped on this was pre-emptive. We've had two threads on 
> Django-dev in a week, started by the same OP, which have quickly 
> degraded into *very* ugly territory. As Jacob has commented on the 
> other threads, we're taking it on faith that the OP has good 
> intentions but has phrased himself badly, but he, and others, have 
> been warned about keeping a civil tongue. Given that a discussion of 
> "what defines a perfectionist" is in no way on-topic for django-users, 
> and has all sorts of potential to end up in bad places, I have no 
> problem asking people to step away from this particular topic. 
>

Russell (and Jacob), 

I really appreciate the way you moderate the forum. The civility and 
helpfulness of the community was one of the main reasons I picked Django a 
few years ago.

Thanks again,
Bob Haugen

>  
>

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



Re: ANN: eGenix mxODBC Connect - Python Database Interface 2.0.1

2012-09-26 Thread bobhaugen
I like to get open-source project announcements that are relevant to 
Django, but am not interested in commercial products.

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



Re: ANN: Maymyo Business Application Infrastructre Beta 0.3.3

2012-09-20 Thread bobhaugen
Gaah!  I just re-read my message about Maymyo and if it was from somebody 
else, I would think they were related to the project and shilling, or else 
trying to selling the OP something.

I'm not, really. This is the first time I heard of the project. And I don't 
have anything to sell. But I am an old ERP programmer and liked where they 
were going, and think it's nice to see more serious business features in 
Django projects.

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



Re: ANN: Maymyo Business Application Infrastructre Beta 0.3.3

2012-09-20 Thread bobhaugen
This is a very ambitious project.  I wish you great success.

I did some browsing of the doc and code and am very impressed by what you 
have accomplished so far.  Your "glacial speed" comment is too modest.

I am working on business applications in Django, but they are not 
enterprise-oriented.  I'll send you a private message with some links, in 
case I have some code you could use.

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



Re: Graphs for my Django Application

2012-06-08 Thread bobhaugen

>
> http://d3js.org/ can handle both meanings of graphs: charts like bar 
charts, or visualizations of network structures.



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



Re: Django and social network

2012-02-24 Thread bobhaugen
Another angle on virtualenvs: if you install
http://www.doughellmann.com/projects/virtualenvwrapper/ you will find
them much much easier to use.  You might even begin to like them, as
many others have.  Takes a little getting used to, though, like
anything else that is different.

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



Re: Open-source or closed-source for SaaS?

2012-01-16 Thread bobhaugen
You might also want to consider:

(1) Will anybody actually want to compete with you using your code or
a fork of same?
People often assume ravenous competitors when in real life, nobody is
that interested, for whatever reasons.  Or at least they will not
become interested until you are way out in front.

(2) Even if they do, will they able to compete?  Or will your service
be clearly superior? And will you be able to evolve it faster and
better than any copycats, because you understand it deeply and they
don't?

None of those considerations mean you should or should not open-source
your code, but you might be worried about nothing much.

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



Re: Is DJango bad for conveying business-logic?

2011-12-14 Thread bobhaugen
I'm developing quite complex business systems in Django, and if you
google for "django erp" you'll find a bunch of those.

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



Re: Django E-Commerce Framework

2011-12-07 Thread bobhaugen
I'm guessing that the OP wanted to develop a "standard" e-commerce
site for a single company, in which case I agree with Stuart and Andre
that the way to go is a well-tested e-commerce framework.

I had to roll my own because I was doing something very different: B2B
e-commerce with an efficient order form (order from a grid combining
many products, not one-product-per-page adding to a shopping cart one
at a time) and order line items from many producers where the payment
from the customer needs to get allocated to each producer.  But had a
well-tested framework for that kind of thing been available, I would
have grabbed it.

As it is, I did use django-paypal with some customizations, which is
its own kind of pain in the butt.  (Not django-paypal, the
customizations, because now I am stuck with the version of django-
paypal that I customized...)  Eventually I'll take another look at
payment apps and some of the newer e-commerce frameworks that are more
modular.

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



Re: Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-12 Thread bobhaugen
On Oct 12, 9:12 am, Russell Keith-Magee 
wrote:
> --natural isn't a magic wand

Dang!  I knew that "magic removal" was a bad idea...

> Contenttypes are automatically created by syncdb. If your fixtures
> *also* contain content types, you can potentially get IntegrityErrors
> (because in the process of loading the fixture, you can end up with
> duplicated content types). If your fixtures contain numeric references
> to content types, then there is also confusion as to whether the
> numeric references are to the automatically generated primary keys, or
> the content type primary keys described in the fixture.
>
> --natural provides a resolution to this problem by saying "I'm going
> to use a name, not a number, to refer to content types". You can then
> omit content types from your fixture, and rely on the fact that syncdb
> has created the content types with a name that can be resolved at the
> time the fixture is loaded.

First time I understood any of that.  I just looked in the doc to see
if it needed your paragraph, and found an almost equally good
explanation here:
https://docs.djangoproject.com/en/1.3/topics/serialization/#natural-keys
I obviously missed it the first time around.

Thank you very much!

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



Re: Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-11 Thread bobhaugen
Replying to myself:  temporary fix for dumpdata: --exclude
contenttypes --exclude auth.permission

The result now works as a test fixture.

Not sure what to conclude:
* the fix for issue #7052 does not work?
* --natural does not fix the IntegrityErrors with contenttypes in test
fixtures?
* contenttypes are trouble in test fixtures?
* test fixtures are trouble and I should just create all of my test
objects in the test cases?
* I am just confused?

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



Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-11 Thread bobhaugen
Still getting "IntegrityError: columns app_label, model are not
unique" when loading a test fixture created by dumpdata using the
keyword --natural.

I am probably missing something, but I understood the resolution to
https://code.djangoproject.com/ticket/7052 to be to use the new --
natural keyword when doing the dumpdata:
https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-option---natural

I'm using Django 1.3.1.

So what am I missing?

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



south vs nashvegas

2011-07-31 Thread bobhaugen
I'm about to start using a database migration tool on an existing
project.

(Yes, yes, I know, I am crazy for not having done so from the
beginning...)

So: south (the reigning champ) or nashvegas (the upstart)?

I respect the people working on nashvegas a lot, and figure they have
pretty good reasons for starting a new migration tool.  And south
seems more complicated (simpler is better, at least some of the
time...).

I read here 
http://www.issackelly.com/Blog/entry/On_Django_Migrations_South_vs_Nashvegas/
that "Much care has been made to make sure that you can start using
south on your app part-way through development, where Nashvegas should
really be used from the start.  Converting to Nashvegas with a team
requires though and planning, and with South, it requires one
management command from each person (per app)."

Still true?  (Things move fast in the Django world.)

Any other opinions, tips, warnings, gratefully received.

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



Re: Web development newbie

2011-07-24 Thread bobhaugen
On Jul 23, 8:19 am, Riefers  wrote:
> I've spent the 10+ years developing serverside apps in java. I've
> never done any web page developement. Someone recommended Django. Any
> suggestions on where to start?

I learned Python and Django at the same time.  A lot of people have
changed their recommendations for learning Python from "Dive into..."
to
http://learnpythonthehardway.org/

One of the problems I had was learning to code "pythonically", that
is, using Python rather than Java idioms.  This helped me:
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html

> Is Django too advanced for me if I've
> never done web side developement?

Django will probably help you learn web development.

Good luck and have fun.

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



Re: ANN: django-iadmin

2011-07-04 Thread bobhaugen
Awesome feature list. I'll start trying it tomorrow.  Just sending
this message to be encouraging.

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread bobhaugen
Another angle on licenses is software community practice.

If you want to develop an app to be widely adopted within a particular
software community, you will want to use a license that is the same as
or compatible with the community licensing practices.

For example, I wanted to develop an app that could be used by the
Pinax community, so I used the same license as Pinax:
https://github.com/pinax/pinax/blob/master/LICENSE

In a different community (e.g. Linux), I would have picked a different
license.

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



Re: framework web comparison

2011-04-08 Thread bobhaugen
Another factor that was important to me was the community.  Django has
a friendly and helpful expert community.  When I was picking a
framework, I did not get the same impression from Rails.  Smelled more
like competitive-rockstar.

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



Re: Pinax: worth installing?

2011-01-19 Thread bobhaugen
I've gone a couple of different ways on Pinax:

* I have built sites using Pinax pretty much as is, and Pinax heavily
customized.

* I have also built sites that did not start with Pinax, but added
several apps blessed by Pinax and using Pinax conventions.

Both approaches worked well.

By the way, Pinax now provides several ready-to-use projects out of
the box, not just a social project.  More coming all the time,
including (I hear) community-developed open source projects.

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



Re: representing a possible future object in a form?

2010-11-18 Thread bobhaugen
On Nov 18, 12:18 am, Derek  wrote:
> It would be great if perhaps one of you could write up a more detailed
> description (i.e with code) of this as a blog entry... or maybe a wiki page?

Derek,  before I posted the vague description above, I looked at my
code for an example that is open source and also simple enough to
understand.

I'll post some links below, but beware, the code is very complicated
and may make no sense to anybody but me.  And I don't know how much of
that is necessary complexity, and how much is my inability to simplify
more.  A lot of it is necessary, but I'll explain one potential
simplification at the end of this message.

The use case is supply and demand and income planning for a local food
network.  Both producers and customers enter their plans for the
future in weekly table columns, with rows for products.  Any given
producer or customer may not have any plans for some products or some
weeks. Then another set of views collects them all in supply vs demand
and projected income tables.

The planning_table view is at:
https://github.com/bhaugen/foodnetwork/blob/master/distribution/views.py#L202

It calls plan_weeks:
https://github.com/bhaugen/foodnetwork/blob/master/distribution/view_helpers.py#L210
...which uses the class PlannedWeek:
https://github.com/bhaugen/foodnetwork/blob/master/distribution/view_helpers.py#L202
...and then it calls create_weekly_plan_forms:
https://github.com/bhaugen/foodnetwork/blob/master/distribution/view_helpers.py#L11

A lot of the complexity of the code is because the plan objects in the
database is by start and end date, not week.  In other words, not only
is the table sparse, it is also a different shape from the database
objects.  The database model is here:
https://github.com/bhaugen/foodnetwork/blob/master/distribution/models.py#L681

I hope that all communicated.  I would not recommend this as something
to emulate, but it does work.  Were I to do it over again, I would use
week number rather than dates, and may bite the bullet and refactor
that way, at the cost of converting existing data.

In other words, I think it would help if the data and the table
corresponded better, however sparse the data may be.

P.S. this project undergoes pretty constant change and is not
guaranteed to work at any given time.

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



Re: representing a possible future object in a form?

2010-11-17 Thread bobhaugen
I've done this several times, and Toby's description is pretty much
what I have done.

Sometimes three levels of non-data-model classes to represent the
matrix:
a table class
a row class
a cell class

Then formsets to populate the rows with data entry fields.

Then builder methods to morph the data-model objects into the cells
and rows, and from there to the formsets.  Usually one builder from
data to matrix classes, and another from matrix rows to formsets.

The formsets then populate the table rows.

Then a template with a table to represent the table class, with
formset form fields in the td's.

Then deconstruction methods to morph the formset forms with entries
back into the data-model objects.

Might be a simpler way, but that works.

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



Re: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread bobhaugen
Seems to be a general ferment on the topics of reusable Django apps
and best practices for modularizing large projects.

For example, 
http://groups.google.com/group/django-users/browse_thread/thread/22875fd287d0aa81

I expect the situation to improve, or at least change, a lot over the
next year.

In general, this is mostly about refactoring, so maybe this is a good
reference, although it tends to be java-oriented:
http://www.refactoring.com/

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



Re: Wiki in Django?

2010-09-13 Thread bobhaugen
http://github.com/bartTC/django-wakawaka
http://github.com/pinax/django-wakawaka

Does not run on flat files, but it is being actively developed and
used in Pinax.  You might need to check the diffs to figure out which
of the above versions to use.

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



Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
I am so dense sometimes...

I had forgotten that initial data in a formset is a *list* of
dictionaries.

So I set up the initial data in a loop over the available products,
and created a parallel list of product_descriptions in the same loop.

Then set up the formset, and looped over formset.forms adding the
parallel form.product_description to each.

Don't know why I didn't think of that at before I got stumped.  But
thanks again for leading me through the possibilities.

Might still be an simpler way to do it, but that way was simple enough.

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



Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
Bill,

thanks a ton for the conversation.

I will try some variations of that set of ideas over the weekend and
report back here with what works.

And you are correct, I am not now creating the formset forms in a
loop, but might try that as one variation.

-Bob

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



Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
On Sep 2, 2:54 pm, Bill Freeman  wrote:
> Let's start by agreeing on common terminology.  "property" has
>  a meaning in Python slightly different than its usage in some
> other languages, and I don't think that's what you mean.
>
> I'm thinking that what you mean by "property" on the form is what
> Python calls an attribute of the instance of the form class.  

Yeah, sorry about the term. Attribute is what I mean.

[some paragraphs elided for now...]

> And you want to include, somewhere between the statements above:
>
>    form.product_description = u'Some string involving "hanging weight"'
>
> Am I tracking so far?

Yeah, except I can do that easily for a normal form.  Am trying to
figure out how to do it for forms in a formset.  I can add the same
attribute with the same value to all forms in a formset by doing
something like:

for form in formset.forms:
form.project_description = "Beef etc."

But of course each product has a different description.

> If so, in your template, you should, at the appropriate point, be able to
> say:
>
>   {{ beef_form.product_description }}
>
> That should do what you would think.  The product_description attribute is
> not used automatically by anything, but is available for the variable 
> reference
> in the template.
>
> So, is this what you want, and if so have you tried it, and if so what don't
> you like about the result?

Works great and is less filling for regular forms, and I do it all the
time.  Including in my set-of-forms which is not a formset, which is
how I did it before formsets were invented.  I want to do the same
thing for forms in a formset.

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



Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread bobhaugen
Bill,

Thanks a lot for sticking with this question.

On Sep 2, 1:44 pm, Bill Freeman  wrote:
> I guess that what I'm saying is that when you get fussy about rendering, you
> need to write the html/css yourself.  Because you say you want read only for
> these fields, don't use the form field's rendering at all (or use a
> hidden field).

I don't want a field, I want an additional property on each form in
the formset, that I can set differently for each form.  I can do this
easily if I roll my own set-of-forms (not a formset) where I add to
each form something like form.product_description = "Beef, Whole,
choice or better, per pound hot hanging weight".

I swear, that is an actual product description. But so is
"Strawberries, pint".  So if I use a product_description field, and
put it in a table cell, I need to size the field to handle the Beef,
Whole etc.  and the table gets too wide for  the window. If I use a
non-field property, HTML wraps the cell nicely as needed.

> Or I may be totally misunderstanding the original problem.

I don't know, probably I am not communicating well, or maybe I am
missing something in your suggestions.  I did read through all of the
Django documentation on forms, formsets, form api, fields, etc., and
did not find anything that I could see helping.

And this forum thread appears to say that I cannot display the value
of the field in a template:
http://groups.google.com/group/django-users/browse_thread/thread/cb62abb7eeab54c4/

Thus the simplest thing I can think of is to add a non-field property
to each form, but I don't know how to do that with forms in a formset.

I suppose I could use a hidden field and extract and present the value
using javascript.

Or maybe I could create a custom widget that rendered its value as a
string, not an HTML input.

And if I can't find a way to add a simple non-field property to forms
in a formset, I will probably try the custom widget next.

Anyway, I do appreciate your followup reply.

-Bob

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



Re: how to add a non-field text property to forms in a formset

2010-09-01 Thread bobhaugen
On Sep 1, 12:17 pm, Bill Freeman  wrote:
> This seems to me to be a job for the template.  The forms documentation has
> a section on custom rendering which shows you how to iterate through the
> fields, or access them by name.  You would insert whatever HTML construct
> was appropriate for your text, providing a context variable giving its 
> contents,
> if necessary.

I guess I do not understand your reply.

I'm already iterating through the fields in the template, accessing
them by name.  Actually, many forms' worth of fields, in a many-rowed
table.  How would I display the product description for each row as
flexibly-wrapped text, rather than as a field widget?  That is what I
am trying to do.

Sorry if I am missing something that should have been obvious to me
from "whatever HTML construct".  Could you provide an example (or even
another hint), that works with a formset?

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



how to add a non-field text property to forms in a formset

2010-09-01 Thread bobhaugen
I often want to add properties to a formset that will fill a table
cell with flexibly wrapping, read-only descriptive text.  For example,
the description of a product, where the enterable field is the
quantity ordered.

If I use a field, the widget gets a fixed width and the contents do
not wrap (unless I use a Textarea, which then gets a fixed number of
rows).  The product descriptions can vary from one word to a military-
style extended riff on options.

Moreover, if I understand correctly, it is either not possible or
unwise to display the initial value of a field as a string.

So what I end up doing is rolling my own set of forms (that is, not
using a formset) where I can add extra text properties to each form at
will.

Any other better solutions to this problem?

Did I miss anything in the above description?

Thanks.

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



Re: custom vocabularies vs translation

2010-08-10 Thread bobhaugen
On Aug 9, 5:01 pm, cootetom  wrote:
> Using the language files is the solution here. Even if your site only
> supports the English language, it still means that you can have .po
> files for just English. Once you understand how it all hangs together
> you'll be away.

Thanks alot.

Did a test run on a small project; worked very smoothly.

Working on large project, very tedious finding and marking up all the
required strings, but expect it will work equally well in the end.

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



custom vocabularies vs translation

2010-08-09 Thread bobhaugen
I want to provide customizable vocabularies for an open-source django
project, where each deployer can use different terms for strings that
appear in templates (e.g. field names, form field descriptions, help
text, page titles, etc.)

Would django language files work for this purpose?  Everything will be
in English (at this stage), so that would involve (if I understand
correctly) customizing the English language .po file.  (Right?)

Does that smell like a reasonable solution?  Any hidden rocks?

Has anybody done anything like this, either using language files or
some other solution?  If so, how did you do it, and how did it work in
practice?

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



Re: Logic

2010-07-16 Thread bobhaugen
On Jul 16, 7:56 am, Ravango  wrote:
> I mean by web server, running a web site, which anyone could use to
> perform a specific task. In my case, I would be running a program that
> people might be interested to use. Towards building a web server,
> currently, using Django, I'm creating a local web server.

Do you mean a web server like Apache, or a web service that rides on
top of a web server. and many web services might run on top of the
same web server?

And what specific task that people might be interested to use do you
have in mind?  (I'm not trying to pry into anything that you consider
secret here, just trying to understand better what you mean.)

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



  1   2   >