Re: How I could reset django admin pass in a buildout project

2011-12-29 Thread Reinout van Rees

On 29-12-11 17:48, Ashkan Roshanayi wrote:

Ouch! now I get:

Traceback (most recent call last):
   File "./bin/django", line 35, in 
 import djangorecipe.manage
ImportError: No module named djangorecipe.manage

should I set something in project/settings.py?


That error is normally impossible. You must have removed something by hand?

Could you look inside the bin/django script? It ought to have a 
"sys.path" list in there that shows you where it thinks it can find the 
djangorecipe. Make sure it is still there.


Or re-run your buildout, for instance.



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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: Maintain server-initiated FTP connection between client requests?

2011-12-29 Thread francescortiz
You will have to create a connection pool as a resident thread.
Briefly, a connection pool will take care of:
- Create a new connection if there is no connection available.
- Reuse a connection if possible.
- Remove connections that are no longer being used or that commanded
to close.

Then, your code will have have to communicate with the connection
pool. Example code:

# The connection_pool is smart enough to reuse a connection if it is
in the pool
ftp_connection = connection_pool.get_connection(server, user, pass)

current_dir = ftp_connection.getcwd()
dir_contents = ftp_connection.ls()
ftp_connection.rm(file)


You have a similar implementation here:
http://forum.codecall.net/python-tutorials/41844-object-pooling-python.html



On Dec 29, 2:51 am, Jordon Wing  wrote:
> Hey,
> I'm going to use ftplib to open up an FTP connection to an FTP server
> provided by the user.  The client will be sending FTP commands to my django
> server via Ajax, which will then be forwarded to the FTP server the user
> provided. However, I'd like to not have to create a new FTP server
> connection every time the client sends an FTP command. In other words, I
> want to keep the FTP connection alive between requests by the client.
>
> How would I do this? Would some sort of comet implementation be best? I was
> initially planning to use WebSockets until I discovered my host won't allow
> it. =\

-- 
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: Constraints on a one-to-many relationship and related problems

2011-12-29 Thread Bart Nagel
At 2011-12-28 06:21:38 -0800, Dan Gentry wrote:
> Just looking at the models, I'd like to make a couple of suggestions.
> 
> Instead of using a Foreign Key relationship in Customer to indicate
> the billing address,  I would include a flag called 'billing_address'
> in the Address table that would be set to True for the customer
> selected address.
> 
> An override of save() in the Address model is then used to enforce the
> 'only one billing address' rule.

This certainly simplifies things, but there are still a couple of 
problems.

Firstly, the user gets no warning if he checks multiple "is billing 
address" boxes on the inline forms and it doesn't seem to be totally 
predictable which of the addresses' save methods will be called, and 
then which will be called last, and therefore which will end up being 
marked as the billing address. Any suggestions? Or is there a way to 
make them show up as radio buttons?

Next, there's nothing to stop no addresses being given, or no 
addresses being marked as the billing address. I guess I could put the 
monkey patch back on so I can force the first address to be billing if 
none is. Is that the best solution to this problem? But even then the 
problem of how to stop a customer being created if no addresses are 
given remains.

Thanks.

--bart

-- 
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: Constraints on a one-to-many relationship and related problems

2011-12-29 Thread Bart Nagel
At 2011-12-28 06:59:31 -0800, Jay De Lanoy wrote:
> I'd go for a separate table instead, with something like
> 
> class BillingInfo(models.Model):
> customer = models.OneToOneField(Customer)
> billing_address = models.OneToOneField(Address)
> 
> and then just have logic in the views and templates to account for
> existence/nonexistence of a given customer's billing address.

Would this approach mean implementing my own forms to populate 
customers and addresses and not using the built-in Django admin forms 
at all? They were a major draw for me to Django.

Thanks.

--bart

-- 
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 I could reset django admin pass in a buildout project

2011-12-29 Thread Reinout van Rees

On 29-12-11 16:43, Ashkan Roshanayi wrote:

Hi, basically my project is that I don't know how can I access django shell in 
a buildout project!


I assume you're using djangorecipe? In that case: bin/django. That's the 
equivalent of "python manage.py", only with the right enviroment 
variable to your settings file pre-set.



So: "bin/django shell".

Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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.



Good notation for showing MVC interactions (i.e. Django)

2011-12-29 Thread Alec Taylor
Good morning,

I'm developing various websites and functionality to cater to various
different use-cases up in Django.

Is there a good notation for showing what behaviour is at each stage,
i.e. using swimlanes?

I use BPMN 2 notation for everything, but I feel I am overusing this,
and that there would be a more suitable one for this.

Thanks for all suggestions,

Alec Taylor

-- 
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 I could reset django admin pass in a buildout project

2011-12-29 Thread Ashkan Roshanayi
Ouch! now I get:

