Re: Looking for collaborators for an online marketplace project with Python, Django, React.js and Next.js

2024-02-12 Thread David Emanuel Sandoval
Hello - Holaa!

I would like to help.
Me gustaría colaborar.

I'm emasmach on github.

Un saludo.
See you.

El lun, 12 feb 2024, 12:08, T Y  escribió:

> im in. pls add me in git.
>
> tommyyama2020
>
>
> On Sun, Feb 11, 2024 at 1:55 AM Jorge Bueno 
> wrote:
>
>> The project:
>>
>> I am working on an exciting project that I think you might be interested
>> in. It's about an online marketplace similar to the US farmers and
>> livestock markets, but with an online focus. The project is already half
>> done, with a well-defined requirements list and backlog that will allow you
>> to learn a lot while contributing to a real project.
>>
>> Technologies:
>>
>> We are using Python and Django for the backend, Next.js and React for the
>> frontend.
>>
>> What we are looking for:
>>
>> We need help to get django working making python manage.py runserver and
>> also all the procedures to check it works well as unit tests right now we
>> have the following functionalities programmed the MVP:
>> 1.User Registration
>> User Profiles
>> Product Listing
>> 4.Search and Filters
>>  5.Shopping Cart
>>  6.Payment System
>> 7.Ratings and Reviews
>> 8.Messaging
>>  Notification system
>> 10.User management
>> Why collaborate:
>>
>> You will learn a lot: The project is well organized and will allow you to
>> work with modern and relevant technologies.
>> You will contribute to a real project: Your work will have a direct
>> impact on the success of the project.
>> You will be part of a community: We are a passionate team committed to
>> the success of the project.
>> How can you participate?
>>  You can access my public GitHub repository here:
>> https://github.com/Programacionpuntera/Marketplace-Supremo
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/153e4e9d-4453-4280-8b06-27c8cbd1f72fn%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAwLT1%3DL4M-nQ7vk5iQFFTNZOqx62sXqMvhfEEGEW0rJgY04Ag%40mail.gmail.com
> 
> .
>

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


Re: Django Channels and multi-tenant will this be a world of hurt?

2024-01-27 Thread David Emanuel Sandoval
Just like the one they posted, but with a few minor changes:

 async def __call__(self, scope, receive, send):
and:
return await self.inner(
dict(scope, schema_name=schema_name, multitenant=True), receive, send
)


Also, check if AuthMiddleware is using the channels.auth.get_user()
function within the correct schema.
David Emanuel Sandoval <https://www.linkedin.com/in/david-emanuel-sandoval/>
WEB DEVELOPER
+549 3734 607102

<https://linkedin.com/in/david-emanuel-sandoval/>
<https://github.com/emasmach/>





El sáb, 27 ene 2024 a las 14:14, David Emanuel Sandoval (<
davidemanuelsando...@gmail.com>) escribió:

> To identify the tenant i used a middleware that extract the tenant from
> the domain.
>
> El sáb, 27 ene 2024, 10:28, Nagaraja  escribió:
>
>> Y cnt u use pusher instead of channels
>>
>> On Sat, 27 Jan, 2024, 4:40 pm 'Sebastián García' via Django users, <
>> django-users@googlegroups.com> wrote:
>>
>>> Hi, I'm reviving this old thread... do you know of any other solution to
>>> the one proposed by @Ahmed Ishtiaque
>>>
>>> Thanks
>>> El domingo, 24 de febrero de 2019 a la(s) 9:13:30 p.m. UTC-3, Ahmed
>>> Ishtiaque escribió:
>>>
>>>> @N Muchai,
>>>>
>>>> I don't know if you've found a workaround to this, but here's mine if
>>>> people are interested in the future.
>>>>
>>>> I just made a custom ASGI application that adds the tenant schema name
>>>> (provided your URLs are in the form *.domain.com, where * represents
>>>> the schema name) and whether the project is multitenant or not. I haven't
>>>> thought much about whether the boolean for multitenancy identifier helps,
>>>> so feel free to remove it in your implementation. I just stacked this
>>>> application in my project's `routing.py` file. Here's the code I have at
>>>> the moment:
>>>>
>>>> My Middleware:
>>>> class MTSchemaMiddleware:
>>>> def __init__(self, inner):
>>>> self.inner = inner
>>>>
>>>> def __call__(self, scope):
>>>> if "headers" not in scope:
>>>> raise ValueError(
>>>> "MTSchemaMiddleware was passed a scope that did not
>>>> have a headers key "
>>>> + "(make sure it is only passed HTTP or WebSocket
>>>> connections)"
>>>> )
>>>>
>>>> for key, value in scope.get('headers', []):
>>>> if key == b'host':
>>>> schema_name = value.decode('ascii').split('.')[0]
>>>> break
>>>> else:
>>>> raise ValueError(
>>>> "The headers key in the scope is invalid. "
>>>> + "(make sure it is passed valid HTTP or WebSocket
>>>> connections)"
>>>> )
>>>> return self.inner(
>>>> dict(scope, schema_name=schema_name, multitenant=True)
>>>> )
>>>>
>>>> My `routing.py`:
>>>>
>>>> import MTSchemaMiddleware # from wherever your Middleware class resides
>>>> application = ProtocolTypeRouter({
>>>> 'websocket': (
>>>> MTSchemaMiddleware(
>>>> URLRouter(
>>>> chat.routing.websocket_urlpatterns
>>>> )
>>>> )
>>>> )
>>>> })
>>>>
>>>> After you do this, you will be able to access the `schema_name` and
>>>> `multitenant` variables inside your consumer's `scope` like this:
>>>> `schema_name = scope['schema_name']` or `multitenant =
>>>> scope[`multitenant`]`.
>>>>
>>>> Hope this helps someone!
>>>>
>>>> Best,
>>>> Ahmed
>>>>
>>>>
>>>>
>>>> On Thursday, January 10, 2019 at 7:22:40 AM UTC-5, N Muchai wrote:
>>>>>
>>>>> @Filbert,
>>>>>
>>>>> Am in the same exact spot using Django Channels with django-tenants. Did
>>>>> you find a way to identify the tenant?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> On Tuesday, November 28, 2017 at 4:22:10 AM UTC+3, Filbert wrote:
>>>>>>
>>>>>> Sorry, yeah dig before I post :-|  Can create a class-based consumer
>>>>>> and use the mes

