Re: Access logged in user in models?

2008-10-04 Thread Ulises

> If I would do this in the view, I couldn't do something like this in
> the template:
>
> {% for category in categories %}
> {% for expense in category.get_monthly_expenses %}
> ...
> {% endfor %}
> {% endfor %}
>
> If I do it in the view, the only way I can think of it could be
> accomplished by stuffing categories in dictionaries, appending the
> expenses...
> Is this normal to do so?

You could still traverse a path along the lines of user -> expenses ->
categories which would let you skip those categories in which a
particular user hasn't incurred in expenses.

Unless I got you completely wrong, do you want to display only the
user's expenses and still display the grand total or is the total
displayed only the sum of the user's expenses?

Anyway, I still think that the heavy lifting should be done in a view
and that the template should be in charge of just displaying what has
been sent to it.

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Access logged in user in models?

2008-10-04 Thread Ulises

> Accessing the user from within the model seems somehow like a bad
> idea, but I can't see an other way to do this.

How about doing it in a view where you have access to the user object?
I reckon this is the type of stuff you normally do in views?

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generating widget based on class type for a Custom Form

2008-10-07 Thread Ulises

> and for other controls, I need to generate
>   

How about using widget.attrs?

http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.attrs

Best,

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django book says MSSQL works with 1.0...?

2008-10-09 Thread Ulises

> "As of version 1.0, Django supports five database engines:
> [...]
>* Microsoft SQL Server (http://www.microsoft.com/sql/)"
>
> I also see these seemingly-active django + MSSQL projects in Google
> code:
>
> http://code.google.com/p/django-mssql/
> http://code.google.com/p/django-pyodbc/

I'm currently using django-mssql with Django 1.0 no problems at all.

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django book says MSSQL works with 1.0...?

2008-10-09 Thread Ulises

> What server did you use?
>
> If not Apache + mod-python or mod-wsgi, please say more about your
> setup?

I haven't deployed just yet as I'm still developing. I'm open to
suggestions really :)

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: form fields

2008-10-10 Thread Ulises

> class GameForm(ModelForm):
>class Meta:
>model = Game
>time_days_W = forms.CharField(max_length=128, verbose_name="time")
>fields = ('white', 'black', 'time_days_W', 'inc_time')

The field definition should be in the scope of the main class definition as in:

class GameForm(ModelForm):
time_days_W = forms.CharField(max_length=128, verbose_name="time")

   class Meta:
   model = Game
   fields = ('white', 'black', 'time_days_W', 'inc_time')

Best,

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending the User model

2008-10-17 Thread Ulises

> AFAICT, there's some work going on to allow to replace the default
> User model with a custom one. But so far, the recommended solution is
> indeed to use a UserProfile. Else, there's the hackish (IOW : *not*
> recommended) solution - monkeypatching the User model
> http://www.amitu.com/blog/2007/july/django-extending-user-model/

If you want yet another hack you could use a custom authentication
backend with your own user model as described here:
http://monogroncho.com/2008/10/django-gotchas-part-2/ (shameless self
promotion here :)

U

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



intra server communication using django channels

2019-04-25 Thread Ulises Jimenez
So has anybody tried this?

I have an architecture as follows. I have 2 servers, one is running a 
django instance with channels. The other is running a media server which 
can communicate using websockets.

My plan is to 

1. have a client (browser) open a websocket connection with django, 
2. send some connection parameters and then 
3. django forwards this information to the media server

I'm currently having some problems implementing number 3 as I haven't found 
any examples of using django channels to open a websocket to an outside 
client unilaterally. Does anyone know if this is possible and if so where I 
could find an example or documentation about this use case?

Thanks,

Ulises

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