Traceback (most recent call last):
  File "./bin/django", line 35, in 
import djangorecipe.manage
ImportError: No module named djangorecipe.manage

should I set something in project/settings.py?

Best,

-- 
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/-/7TWo-1QCsDIJ.
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: CACHE_MIDDLEWARE_ANONYMOUS_ONLY isn't working for me

2011-12-29 Thread Brian Neal
I did some more experimenting. Perhaps I misunderstood the purpose of
CACHE_MIDDLEWARE_ANONYMOUS_ONLY.

The view in my example below is a simple generic list view, and it did
not interrogate request.user or make any
request.user.is_authenticated() type checks. If I add those checks to
the template, then after I change a model in the admin, I see the view
update with those changes when I am logged in. Unfortunately it also
updates even when I'm not logged in (testing with a 2nd browser).

So unless I am missing something, the usefulness of
CACHE_MIDDLEWARE_ANONYMOUS_ONLY is much more limited than I thought.


On Dec 28, 10:25 am, Brian Neal  wrote:
> I have CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True. It seems to cache pages
> even for people who have logged in. For example, I can log into the
> admin, and edit an object. If I then visit the view for that app, my
> changes do not get seen until the 5 minute cache timeout hits.
>
> I suspect my middleware order is not correct, but I have read and re-
> read the docs and I'm still confused.
>
> Here are my cache related settings:
>
> CACHES = {
>     'default': {
>         'BACKEND':
> 'django.core.cache.backends.memcached.MemcachedCache',
>         'LOCATION': '127.0.0.1:11211',
>         'TIMEOUT': 600,
>     },
>
> }
>
> CACHE_MIDDLEWARE_ALIAS = 'default'
> CACHE_MIDDLEWARE_SECONDS = 600
> CACHE_MIDDLEWARE_KEY_PREFIX = 'BNS'
> CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
>
> MIDDLEWARE_CLASSES.insert(0,
> 'django.middleware.cache.UpdateCacheMiddleware')
> MIDDLEWARE_CLASSES.append('django.middleware.cache.FetchFromCacheMiddleware ')
>
> Does anyone see anything wrong or have suggestions on how to debug
> this?
>
> Thanks,
> BN

-- 
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.



How I could reset django admin pass in a buildout project

2011-12-29 Thread Ashkan Roshanayi
Hi, basically my project is that I don't know how can I access django shell in 
a buildout project! 

Marry Christmas :)

--
Ashkan

-- 
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: Good notation for showing MVC interactions (i.e. Django)

2011-12-29 Thread Alec Taylor
An example of a BPMN2 diagram with swimlanes, which I created for a
project: http://i40.tinypic.com/262r6nr.jpg

What I am looking for is something suited towards showing architecture
bounds and the interactions between each section of MVC.

> I find that when thinking something through at the whiteboard with
> another developer, the most common diagram I'll use is a UML sequence
> diagram.  I drew one on the wall just yesterday.  Here's one
> (http://www.panix.com/~roy/SongzaSessionHandoff.pdf) I did up a bit
> fancier a while ago while working through a gnarly design problem.
>

That's a good notation, and one which I will use for RESTful API modelling.

I sometimes use use-case diagrams and quite rarely also use class
diagrams and ER Diagrams.

I use BPMN2 to show logic to both technical and non-technical team-members.

-- 
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.



no plus-sign to add related object in admin

2011-12-29 Thread K.C. Smith
I've got a project where when I pull up the admin page to add an
object (an object that has several foreign keys), some of the FK
fields show the little green plus-sign links to add a new related
object for that field and other FK fields do not.

In the past, I've seen the plus-sign link to add a new related object
on all of the FK fields.  Why would it not show up?

I'm using Django 1.2.5.

K.C.

-- 
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: no plus-sign to add related object in admin

2011-12-29 Thread Furbee
Just taking a stab in the dark, are the ones without the + sign editable in
the Admin? If they are not editable, I would imagine Django would not show
the + in the Admin.

Furbee

On Thu, Dec 29, 2011 at 12:58 PM, K.C. Smith  wrote:

> I've got a project where when I pull up the admin page to add an
> object (an object that has several foreign keys), some of the FK
> fields show the little green plus-sign links to add a new related
> object for that field and other FK fields do not.
>
> In the past, I've seen the plus-sign link to add a new related object
> on all of the FK fields.  Why would it not show up?
>
> I'm using Django 1.2.5.
>
> K.C.
>
> --
> 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.
>
>

-- 
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: Maintain server-initiated FTP connection between client requests?

2011-12-29 Thread Jordon Wing
Thanks! That looks to be exactly what I needed. I'll try implementing that 
and post on here if I have any further questions but it looks rather 
straightforward.

-- 
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/-/yneN0yqx0FoJ.
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.