Re: Django Channels and multi-tenant will this be a world of hurt?

2024-01-27 Thread David Emanuel Sandoval
To identify the tenant i used a middleware that extract the tenant from the
domain.

El sáb, 27 ene 2024, 10:28, Nagaraja  escribió:

> Y cnt u use pusher instead of channels
>
> On Sat, 27 Jan, 2024, 4:40 pm 'Sebastián García' via Django users, <
> django-users@googlegroups.com> wrote:
>
>> Hi, I'm reviving this old thread... do you know of any other solution to
>> the one proposed by @Ahmed Ishtiaque
>>
>> Thanks
>> El domingo, 24 de febrero de 2019 a la(s) 9:13:30 p.m. UTC-3, Ahmed
>> Ishtiaque escribió:
>>
>>> @N Muchai,
>>>
>>> I don't know if you've found a workaround to this, but here's mine if
>>> people are interested in the future.
>>>
>>> I just made a custom ASGI application that adds the tenant schema name
>>> (provided your URLs are in the form *.domain.com, where * represents
>>> the schema name) and whether the project is multitenant or not. I haven't
>>> thought much about whether the boolean for multitenancy identifier helps,
>>> so feel free to remove it in your implementation. I just stacked this
>>> application in my project's `routing.py` file. Here's the code I have at
>>> the moment:
>>>
>>> My Middleware:
>>> class MTSchemaMiddleware:
>>> def __init__(self, inner):
>>> self.inner = inner
>>>
>>> def __call__(self, scope):
>>> if "headers" not in scope:
>>> raise ValueError(
>>> "MTSchemaMiddleware was passed a scope that did not have
>>> a headers key "
>>> + "(make sure it is only passed HTTP or WebSocket
>>> connections)"
>>> )
>>>
>>> for key, value in scope.get('headers', []):
>>> if key == b'host':
>>> schema_name = value.decode('ascii').split('.')[0]
>>> break
>>> else:
>>> raise ValueError(
>>> "The headers key in the scope is invalid. "
>>> + "(make sure it is passed valid HTTP or WebSocket
>>> connections)"
>>> )
>>> return self.inner(
>>> dict(scope, schema_name=schema_name, multitenant=True)
>>> )
>>>
>>> My `routing.py`:
>>>
>>> import MTSchemaMiddleware # from wherever your Middleware class resides
>>> application = ProtocolTypeRouter({
>>> 'websocket': (
>>> MTSchemaMiddleware(
>>> URLRouter(
>>> chat.routing.websocket_urlpatterns
>>> )
>>> )
>>> )
>>> })
>>>
>>> After you do this, you will be able to access the `schema_name` and
>>> `multitenant` variables inside your consumer's `scope` like this:
>>> `schema_name = scope['schema_name']` or `multitenant =
>>> scope[`multitenant`]`.
>>>
>>> Hope this helps someone!
>>>
>>> Best,
>>> Ahmed
>>>
>>>
>>>
>>> On Thursday, January 10, 2019 at 7:22:40 AM UTC-5, N Muchai wrote:

 @Filbert,

 Am in the same exact spot using Django Channels with django-tenants. Did
 you find a way to identify the tenant?

 Thanks.

 On Tuesday, November 28, 2017 at 4:22:10 AM UTC+3, Filbert wrote:
>
> Sorry, yeah dig before I post :-|  Can create a class-based consumer
> and use the message->headers->host. I'll get chest deep before ask another
> question.
>
> On Monday, November 27, 2017 at 6:04:48 PM UTC-5, Andrew Godwin wrote:
>>
>> That would be correct (though please be aware Origin can be faked
>> like host headers, so don't use it as the sole point of security).
>>
>> Is it not available via the headers list in the connect message?
>>
>> Andrew
>>
>> On Mon, Nov 27, 2017 at 2:58 PM, Filbert  wrote:
>>
>>> Thanks again. One last question, in order to "multi-tenant-ify"
>>> Channels I think the challenge will be trickle the websocket "orgin" 
>>> into
>>> the consumer from Daphne somehow as it seems there is no way to know in 
>>> a
>>> consumer which tenant (unique domain) the message originated from. 
>>> Without
>>> the domain you can't establish the Postgres schema, without the schema 
>>> you
>>> have no tenant :-)
>>>
>>> Please confirm this would be the approach or whether I am
>>> wrong-headed here.
>>> Thanks.
>>>
>>> On Sunday, November 26, 2017 at 9:58:58 AM UTC-5, Andrew Godwin
>>> wrote:

 I've never used attach-daemon so I can't help you there I'm afraid.
 As long as it does sensible process-management things it's probably 
 alright?

 Andrew

 On Sat, Nov 25, 2017 at 5:17 PM, Filbert  wrote:

> Andrew,
> Thanks for the response. Seeing that I am keeping uWSGI for the
> non-websocket paths, any heartache with me starting daphne and the
> consumers using uWSGI's attach-daemon? I do this with celery and it 
> is a
> convenient way to have everything for the App managed as a unit via a
> single /etc/init (upstart) conf file.
> Thanks.
>
> On Friday, November 24, 2017 at 

Re: Re:

2023-07-19 Thread David Emanuel Sandoval
Just don't give up.

A degree is always good, it can open more doors.

But not all companies require a degree. You can even work remotely for a
company.
I myself got my first dev job with what would be the equivalent of a "high
school" education.
I never went to a university.
But I did work a lot to improve my skills in this field.
David Emanuel Sandoval <https://www.linkedin.com/in/david-emanuel-sandoval/>
WEB DEVELOPER
+549 3734 607102

<https://linkedin.com/in/david-emanuel-sandoval/>
<https://github.com/emasmach/>





El mié, 19 jul 2023 a las 11:06, Vitor Angheben ()
escribió:

> Hi Asim, I'm a fresh graduate in Industrial Engineer, but working with
> software development
>
> Please, check my profile on my LinkedIn, if you find it interesting let me
> know!!
>
> https://www.linkedin.com/in/vitor-a-5977a0b3/
>
> Best regards!
> --
> *De:* django-users@googlegroups.com  em
> nome de Ibtsam Khan 
> *Enviado:* terça-feira, 18 de julho de 2023 13:48
> *Para:* django-users@googlegroups.com 
> *Assunto:* Re:
>
> Hey I'm a fresh graduate from BS IT. And I'm a MERN Stack developer
> learning Django for the web. What do u think?
>
> On Tue, Jul 18, 2023, 9:08 PM Asim Sulehria 
> wrote:
>
> Do you have it or not ?
> We are just hiring Django developers as fresh graduates !
>
>
> On Tue, Jul 18, 2023 at 8:50 PM Vishesh Mangla 
> wrote:
>
> Degree is not sufficient. Memorizing 250 DSA questions is also a
> requirement.
>
> On Tue, 18 Jul, 2023, 21:18 Asim Sulehria,  wrote:
>
> For getting a Job into industry you need a proper degree !
> Do you have it or not?
>
> On Tue, Jul 18, 2023 at 8:36 PM Vishesh Mangla 
> wrote:
>
> No degree teaches django or even web development.
>
> On Tue, Jul 18, 2023 at 8:50 PM Asim Sulehria 
> wrote:
>
> Do you have a bachelor's degree in relevant field like Computer Science?/
> Software Engineering?/ Data Science?
>
> On Tue, Jul 18, 2023 at 8:16 PM utibe solomon 
> wrote:
>
> My number is 08102980007
>
> On Tue, Jul 18, 2023, 9:27 AM utibe solomon 
> wrote:
>
> Dear community, I am currently looking for a remote internship on Django
> to gain more experience in this field I currently have skills in django,
> database testing api development with rest framework using Django channels
> to integrate websockets and asgi connections I don't mind working for free
> but would also be glad if I'm payed thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJkiqy7MW-44%2BaPGVbhQ2ecY25Gg51jF8eN9AEoAgrdTLOrJsQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJkiqy7MW-44%2BaPGVbhQ2ecY25Gg51jF8eN9AEoAgrdTLOrJsQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPz57eEgE4Q_ZittJ4m07LJvjrCwb3RUOJvmatox5E4gtf2ZBQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPz57eEgE4Q_ZittJ4m07LJvjrCwb3RUOJvmatox5E4gtf2ZBQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACaE8x65jGdWeq5shKuN9C_91hPXJj_w%2B3SznQYqvF56gPVd4A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACaE8x65jGdWeq5shKuN9C_91hPXJj_w%2B3SznQYqvF56gPVd4A%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPz57eENzPCyUHBT71L025d69pnGOr0-8FpdLmUk9O_k4jWwvg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPz57eENzPCyUHBT71L025d69pnGOr0-8FpdLmUk9O_k4jWwvg%40mail.gmail.com?utm_me

Re: Exceeded conections to DB (postgres and django-tenants)

2023-02-23 Thread David Emanuel Sandoval
I want to make a correction:
I'm using django 3.2

El jue, 23 feb 2023 a las 16:11, David Emanuel Sandoval (<
davidemanuelsando...@gmail.com>) escribió:

> Hello everyone!
>
> I hope you can help me with a problem that I have from time to time (I
> wasn't able to replicate the error).
> The problem is that sometimes the connections to DB exceed the maximum
> number of allowed connections and I'm not sure why that happens. That
> causes the app to crash.
>
> I'm using:
> - Django 2.3
> - Django-tenants
> - Python 3.9
> - Postgres as database.
> - Celery for background tasks
>
> - The app runs on heroku.
>
> The problem occurs when we try to create a new client (creation of the
> schema in db, running the migrations and other stuff). In the view, after
> we validate the form we launch a celery task where the actual creation of
> the Client takes place. And it is at this point where the error occurs.
>
> Apparently there are some connections that block many others and the app
> tries to create more connections to db, which in turn blocks other
> processes. Finally the app stops working and crashes.
>
> Any ideas/thoughts about this?
> Also, I hope you can understand my english. :))
>
> Thanks in advance.
>
>
>

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


Exceeded conections to DB (postgres and django-tenants)

2023-02-23 Thread David Emanuel Sandoval
Hello everyone!

I hope you can help me with a problem that I have from time to time (I
wasn't able to replicate the error).
The problem is that sometimes the connections to DB exceed the maximum
number of allowed connections and I'm not sure why that happens. That
causes the app to crash.

I'm using:
- Django 2.3
- Django-tenants
- Python 3.9
- Postgres as database.
- Celery for background tasks

- The app runs on heroku.

The problem occurs when we try to create a new client (creation of the
schema in db, running the migrations and other stuff). In the view, after
we validate the form we launch a celery task where the actual creation of
the Client takes place. And it is at this point where the error occurs.

Apparently there are some connections that block many others and the app
tries to create more connections to db, which in turn blocks other
processes. Finally the app stops working and crashes.

Any ideas/thoughts about this?
Also, I hope you can understand my english. :))

Thanks in advance.

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


Re: django internationalization

2022-11-28 Thread David Emanuel Sandoval
Hi, in my case I'm not sure if I'm understanding the problem well.

Do you have a different url for every language? Are the urls also
translated?

In the docs i see they use a tag to get the correct url for the given
language, but as I said, I'm not sure if that is what you want.

https://docs.djangoproject.com/en/4.1/topics/i18n/translation/#reversing-in-templates

El lun, 28 nov 2022 16:54, Dhrub Kumar Sharma 
escribió:

> Hi everybody I am applying Django internalization for a multilingual site.
> I am facing a problem with making href URL dynamic instead of repeating
> same code manually.
>
> [image: url.png]
> I tried this but cant get perfect href dynamically. please help me same
> problem I am facing in language switcher href also.
>
> {% get_current_language as LANGUAGE_CODE %}
> {% get_available_languages as LANGUAGES %}
> {% get_language_info_list for LANGUAGES as languages %}
> {% get_language_info for LANGUAGE_CODE as lang %}
> {% for lang in languages %}
> 
> {% endfor %}
>
> [image: loop.png]
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6c5c96ea-9866-40b2-9c23-9b03d771ae7en%40googlegroups.com
> 
> .
>

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


Re: Template inheritance not working

2022-11-18 Thread David Emanuel Sandoval
The base template contains the default content, and blocks with default
contents in it. Then, in the child template, you can override those blocks.

El vie, 18 nov 2022 17:54, Alec Delaney <96alecpatr...@gmail.com> escribió:

> Hello. How are you? Can I see another example of template inheritance?
>
> On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed 
> wrote:
>
>> Hello dear
>> There is a little mistake in your code :
>> You should put the {%block block_name %} in your base template with no
>> code and the put the code you want to be displayed in your child template
>> file
>> Here is an example :
>>
>> // file.html :
>>
>> {% extends "index.html" %}
>>
>> {% block content %}
>> Hello, this is a test.
>> Help me.
>> {% endblock %}
>>
>> //index.html:
>> 
>> 
>> 
>> 
>> > >
>> Document
>> 
>> 
>> {% block content %}
>>
>> {% endblock %}
>> 
>> 
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>> 
>> .
>>
>>
>> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
>> wrote:
>>
>>> I have been trying to get my templates to work but they have been
>>> ineffective. here is my code:
>>> {% extends "index.html" %}
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Document
>>> 
>>> 
>>> 
>>> {% block content %}
>>>
>>>
>>> {% endblock %}
>>> 
>>> 
>>> 
>>>
>>> //index.html:
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Document
>>> 
>>> 
>>> {% block content %}
>>> Hello, this is a test.
>>> Help me.
>>> {% endblock %}
>>> 
>>> 
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFGN%3DGitQmZVFG_v1kKOk5s5r53NYCYKEGFZ1Pdi%2Bm%2BiMAFRig%40mail.gmail.com
> 
> .
>

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


Re: Django-tenants-schema and django-tenant

2022-11-14 Thread David Emanuel Sandoval
I work on a project using django tenants, so i know it works on heroku. I
just dont know how it was configured in the "dns" part.

El lun, 14 nov 2022 11:43, Alejandro hurtado chacñama 
escribió:

> 1:in your nginx configuration you should add something like:
> *server_name *.mydomain.com  mydomain.com
>  IP-server;*
>
> 2: in my case at the dns level I also add as class A, all the records of
> the subdomain. You have to do this where your domain is, I don't know if it
> can be configured in heroku
> El jueves, 24 de junio de 2021 a las 1:41:08 UTC-5, clas...@gmail.com
> escribió:
>
>> has no one use django-tenant on heroku?
>>
>> On Monday, June 21, 2021 at 9:38:19 PM UTC+1 clas...@gmail.com wrote:
>>
>>> Hello friends,
>>> Am having a big challenge hosting django-tenant-schemas I currently have
>>> one hosted in heroku but does not route the subdomain created for example I
>>> cant access sub.mydomain.com but mydomain.com works have tried wildcard
>>> on the subsomain through the domain hosting platform but no result yet I
>>> really want this to work in live production as all test has been done in
>>> dev mode and work fine using sub.loclhost:8000 no.all code are fine when
>>> deployed to heroku not jus get the subsomain.please is there any hosting
>>> platform that allow such multi-tenant app to work as expected.
>>> Await your swift response.
>>> Thanks
>>>
>>>
>>>
>>> Sent from my Galaxy
>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c61930ec-825b-44bf-a9f0-ef31be4ddf62n%40googlegroups.com
> 
> .
>

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


Re: Multitenant App

2022-11-07 Thread David Emanuel Sandoval
Hi, I'm not sure what you mean by updating all templates. In my case, when
I update a template, the changes are reflected in all tenants/clients.
David Emanuel Sandoval <https://www.linkedin.com/in/david-emanuel-sandoval/>
WEB DEVELOPER
+549 3734 607102

<https://linkedin.com/in/david-emanuel-sandoval/>
<https://github.com/emasmach/>





El lun, 7 nov 2022 a las 11:20, sebasti...@gmail.com (<
sebastian.ju...@gmail.com>) escribió:

> Hello,
>
> ich want sell my app on different companys. Now a part of apps all
> companys/templates use this but another apps/templates are customer
> specific. Now i want when i update code from apps/templates which all
> customer uses that i can update all customer on server as fast as possible.
>
> Here are a example:
>
> Customer 1
> common app
> customer invividual app #1
>
> template
> common app templates
> customer individual app templates
> Customer 2
> common app
> customer individual app #2
>
> template
> common app templates
> customer individual app templates
>
> How i can make this? Softlink or is there another better possibility?
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/987d7c53-cd73-4937-9a5d-b9053a6570c4n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/987d7c53-cd73-4937-9a5d-b9053a6570c4n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


Re: MultiTenant Connections

2016-11-18 Thread Emanuel Araújo


This link resolved a 
question: https://gist.github.com/bubenkoff/005ea57b63251dafe81f
I needed only change some line to work a python3 version.

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/f44f9284-9048-46e7-9c98-122b2eea02a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


MultiTenant Connections

2016-11-17 Thread Emanuel Araújo
Hi,

I need to implement multiconnections on distinct customers on my app.
the cenario is:
I have a website and my customers put on form a username.  So, I need that 
Django connect on postgresql setting schema-name same a username on 
request.  When I connect on postgresql with a username, the search_path is 
automatic set to same username.  It's ok.
A each connection must to set the username and search_path, cause each user 
has a unique schema on database.
This situation is ok when I had few customers, but now, a lot of customers 
are sign and I don't restart app when exists connections actives.
How to do that?  I Created a new schema on postgresql, created a new 
objects but I need that my app find it whitout restart django server.

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/5b799777-7811-4486-be1e-63d44b40f4e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse lookup in search_fields on Admin

2014-10-23 Thread Emanuel
Hi.

Yes, I do have another fields. And thanks a lot. I was focus on that 
particular field that I forgot to see that I had another relation in 
search_fields wich I was not  using the lookup. It works now. 

Thanks


Quinta-feira, 23 de Outubro de 2014 13:11:37 UTC+1, Collin Anderson 
escreveu:
>
> Hello,
>
> Your code looks right. Do you have other things in search_fields?
>
> Thanks,
> Collin
>
>

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


Reverse lookup in search_fields on Admin

2014-10-21 Thread Emanuel
Hello all!

I have this models:

class Article(models.Model):
  name = models.CharField(...)

class Sale(models.Model):
  ...

class SaleItems(models.Model):
  article = models.ForeignKey(Article)


And the Admin:
class SaleAdmin(admin.ModelAdmin):
  search_fields = ('...', < and here is the problem >

I want that in the Sale Index Page look all the sales that have sold the 
article "A"

To accomplished that I tried: 'saleitems__article__name' and it throws the 
following error:
"

Related Field got invalid lookup: icontains"

Is there a way to do the reverse lookup in search_fields?

Thanks id advance


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


Re: permissions and inlines issues

2014-10-10 Thread Emanuel
Thanks, it worked.

The final code
:
models.py
class BFlow(models.Model):
...
class Meta:
permissions = (("see_BFlow", "User can see BFlow in admin index page"),)

admin.py
class BFlowAdmin(admin.ModelAdmin):
def get_model_perms(self, request):
if request.user.has_perm('see_BFlow'):
return super(BFlowAdmin, self).get_model_perms(request)
return {}

And finally it worked :) Thanks




Sexta-feira, 10 de Outubro de 2014 18:53:29 UTC+1, Emanuel escreveu:
>
> Ok 
> Thanks, I will try and post here the result later
>
>
> Sexta-feira, 10 de Outubro de 2014 18:45:46 UTC+1, Collin Anderson 
> escreveu:
>>
>> Ohh, but it might still be possible to circumvent that hiding, so I'm not 
>> sure.
>>
>

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


Re: permissions and inlines issues

2014-10-10 Thread Emanuel
Ok 
Thanks, I will try and post here the result later


Sexta-feira, 10 de Outubro de 2014 18:45:46 UTC+1, Collin Anderson escreveu:
>
> Ohh, but it might still be possible to circumvent that hiding, so I'm not 
> sure.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/6d067e5b-55e4-468f-ade5-408288a7d738%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: permissions and inlines issues

2014-10-10 Thread Emanuel
Yes. But they have permission to them. But I want some people only have 
permission to see when the models are inlines from another model. And other 
people have permission to see always...

Thanks

Sexta-feira, 10 de Outubro de 2014 13:22:35 UTC+1, Collin Anderson escreveu:
>
> So the remaining problem is that models are showing up in the admin index 
> page when people don't have permission to them?
>

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


Re: permissions and inlines issues

2014-10-10 Thread Emanuel
Hi

Thanks for the answer. The current solution I had it's the one that you 
sugest.

But I still have the problem that on the index admin page shows the 
application.
The scenario is this:
A factory have a diary production (A)
And every day people produce Articles and to do that they use some Feedstock
I have two different models to control Articles and Feedstock flow, FlowB 
(B) and FlowC(C)

Some users can add a diary production, and in there add some articles and 
some feedstock
And for those users, the only way that Articles go in and feedstock go out 
is in the diary production (Diary)

But sometimes other people take some feedstock for other pruposes, and that 
not belong to the Diary. Also only the Administrator can allow that 
situation, and therefore he have to add an entrance directly on C. This is 
why I need to have C registered in Admin.

But to the other users can add C elements in the diary (A), they see C in 
index and I want them not to see, only the Administrator

Thanks

Quinta-feira, 9 de Outubro de 2014 21:02:28 UTC+1, Collin Anderson escreveu:
>
> Why can't the first two users edit the data the same way as user 3?
>
> I'd recommend overriding get_readonly_fields() on the ModelAdmin for A so 
> that all fields are readonly for the users who aren't allowed to edit model 
> A. They'll still need the "can edit" permission for model A.
>
> https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_readonly_fields
>
> I _think_ the inlines will automatically figure out if the user has 
> permission to edit them. Otherwise, you can override get_inline_instances() 
> to remove the inlines if they can't edit them.
>
> https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_inline_instances
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/8274079a-0f59-424d-81de-2dd5d5c3e90d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


permissions and inlines issues

2014-10-09 Thread Emanuel
Hi all!

I have this situation:

class A(models.Model):
   ...

class B(models.Model):
   ---

class C(models.Model):
   

Then I have User 1, User 2 and User 3

B and C are inlines for A

I register A, B and C in admin

I want User 1 and add and edit B and can't add or edit A

and I want User 2 can add and edit on A but not on A

But in both situations they can only do it (and see it) as they are Inlines

And I need A, B and C registered in admin because User 3 can add and edit B 
and C while they are not Inlines

I googled it and I can't find any solution

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


problem in translation

2014-05-13 Thread Emanuel
Hello!

I have a template with two block trans.

the template code:

{% extends "a.html" %}
{% load i18n %}

{% block pageTitle %}
{% trans "MyTitle" %}
{% endblock %}

{% block short_description %}
{% blocktrans %}
My short description
{% endblocktrans %}
{% endblock short_description %}

{% block description %}
{% blocktrans %}
 My ful body document
 By the way, can I add two lines in blocktrans? Of course I mean 
separated with the ENTER key. 
 Once I used easymode and it throws an error when using the carret 
symbol in the database
{% endblocktrans %}
{% endblock description %}
 

Translated and compiled. Everthing works. When rendering, one show 
translated and the other dont.
The short description and title works and the description dont :(

And I have another template that inherits from a.html, and it works fine. I 
simply can get it

Thanks in advanced


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


Re: Inlines in admin

2014-04-08 Thread Emanuel
It solves the problem.

Thanks


Segunda-feira, 7 de Abril de 2014 22:52:15 UTC+1, Marc Aymerich escreveu:
>
> On Mon, Apr 7, 2014 at 3:04 PM, Emanuel <costav...@gmail.com > 
> wrote: 
> > Hi all! 
> > 
> > I'm have the following models: 
> > 
> > Class A(models.Model): 
> >  pass 
> > 
> > 
> > Class Z(models.Model): 
> > pass 
> > 
> > 
> > Class B(models.Model): 
> >   a = models.ForeignKey(a) 
> >   z = models.ForeignKey(Z) 
> > 
> >def __unicode__(self): 
> >   return self.z 
> > 
> > 
> > Class C(models.Model): 
> >  b = models.ForeignKey(B) 
> > 
> > 
> > I Want in the admin add A,B and C objects. 
> > 
> > I know how to put inline objects of B in A. Everything works as 
> expected. 
> > But I want to create new C's in the same page. Something like having C 
> as an 
> > Inline of B, beeing B an Inline of A. It could appear all in popups... 
>
> nested inlines are not currently supported. A work around can be using 
> a readonly field on B inline that points to a B change view with C 
> inlines 
>
>
> class BInline(admin.TabularInline): 
> model = B 
> readonly_fields = ('c_link',) 
>
> def c_link(self, instance): 
>   if not instance.pk: 
> return '' 
>   url = reverse('admin:app_c_change', args=(instance.pk,)) 
>   popup = 'onclick="return showAddAnotherPopup(this);"' 
>   return '%s' % (url, popup, instance) 
>  c_link.allow_tags=True 
>
>
> class CInline(admin.TabularInline): 
>  model = C 
>
>
> class AModelAdmin(admin.ModelAdmin): 
>  inlines = [BInline] 
>
>
> class BModelAdmin(admin.ModelAdmin): 
> inlines = [Cinline] 
>

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


Inlines in admin

2014-04-07 Thread Emanuel
Hi all!

I'm have the following models:

Class A(models.Model):
 pass


Class Z(models.Model):
pass


Class B(models.Model):
  a = models.ForeignKey(a)
  z = models.ForeignKey(Z)

   def __unicode__(self):
  return self.z


Class C(models.Model):
 b = models.ForeignKey(B)


I Want in the admin add A,B and C objects.

I know how to put inline objects of B in A. Everything works as expected. 
But I want to create new C's in the same page. Something like having C as 
an Inline of B, beeing B an Inline of A. It could appear all in popups...

I dont want the user have to select B when adding C. If it was all in the 
same page I always have object A present and user just have to add C, 
without having trouble in knowing what it was B in the first place

Thanks


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


Fwd: help using django wsgi and apache

2012-03-06 Thread Emanuel Vitorino
Hello all

I'm trying to install a virtual web server at my place to host two websites.

I have installed apache and libapache2-mod-wsgi and it works fine.

I have a dynamic IP and I'm using a no-ip account and I'm not being able to
understand how to configure apache.

I already read some tutorials on the web and it's not working. The only
thing it works was a tutorial where I changed /etc/hosts file and put
wsgi.djangoserver related to my IP (in the tutorial was the public IP and I
put local IP used in routers DMZ) and when I put in web browser
http://wsgi.djangoserver it didn't show the wsgi app I've created. But when
I put mysite.no-ip.org it showed the app I've created to wsgi.djangoserver.

When I'm creating VirtualHosts I have <... *:80> or <...*:8080>. And also
have others with my no-ip account address <... mysite:80>.

Could you help me configuring apache? 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-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.



help using django wsgi and apache

2012-03-06 Thread Emanuel Vitorino
Hello all

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



problem with media

2010-12-01 Thread Emanuel Vitorino
Hi all!

I've recently updated my django version and now all my projects doesn't have
css and js from admin or from my apps

I've started new projects and it simply doesn't work

I've googled and I find out when we are using the deveopment server the
static files from admin should be server automatticly and yet doesn't work.

>From my own apps I'm using the django.contrib.staticfiles app and my old
code doesn't work.

My settings.py have this code:

import os
PROJECT_ROOT = os.path.dirname(__file__)
ROOT_DIR = os.path.dirname(PROJECT_ROOT)
...
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/s/media/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_URL = '/s/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
...
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
...
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, 'templates'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
)
...

My urls.py have this code:
urlpatterns += staticfiles_urlpatterns()

#This was the old version:
#if settings.DEBUG:
#urlpatterns += patterns('django.contrib.staticfiles.views',
   #(r'^%s(?P.*)' % settings.STATIC_URL, 'serve',
{'document_root': 'sss'}),#settings.STATIC_ROOT
#)


Before I realized that the admin was also with the same problem, I've edited
the django.contib.static.serve where I put a print statement like this:
print "%s -- %s" $ (path, document_root)
The result was:
/css/main.css -- None
I guess that the var document_root it's not being sent. I don't know...

Thanks in advanced

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



formset issue

2010-04-07 Thread Emanuel
I've send this post this morning:

Hi

I have a formset and I'm passing initial data:
  
  DeletionFormset = formset_factory(deletionForm, extra=0)
  formset = DeletionFormset(initial=make_initial_data(instance))

The initial data arrives to the constructor fine. 
When the construct bilds the forms it overrides a ChoiceField with a tuple 
wich comes on the make_initial_data return

def make_initial_data(i):
schools = School.objects.exclude(id=i.id)
s = []
for school in schools:
s.append((school.id, school.name))
n_schools = tuple(s)

pupils = Pupil.objects.filter(school=i)
ret = []
for pupil in pupils:
ret.append({
'pupil_id': pupil.id,
'pupil': pupil.user.get_full_name(),
'school': n_schools,
})
return ret

So far all works fine.

This is my form used in the formset:

class deletionForm(forms.Form):
  pupil_id = forms.IntegerField(widget=forms.HiddenInput)
  pupil = forms.CharField()
  action = forms.ChoiceField(widget=forms.RadioSelect(), 
choices=(('D',_('Delete')),('M',_('Move'
  school = forms.ChoiceField()

  def __init__(self, *args, **kwargs):
  super(deletionForm, self).__init__(*args, **kwargs)
  self.base_fields['school'] = 
forms.ChoiceField(choices=self.initial['school'])
  print self.base_fields['school'].choices

For testing it return a tuple with two indexes. In this print it shows the 
correct data in both select input, but in the form it only appears in the last 
select.

This the output for the print command: (school's names)
[(1, u'ABC'), (3, u'xpto')]
[(1, u'ABC'), (3, u'xpto')]


This is the select output in the rendered html:
...



 ...

HCT
xpto

...

What am I missing?

Thanks


After I sent it, somehow, it starts working by itself.
Now it doesn't work again. I've changed the form to only create the school 
field in the init but still doesn't work

My current code is now like this:
class deletionForm(forms.Form):
pupil_id = forms.IntegerField(widget=forms.HiddenInput)
pupil = forms.CharField()
action = forms.ChoiceField(widget=forms.RadioSelect(), 
choices=(('D',_('Delete')),('M',_('Move'
#school = forms.ChoiceField()

def __init__(self, *args, **kwargs):
super(deletionForm, self).__init__(*args, **kwargs)
print self.initial
if self.initial:
m_choices = self.initial['school']
self.base_fields['school'] = forms.ChoiceField(choices = m_choices)

If I print in the end of __init__ it's correct. But in the rendered html 
doesn't appear nothing in the first select.  But like this, because I'm only 
creating the school field in the init, in the first formset doesn't appear the 
select. Before it was empty, now it doesn't exists.

I spent all the afternoon googling for this, somebody know whats happening?

By the way, how can I put a selected attribute in one of the choices? In 
googling it says to put what I want to be default in value but doesn't do 
anything

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.



formset issue

2010-04-07 Thread Emanuel
Hi

I have a formset and I'm passing initial data:
  
  DeletionFormset = formset_factory(deletionForm, extra=0)
  formset = DeletionFormset(initial=make_initial_data(instance))

The initial data arrives to the constructor fine. 
When the construct bilds the forms it overrides a ChoiceField with a tuple 
wich comes on the make_initial_data return

def make_initial_data(i):
schools = School.objects.exclude(id=i.id)
s = []
for school in schools:
s.append((school.id, school.name))
n_schools = tuple(s)

pupils = Pupil.objects.filter(school=i)
ret = []
for pupil in pupils:
ret.append({
'pupil_id': pupil.id,
'pupil': pupil.user.get_full_name(),
'school': n_schools,
})
return ret

So far all works fine.

This is my form used in the formset:

class deletionForm(forms.Form):
  pupil_id = forms.IntegerField(widget=forms.HiddenInput)
  pupil = forms.CharField()
  action = forms.ChoiceField(widget=forms.RadioSelect(), 
choices=(('D',_('Delete')),('M',_('Move'
  school = forms.ChoiceField()

  def __init__(self, *args, **kwargs):
  super(deletionForm, self).__init__(*args, **kwargs)
  self.base_fields['school'] = 
forms.ChoiceField(choices=self.initial['school'])
  print self.base_fields['school'].choices

For testing it return a tuple with two indexes. In this print it shows the 
correct data in both select input, but in the form it only appears in the last 
select.

This the output for the print command: (school's names)
[(1, u'ABC'), (3, u'xpto')]
[(1, u'ABC'), (3, u'xpto')]


This is the select output in the rendered html:
...



 ...

HCT
xpto

...

What am I missing?

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.



modelform validation

2010-03-31 Thread Emanuel
Hi all!

I have a modelform and I want to customize validation.

I'm overriding the method clean_().

When I'm saving the form I want to see if a specific user has been already 
assigned to a project. The only way he can ben assigned again is if he's an 
inactive user, so:

models.py
Class User(models.Model):
name = models.CharField(...)
active = models.BooleanField()
...

Class Project(models.Model):
user = models.ForeignKey(User)

**

forms.py
Class ProjectForm(ModelForm)

def clean_name(self):
user = self.cleaned_data['user']
if User.objecs.filter(user.id, active=True):
raise forms.ValidationError(_("This man has been 
already assign 
to a partner"))
return user


When I'm creating a new project it works fine (I believe, haven't been tested 
yet), but when editing it throws an error because the user already exists, and 
that's obvious. So, I want to be able to verify if it is a new instance or if 
it is an instance being edited. 


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.



modelform validation

2010-03-31 Thread Emanuel
Hi all!

I have a modelform and I want to customize validation.

I'm overriding the method clean_().

When I'm saving the form I want to see if a specific user has been already 
assigned to a project. The only way he can ben assigned again is if he's an 
inactive user, so:

models.py
Class User(models.Model):
name = models.CharField(...)
active = models.BooleanField()
...

Class Project(models.Model):
user = models.ForeignKey(User)

**

forms.py
Class ProjectForm(ModelForm)

def clean_name(self):
user = self.cleaned_data['user']
if User.objecs.filter(user.id, active=True):
raise forms.ValidationError(_("This man has been 
already assign 
to a partner"))
return user


When I'm creating a new project it works fine (I believe, haven't been tested 
yet), but when editing it throws an error because the user already exists, and 
that's obvious. So, I want to be able to verify if it is a new instance or if 
it is an instance being edited. 


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.



raw sql

2010-03-28 Thread Emanuel
Hi!

A few days ago I've post a question about changing the unicode on a form
This was the answer:

one way is to override __init__. Here is a sample:
class Accountaddform(ModelForm):
def __init__(self,head,*args,**kwargs):
super (Accountaddform,self).__init__(*args,**kwargs)
self.head = head
self.fields['head'].queryset=Account.objects.filter(pk=self.head)
class Meta:
model = Account

(thanks Kenneth Gonsalves, it works as I wanted!)

Now I want to change the queryset.
I'm using the contib.auth.
I have a model wich I named Teacher and another wich I named Pupil.

After a user sign in the system, the admin classifies him as a theacher or a 
pupil. 
In self.fields['head'].queryset=Account.objects.filter(pk=self.head) I want to 
change the queryset to only appears the pupils, it should return all the 
records wich have an id in both models User and Pupil.

Now I have this

class Pupil(models.Model):
user = models.ForeignKey(User)
nr = models.IntegerField(blank=True,)
gender = models.CharField(max_length=1, blank=True, 
choices=gender_choices)
...

class Teacher(models.Model):
user = models.ForeignKey(User)
schools = models.ManyToManyField(School, null=True, blank=True)
...


class Couple(models.Model):
man = models.ForeignKey(Aluno, related_name='man',)
woman = models.ForeignKey(Aluno, related_name='woman',)
...
   

class CoupleForm(ModelForm):
class Meta:
model = Couple

def __init__(self, *args, **kwargs):
super(CoupleForm, self).__init__(*args, **kwargs)
self.fields['man'].queryset=Pupil.objects.filter(gender='M')
self.fields['woman'].queryset=Pupil.objects.filter(gender='F')

It returns only the man and woman for each combo box. Now, also, I only want 
the User wich aren't Teacher. How can I do this? I've tried with Manager.raw() 
but it doesn't work or I don't know how to use it

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.



help needed in ModelForm __unicode__

2010-03-26 Thread Emanuel
Hi!

I Have this model:
class Person(models.Model):
user = models.ForeignKey(User)
nr = models.IntegerField(blank=True,)
gender = models.CharField(max_length=1, blank=True, 
choices=gender_choices)


def __unicode__(self):
return self.user.get_full_name()


I'm using a modelForm of this form.

I have another model:
class Couple(models.Model):
season = models.ForeignKey(season)
man = models.ForeignKey(Person, related_name='man',)
woman = models.ForeignKey(Person, related_name='woman',)


And I'm also using a modelForm of this one.

In the template I  have a combobox for the man and for the woman wich shows 
the __unicode__ method of Person model, but it shows both women and men in 
both combo's.
I want to filter only men or women depending the case. Is it possible? Or 
should I create another method for independent cases? If it is the solution 
how can I use it? I'm not getting there because it is a instance of a class...


Thanks
Emanuel

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