Re: Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

2022-02-03 Thread Richard Mayebo
mysql-connector-python 8.0.27 has another bug (see
https://stackoverflow.com/questions/69900463/django-migration-error-typeerror-sequence-item-1-expected-a-bytes-like-object
)
so I did not try it.

mysql-connector-python 8.0.26 did not have this problem with Django 3.1. So
the bug must have been introduced in the transition to Django 3.2.

>From what I am picking up (for example from Lakshyaraj Dash above),
mysql-connector-python seems to be buggy generally and mysqlclient should
be used as the first choice.

On Thu, Feb 3, 2022 at 4:14 PM Jason  wrote:

> can you observe the same behavior in previous versions of connector?  You
> listed two patch versions, makes me curious where in the 8.x version line
> this works.  Likely this is an issue with mysql-connector-python, but with
> it being an Oracle product, it doesn't have much internal visibility.  So
> could be helpful to downgrade versions till you get a working one.
>
> On Wednesday, February 2, 2022 at 9:01:51 PM UTC-5 dashlaksh...@gmail.com
> wrote:
>
>> Use only the mysqlclient package to populate your admin site with MySQL
>> database.
>>
>> You can watch this tutorial also : https://youtu.be/SNyCV8vOr-g
>>
>> On Thu, Feb 3, 2022, 06:19 Richard Mayebo  wrote:
>>
>>> Platform: Observed on Ubuntu 20.04
>>>
>>>
>>>1. Install MySQL (Observed on 5.7 and 8.0)
>>>2. Create a Virtual environment using venv, and activate it.
>>>3. Install Django 3.2.11
>>>4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
>>>5. Install django-easy-audit and/or django-axes (both these third
>>>party packages populate the Django Admin Site, where the apparent bug
>>>    manifests).
>>>6. Create a superuser (python manage.py createsuperuser)
>>>7. Start Django (python manage.py runserver)
>>>8. Launch the Django Admin Site and log in with the superuser.
>>>9. The pane on the left hand side will have links to objects created
>>>by django-easy-audit and/or django-axes, depending on what was installed.
>>>10. Click on the "Request event" link under "Easy Audit Application"
>>>or "Access logs" under "Axes"
>>>11. RESULT:
>>>
>>> Template error: In template
>>> /home//.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html,
>>> error at line 44
>>>
>>>'NoneType' object has no attribute 'day' [*OR  'NoneType' object has
>>> no attribute 'month'*]
>>>
>>> This behaviour is observed on MySQL 5.7.37 and 8.0.26 using
>>> my-sql-connector 8.0.26 and 8.0.28.
>>>
>>> Replacing MySQL with SQLite or PostgreSQL 12 solves the issue.
>>>
>>> Replacing the connector with mysqlclient-2.1.0 solves the issue.
>>>
>>> This implies there is a bug in the interaction between third-party
>>> packages like django-easy-audit and django-axes, Django 3.2.11 and
>>> my-sql-connector 8.0.26 and 8.0.28.
>>>
>>> Has similar behaviour been observed by anyone else? In any case, how can
>>> this be brought to the attention of the development team?
>>>
>>> My apologies if this is the wrong forum for this post. I am new at this.
>>> Regards,
>>> Richard.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/s1s42RcxNMQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d3eda24e-ab25-406c-9992-3af6f98701c1n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d3eda24e-ab25-406c-9992-3af6f98701c1n%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/CAHYamgAJvB8M9b3c_Mqd8t7ZbbWMnYjjCHhF-Cvme9V%3D18E3fA%40mail.gmail.com.


Re: Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

2022-02-03 Thread Jason
can you observe the same behavior in previous versions of connector?  You 
listed two patch versions, makes me curious where in the 8.x version line 
this works.  Likely this is an issue with mysql-connector-python, but with 
it being an Oracle product, it doesn't have much internal visibility.  So 
could be helpful to downgrade versions till you get a working one.

On Wednesday, February 2, 2022 at 9:01:51 PM UTC-5 dashlaksh...@gmail.com 
wrote:

> Use only the mysqlclient package to populate your admin site with MySQL 
> database.
>
> You can watch this tutorial also : https://youtu.be/SNyCV8vOr-g
>
> On Thu, Feb 3, 2022, 06:19 Richard Mayebo  wrote:
>
>> Platform: Observed on Ubuntu 20.04
>>
>>
>>1. Install MySQL (Observed on 5.7 and 8.0)
>>2. Create a Virtual environment using venv, and activate it.
>>3. Install Django 3.2.11
>>4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
>>5. Install django-easy-audit and/or django-axes (both these third 
>>party packages populate the Django Admin Site, where the apparent bug 
>>manifests).
>>6. Create a superuser (python manage.py createsuperuser)
>>7. Start Django (python manage.py runserver)
>>8. Launch the Django Admin Site and log in with the superuser.
>>9. The pane on the left hand side will have links to objects created 
>>by django-easy-audit and/or django-axes, depending on what was installed.
>>10. Click on the "Request event" link under "Easy Audit Application" 
>>or "Access logs" under "Axes"
>>11. RESULT: 
>>
>> Template error: In template 
>> /home//.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html,
>>  
>> error at line 44
>>
>>'NoneType' object has no attribute 'day' [*OR  'NoneType' object has 
>> no attribute 'month'*] 
>>
>> This behaviour is observed on MySQL 5.7.37 and 8.0.26 using 
>> my-sql-connector 8.0.26 and 8.0.28.
>>
>> Replacing MySQL with SQLite or PostgreSQL 12 solves the issue. 
>>
>> Replacing the connector with mysqlclient-2.1.0 solves the issue. 
>>
>> This implies there is a bug in the interaction between third-party 
>> packages like django-easy-audit and django-axes, Django 3.2.11 and 
>> my-sql-connector 8.0.26 and 8.0.28.
>>
>> Has similar behaviour been observed by anyone else? In any case, how can 
>> this be brought to the attention of the development team?
>>
>> My apologies if this is the wrong forum for this post. I am new at this.
>> Regards,
>> Richard.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%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/d3eda24e-ab25-406c-9992-3af6f98701c1n%40googlegroups.com.


Re: Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

2022-02-02 Thread Lakshyaraj Dash X-D 25
Use only the mysqlclient package to populate your admin site with MySQL
database.

You can watch this tutorial also : https://youtu.be/SNyCV8vOr-g

On Thu, Feb 3, 2022, 06:19 Richard Mayebo  wrote:

> Platform: Observed on Ubuntu 20.04
>
>
>1. Install MySQL (Observed on 5.7 and 8.0)
>2. Create a Virtual environment using venv, and activate it.
>3. Install Django 3.2.11
>4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
>5. Install django-easy-audit and/or django-axes (both these third
>party packages populate the Django Admin Site, where the apparent bug
>manifests).
>6. Create a superuser (python manage.py createsuperuser)
>7. Start Django (python manage.py runserver)
>8. Launch the Django Admin Site and log in with the superuser.
>9. The pane on the left hand side will have links to objects created
>by django-easy-audit and/or django-axes, depending on what was installed.
>10. Click on the "Request event" link under "Easy Audit Application"
>or "Access logs" under "Axes"
>11. RESULT:
>
> Template error: In template
> /home//.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html,
> error at line 44
>
>'NoneType' object has no attribute 'day' [*OR  'NoneType' object has
> no attribute 'month'*]
>
> This behaviour is observed on MySQL 5.7.37 and 8.0.26 using
> my-sql-connector 8.0.26 and 8.0.28.
>
> Replacing MySQL with SQLite or PostgreSQL 12 solves the issue.
>
> Replacing the connector with mysqlclient-2.1.0 solves the issue.
>
> This implies there is a bug in the interaction between third-party
> packages like django-easy-audit and django-axes, Django 3.2.11 and
> my-sql-connector 8.0.26 and 8.0.28.
>
> Has similar behaviour been observed by anyone else? In any case, how can
> this be brought to the attention of the development team?
>
> My apologies if this is the wrong forum for this post. I am new at this.
> Regards,
> Richard.
>
> --
> 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/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%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/CAF7qQgCXChSXEoZsFHLK1gcCVh7pPdhiAqrOdmxOXdVdtYPinw%40mail.gmail.com.


Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

2022-02-02 Thread Richard Mayebo
Platform: Observed on Ubuntu 20.04


   1. Install MySQL (Observed on 5.7 and 8.0)
   2. Create a Virtual environment using venv, and activate it.
   3. Install Django 3.2.11
   4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
   5. Install django-easy-audit and/or django-axes (both these third party 
   packages populate the Django Admin Site, where the apparent bug manifests).
   6. Create a superuser (python manage.py createsuperuser)
   7. Start Django (python manage.py runserver)
   8. Launch the Django Admin Site and log in with the superuser.
   9. The pane on the left hand side will have links to objects created by 
   django-easy-audit and/or django-axes, depending on what was installed.
   10. Click on the "Request event" link under "Easy Audit Application" or 
   "Access logs" under "Axes"
   11. RESULT: 

Template error: In template 
/home//.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html,
 
error at line 44

   'NoneType' object has no attribute 'day' [*OR  'NoneType' object has no 
attribute 'month'*] 

This behaviour is observed on MySQL 5.7.37 and 8.0.26 using 
my-sql-connector 8.0.26 and 8.0.28.

Replacing MySQL with SQLite or PostgreSQL 12 solves the issue. 

Replacing the connector with mysqlclient-2.1.0 solves the issue. 

This implies there is a bug in the interaction between third-party packages 
like django-easy-audit and django-axes, Django 3.2.11 and my-sql-connector 
8.0.26 and 8.0.28.

Has similar behaviour been observed by anyone else? In any case, how can 
this be brought to the attention of the development team?

My apologies if this is the wrong forum for this post. I am new at this.
Regards,
Richard.

-- 
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/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com.


Sorting in Django admin site on different locale

2021-12-06 Thread Roland Leners
I am currently learning Python and Django via building a simple Web 
application. It involves objects with character fields that take values in 
different languages (French and Spanish) and I face an issue with sorting 
on those values in the Django administration site. 

Here are sample sets:
French: dataFr = ['être', 'gronder', 'gérer', 'éviter', 'exiger']
Spanish: dataEs = ['dos', 'acompasar', 'acompañar', 'día']

The following works fine in Python:

import locale
locale.setlocale(locale.LC_ALL,"fr_FR.utf8") 
sorted(dataFr, key=locale.strxfrm) 
> ['être', 'éviter', 'exiger', 'gérer', 'gronder'] #which is the desired 
result.
sorted(dataEs, key=locale.strxfrm)
> ['acompañar', 'acompasar', 'día', 'dos'] #which is also the desired 
result.

(French as well as Spanish local settings seem to work indifferently for 
sorting  French and Spanish)

In Django, the simplified model is as follows:

from django import models

class Word(models.Model):
content = models.CharField(max_length=32, unique=True)
class Meta:
abstract = True

class FrenchWord(Word)

The relevant part of the admin.py file is:

from django.contrib import admin
from .models import FrenchWord

@admin.register(FrenchWord)
class FrenchWord(admin.ModelAdmin):
list_display = ('content',)
ordering = ('content',)

Now my question is how to enforce ordering according to the fr_FR.utf8 
locale? I have tried all kinds of stuff, taking inspiration from various 
sites, but I do not succeed.

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/865309b0-8869-4542-8ff4-b4941ecd4f47n%40googlegroups.com.


Re: Issue in rendering of Inline forms on Django Admin site

2021-12-01 Thread Gabo LaTo
Nope, sorry I missread

El mié, 1 de dic. de 2021 a la(s) 19:05, Gabo LaTo (elgatogabr...@gmail.com)
escribió:

> Aren't you missing the model class attribute in TestMyModelCreate?
>
> Like this:
>
> class TestMyModelCreate(admin.ModelAdmin):
> model = MyModel
> fields = ['text', ]
> inlines = [RelatedModelInlineTabular]
>
>
>
> El lun, 29 de nov. de 2021 a la(s) 20:28, 'Andrea Arighi' via Django users
> (django-users@googlegroups.com) escribió:
>
>> Good evening,
>> I am encountering a weird bug when rendering Inline forms on the "Add"
>> view of a ModelAdmin.
>>
>> Here is a minimum example with Django version 2.2.4
>>
>> - - - - - - -
>>
>> in models.py:
>>
>> class MyModel(models.Model):
>> text = models.CharField(max_length=100)
>>
>> class RelatedModel(models.Model):
>> parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
>> number = models.DecimalField(decimal_places=2, max_digits=10, 
>> null=False, blank=False)
>>
>>
>> in admin.py:
>>
>> class RelatedModelInlineTabular(admin.TabularInline):
>> model = RelatedModel
>> show_change_link = False
>> fields = ("number", )
>>
>> class TestMyModelCreate(admin.ModelAdmin):
>> fields = ['text', ]
>> inlines = [RelatedModelInlineTabular]
>>
>> admin.site.register(MyModel, TestMyModelCreate)
>>
>>
>> Steps to replicate:
>>
>>- Login to django admin website
>>- open the "add" view for MyModel (i.e. navigate to the list of
>>Models and click on the "Add new" button
>>
>>
>> Expected result:
>> The form displays an empty text field. Below that, an Inline form is
>> displayed with 3 empty rows for potential related instances of
>> RelatedModel
>>
>> Actual result:
>> The Inline form is displayed twice, each instance with its own 3 empty
>> rows, as if I had specified it twice.
>>
>> - - - - - -
>> I attach screenshots of the actual page ( Discount is the related
>> Model). Please note that I get the same result with both StackedInline and
>> TabularInline.
>>
>> [image: immagine.png]
>>
>> Am I making some trivial error here that could explain what's happening?
>> Or is this is a known bug? Thank you in advance to anyone that will help.
>>
>> Best regards
>> *  *  *  *  *
>> Andrea Arighi ~ Software Developer
>> Please consider the environment before printing this email
>>
>> --
>> 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/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%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/CAF6hzDOmrN4dOc_LHxQmfXSWAuaR63gcEPwou3S-Wq8XHkTxgQ%40mail.gmail.com.


Re: Issue in rendering of Inline forms on Django Admin site

2021-12-01 Thread Gabo LaTo
Aren't you missing the model class attribute in TestMyModelCreate?

Like this:

class TestMyModelCreate(admin.ModelAdmin):
model = MyModel
fields = ['text', ]
inlines = [RelatedModelInlineTabular]



El lun, 29 de nov. de 2021 a la(s) 20:28, 'Andrea Arighi' via Django users (
django-users@googlegroups.com) escribió:

> Good evening,
> I am encountering a weird bug when rendering Inline forms on the "Add"
> view of a ModelAdmin.
>
> Here is a minimum example with Django version 2.2.4
>
> - - - - - - -
>
> in models.py:
>
> class MyModel(models.Model):
> text = models.CharField(max_length=100)
>
> class RelatedModel(models.Model):
> parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
> number = models.DecimalField(decimal_places=2, max_digits=10, null=False, 
> blank=False)
>
>
> in admin.py:
>
> class RelatedModelInlineTabular(admin.TabularInline):
> model = RelatedModel
> show_change_link = False
> fields = ("number", )
>
> class TestMyModelCreate(admin.ModelAdmin):
> fields = ['text', ]
> inlines = [RelatedModelInlineTabular]
>
> admin.site.register(MyModel, TestMyModelCreate)
>
>
> Steps to replicate:
>
>- Login to django admin website
>- open the "add" view for MyModel (i.e. navigate to the list of Models
>and click on the "Add new" button
>
>
> Expected result:
> The form displays an empty text field. Below that, an Inline form is
> displayed with 3 empty rows for potential related instances of
> RelatedModel
>
> Actual result:
> The Inline form is displayed twice, each instance with its own 3 empty
> rows, as if I had specified it twice.
>
> - - - - - -
> I attach screenshots of the actual page ( Discount is the related Model).
> Please note that I get the same result with both StackedInline and
> TabularInline.
>
> [image: immagine.png]
>
> Am I making some trivial error here that could explain what's happening?
> Or is this is a known bug? Thank you in advance to anyone that will help.
>
> Best regards
> *  *  *  *  *
> Andrea Arighi ~ Software Developer
> Please consider the environment before printing this email
>
> --
> 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/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%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/CAF6hzDOLZ8%2B3Q_t7da8Hjw1uaYKvLAE5m8jx2MkwgG9ji8eBAw%40mail.gmail.com.


Issue in rendering of Inline forms on Django Admin site

2021-11-29 Thread 'Andrea Arighi' via Django users
Good evening,
I am encountering a weird bug when rendering Inline forms on the "Add" view
of a ModelAdmin.

Here is a minimum example with Django version 2.2.4

- - - - - - -

in models.py:

class MyModel(models.Model):
text = models.CharField(max_length=100)

class RelatedModel(models.Model):
parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
number = models.DecimalField(decimal_places=2, max_digits=10,
null=False, blank=False)


in admin.py:

class RelatedModelInlineTabular(admin.TabularInline):
model = RelatedModel
show_change_link = False
fields = ("number", )

class TestMyModelCreate(admin.ModelAdmin):
fields = ['text', ]
inlines = [RelatedModelInlineTabular]

admin.site.register(MyModel, TestMyModelCreate)


Steps to replicate:

   - Login to django admin website
   - open the "add" view for MyModel (i.e. navigate to the list of Models
   and click on the "Add new" button


Expected result:
The form displays an empty text field. Below that, an Inline form is
displayed with 3 empty rows for potential related instances of RelatedModel

Actual result:
The Inline form is displayed twice, each instance with its own 3 empty
rows, as if I had specified it twice.

- - - - - -
I attach screenshots of the actual page ( Discount is the related Model).
Please note that I get the same result with both StackedInline and
TabularInline.

[image: immagine.png]

Am I making some trivial error here that could explain what's happening? Or
is this is a known bug? Thank you in advance to anyone that will help.

Best regards
*  *  *  *  *
Andrea Arighi ~ Software Developer
Please consider the environment before printing this email

-- 
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/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com.


Admin Site Permissions issue with one particular model

2021-06-23 Thread Jimmy Gawain
This is in reference to an issue with the Django admin site in Django v2.2.
I have admin set up for two models: Group and GroupMember.

GroupMember works fine.
When I try to go to the change page for a Group object in my
staff admin area I get a permission error:

*You are authenticated as XX, but are not authorized to access this 
page. Would you like to login to a different account?*

I have two admin sites, site_admin and staff_admin which I use to 
differentiate between control capabilities for the superuser and for those 
accounts that have a is_staff attribute set to True. All other staff_admin 
areas work fine.

Admin Site definitions:

class SiteAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_superuser and request.user.is_active

class StaffAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_staff and request.user.is_active

staff_admin = StaffAdminSite(name='staff')
site_admin = SiteAdminSite(name='admin')

I have an app, member, that has the two classes pertinent to this issue:

class Group(BaseModelUUID):
class Meta:
db_table = 'group'
...

class GroupMember(BaseModelUUID):
class Meta:
db_table = 'group_member'
...

I define admin areas for these models in admin.py:

from app.member.models import (
...
Group,
GroupMember,
...
)

...

@admin.register(Group)
class GroupAdmin(DjangoQLMixin,BaseModelAdmin):
...

@admin.register(GroupMember)
class GroupMemberAdmin(DjangoQLMixin,BaseModelAdmin):
...

staff_admin.register(Group,GroupAdmin)
staff_admin.register(GroupMember,GroupMemberAdmin)
...
site_admin.register(Group,GroupAdmin)
site_admin.register(GroupMember,GroupMemberAdmin)
...

I've trimmed a lot of stuff but that is because it is
exactly the same between the two models.

What could be causing this one model admin to have a permissions 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f2630a68-93c5-4650-89bc-113540b72fb8n%40googlegroups.com.


Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread DJANGO DEVELOPER
I think this the only way to lin different models with eachother. and I
would like to hear more about linking the models with each other if there
is anyone who can describe it to both of us.

On Wed, Jun 2, 2021 at 10:38 AM Ayush Bisht 
wrote:

> thanks, .. it works for me.. but is there any other way to do these ??. as
> PatientVaccineStatus already connected to Patient model, and Vaccine
> connected to PatientVaccineStatus model.  Can't we merged all the tables of
> descendants to their parent model in this hierarchy fashion without linking
> each descendants to its.. super parent??
>
>
> On Tuesday, June 1, 2021 at 1:31:43 AM UTC-7 abubak...@gmail.com wrote:
>
>> class Vaccine(models.Model)
>>  vaccine = models.ForeignKey(PatientVaccineStatus,
>> related_name="vaccine_status")
>> patient = models.ForeignKey(Patient, related_name="patient")  # new
>> line
>> apply this line and your patient model will be linked with Vaccine model
>>
>> On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht  wrote:
>>
>>> class Patient(models.Model):
>>>  patient_id = models.CharField(max_length=60)
>>>
>>>
>>> class PatientVaccineStatus(models.Model):
>>>   patient = models.ForeignKey(Patient,
>>> related_name="patient_vaccine_status")
>>>
>>> class Vaccine(models.Model)
>>>  vaccine = models.ForeignKey(PatientVaccineStatus,
>>> related_name="vaccine_status")
>>>
>>> ..
>>>
>>> Is there any way to merged all the tables in a single table of patient.
>>>
>>> I successfully merge, PatientVaccineStatus table with Patient table, but
>>> Vaccine's table is not merging with the Patient.
>>>
>>> how can this hierarchy be merged in a single table.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%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/1d1dfc11-b044-4474-9f62-2b25b9c5f9d9n%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/CAKPY9pkC5ZDgXN1mhvZPFaMF885b84OA6x-T6ckAbS8WUb5pkQ%40mail.gmail.com.


Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread Ayush Bisht
thanks, .. it works for me.. but is there any other way to do these ??. as 
PatientVaccineStatus already connected to Patient model, and Vaccine 
connected to PatientVaccineStatus model.  Can't we merged all the tables of 
descendants to their parent model in this hierarchy fashion without linking 
each descendants to its.. super parent?? 


On Tuesday, June 1, 2021 at 1:31:43 AM UTC-7 abubak...@gmail.com wrote:

> class Vaccine(models.Model)
>  vaccine = models.ForeignKey(PatientVaccineStatus, 
> related_name="vaccine_status")
> patient = models.ForeignKey(Patient, related_name="patient")  # new 
> line
> apply this line and your patient model will be linked with Vaccine model 
>
> On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht  wrote:
>
>> class Patient(models.Model):
>>  patient_id = models.CharField(max_length=60)
>>
>>
>> class PatientVaccineStatus(models.Model):
>>   patient = models.ForeignKey(Patient, 
>> related_name="patient_vaccine_status")
>>
>> class Vaccine(models.Model)
>>  vaccine = models.ForeignKey(PatientVaccineStatus, 
>> related_name="vaccine_status")
>>  
>> ..
>>
>> Is there any way to merged all the tables in a single table of patient.
>>
>> I successfully merge, PatientVaccineStatus table with Patient table, but 
>> Vaccine's table is not merging with the Patient. 
>>
>> how can this hierarchy be merged in a single table.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%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/1d1dfc11-b044-4474-9f62-2b25b9c5f9d9n%40googlegroups.com.


Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread DJANGO DEVELOPER
btw have you applied in your models what I told you to do?

On Wed, Jun 2, 2021 at 10:31 AM Ayush Bisht 
wrote:

> yes, its true, but here it works as candidate key. so that we can identify
> the patient based in ICMR id's.
>
> On Tuesday, June 1, 2021 at 1:34:24 AM UTC-7 abubak...@gmail.com wrote:
>
>> class Patient(models.Model):
>>  patient_id = models.CharField(max_length=60) # no need for adding
>> patient id because django automatically creates ids
>> patient_vaccine = models.ForeignKey(PatientVaccine,
>> related_name="patient_vaccine")
>>vaccine = models.ForeignKey(Vaccinet, related_name="vaccinet")
>>
>> On Tue, Jun 1, 2021 at 1:30 PM DJANGO DEVELOPER 
>> wrote:
>>
>>> class Vaccine(models.Model)
>>>  vaccine = models.ForeignKey(PatientVaccineStatus,
>>> related_name="vaccine_status")
>>> patient = models.ForeignKey(Patient, related_name="patient")  # new
>>> line
>>> apply this line and your patient model will be linked with Vaccine model
>>>
>>> On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht 
>>> wrote:
>>>
 class Patient(models.Model):
  patient_id = models.CharField(max_length=60)


 class PatientVaccineStatus(models.Model):
   patient = models.ForeignKey(Patient,
 related_name="patient_vaccine_status")

 class Vaccine(models.Model)
  vaccine = models.ForeignKey(PatientVaccineStatus,
 related_name="vaccine_status")

 ..

 Is there any way to merged all the tables in a single table of patient.

 I successfully merge, PatientVaccineStatus table with Patient table,
 but Vaccine's table is not merging with the Patient.

 how can this hierarchy be merged in a single table.

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%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/d7ca06cb-c662-4994-b8cd-ff0cbfd61ea8n%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/CAKPY9pnLy_Drk1Tz6FCbQkkHGjWRPW8hfJ1Hjsr7C3-53cu6%2BQ%40mail.gmail.com.


Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread Ayush Bisht
yes, its true, but here it works as candidate key. so that we can identify 
the patient based in ICMR id's. 

On Tuesday, June 1, 2021 at 1:34:24 AM UTC-7 abubak...@gmail.com wrote:

> class Patient(models.Model):
>  patient_id = models.CharField(max_length=60) # no need for adding 
> patient id because django automatically creates ids
> patient_vaccine = models.ForeignKey(PatientVaccine, 
> related_name="patient_vaccine")
>vaccine = models.ForeignKey(Vaccinet, related_name="vaccinet")
>
> On Tue, Jun 1, 2021 at 1:30 PM DJANGO DEVELOPER  
> wrote:
>
>> class Vaccine(models.Model)
>>  vaccine = models.ForeignKey(PatientVaccineStatus, 
>> related_name="vaccine_status")
>> patient = models.ForeignKey(Patient, related_name="patient")  # new 
>> line
>> apply this line and your patient model will be linked with Vaccine model 
>>
>> On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht  wrote:
>>
>>> class Patient(models.Model):
>>>  patient_id = models.CharField(max_length=60)
>>>
>>>
>>> class PatientVaccineStatus(models.Model):
>>>   patient = models.ForeignKey(Patient, 
>>> related_name="patient_vaccine_status")
>>>
>>> class Vaccine(models.Model)
>>>  vaccine = models.ForeignKey(PatientVaccineStatus, 
>>> related_name="vaccine_status")
>>>  
>>> ..
>>>
>>> Is there any way to merged all the tables in a single table of patient.
>>>
>>> I successfully merge, PatientVaccineStatus table with Patient table, but 
>>> Vaccine's table is not merging with the Patient. 
>>>
>>> how can this hierarchy be merged in a single table.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%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/d7ca06cb-c662-4994-b8cd-ff0cbfd61ea8n%40googlegroups.com.


Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread DJANGO DEVELOPER
class Patient(models.Model):
 patient_id = models.CharField(max_length=60) # no need for adding
patient id because django automatically creates ids
patient_vaccine = models.ForeignKey(PatientVaccine,
related_name="patient_vaccine")
   vaccine = models.ForeignKey(Vaccinet, related_name="vaccinet")

On Tue, Jun 1, 2021 at 1:30 PM DJANGO DEVELOPER 
wrote:

> class Vaccine(models.Model)
>  vaccine = models.ForeignKey(PatientVaccineStatus,
> related_name="vaccine_status")
> patient = models.ForeignKey(Patient, related_name="patient")  # new
> line
> apply this line and your patient model will be linked with Vaccine model
>
> On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht 
> wrote:
>
>> class Patient(models.Model):
>>  patient_id = models.CharField(max_length=60)
>>
>>
>> class PatientVaccineStatus(models.Model):
>>   patient = models.ForeignKey(Patient,
>> related_name="patient_vaccine_status")
>>
>> class Vaccine(models.Model)
>>  vaccine = models.ForeignKey(PatientVaccineStatus,
>> related_name="vaccine_status")
>>
>> ..
>>
>> Is there any way to merged all the tables in a single table of patient.
>>
>> I successfully merge, PatientVaccineStatus table with Patient table, but
>> Vaccine's table is not merging with the Patient.
>>
>> how can this hierarchy be merged in a single table.
>>
>> --
>> 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/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%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/CAKPY9pkQGHbMXJ0Lg7rb57ih6m-UQdHiTN%2BF-4Wp49M4Mw6T%2Bg%40mail.gmail.com.


Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread DJANGO DEVELOPER
class Vaccine(models.Model)
 vaccine = models.ForeignKey(PatientVaccineStatus,
related_name="vaccine_status")
patient = models.ForeignKey(Patient, related_name="patient")  # new line
apply this line and your patient model will be linked with Vaccine model

On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht 
wrote:

> class Patient(models.Model):
>  patient_id = models.CharField(max_length=60)
>
>
> class PatientVaccineStatus(models.Model):
>   patient = models.ForeignKey(Patient,
> related_name="patient_vaccine_status")
>
> class Vaccine(models.Model)
>  vaccine = models.ForeignKey(PatientVaccineStatus,
> related_name="vaccine_status")
>
> ..
>
> Is there any way to merged all the tables in a single table of patient.
>
> I successfully merge, PatientVaccineStatus table with Patient table, but
> Vaccine's table is not merging with the Patient.
>
> how can this hierarchy be merged in a single table.
>
> --
> 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/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%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/CAKPY9pmwZP9mK%3DFaLVBtcHnm7f0UUGU0KqA%3DVa_CyzSszwOe6g%40mail.gmail.com.


Inlined hierarchy models in django admin site.

2021-06-01 Thread Ayush Bisht
class Patient(models.Model):
 patient_id = models.CharField(max_length=60)


class PatientVaccineStatus(models.Model):
  patient = models.ForeignKey(Patient, 
related_name="patient_vaccine_status")

class Vaccine(models.Model)
 vaccine = models.ForeignKey(PatientVaccineStatus, 
related_name="vaccine_status")
 
..

Is there any way to merged all the tables in a single table of patient.

I successfully merge, PatientVaccineStatus table with Patient table, but 
Vaccine's table is not merging with the Patient. 

how can this hierarchy be merged in a single table.

-- 
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/57aac480-cb53-4fbe-a3bd-8766cd7a5b82n%40googlegroups.com.


Custom Text filter field in django admin site.

2021-05-31 Thread Ayush Bisht
# admin.py

class InputFilter(admin.SimpleListFilter):
template = 'patient/input_filter.html'

def lookups(self, request, model_admin):
# Dummy, required to show the filter.
return ((),)

class PatientProfilePastDataFilter(InputFilter):
parameter_name = 'patient'
title = _('Past Record')

def lookups(self, request, model_admin):
return ( (),)

def queryset(self, request, queryset):   
return queryset.filter(admitted_on__lte = request.GET.get("from") , 
admitted_on__gte  
 = request.GET.get("to")  )

# patient/input_filter.html
{% load i18n %} 

{% blocktrans with filter_title=title %} By {{ filter_title }} {% 
endblocktrans %}


{% with choices.0 as all_choice %}








filter
{% if not all_choice.selected %}
x {% trans 
'Remove' %}
{% endif %}


{% endwith %}



 # 
.


I want to add a custom text filter in django admin site... with 2 input 
fields. Is there a way to do this.. if so then please suggest me,  how can 
I add a custom text field in filter section.

Also, Thanks for the  respond on previous query... 

-- 
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/2dc28aa3-90d0-422f-8d9c-4b5f5b6fb7f6n%40googlegroups.com.


Re: Validate UserChangeForm from admin site

2021-05-11 Thread Sharif Mehedi
You can do something like:IN:class CustomUserCreationForm(forms.ModelForm):
    
def clean(self):    cleaned_data = super().clean()    # put your 
custom validator here!
   On Tuesday, May 11, 2021, 6:53:24 PM GMT+6, Ayush Bisht 
 wrote:  
 
 # admin.pyclass CustomUserAdmin(UserAdmin):model = CustomUseradd_form 
= CustomUserCreationFormfieldsets = (
*UserAdmin.fieldsets, ('User type',{
'fields' : ('is_admin','is_doctor', 
   'is_nurse',),
'description': "Select any one of them "}))
# models.py
class CustomUser(AbstractUser):username = models.CharField(max_length=50, 
unique=True, blank=False, null=False)   is_doctor = 
models.BooleanField(default=False, blank=False, null=False)is_nurse = 
models.BooleanField(default=False, blank=False, null=False)is_admin 
= models.BooleanField(default=False, blank=False, null=False)
# forms.py
class CustomUserCreationForm(forms.ModelForm):"""A form that creates a 
user, with no privileges, from the given username andpassword."""
error_messages = {'password_mismatch': _('The two password fields 
didn’t match.'),}password1 = forms.CharField(
label=_("Password"),strip=False,
widget=forms.PasswordInput(attrs={'autocomplete': 'new-password'}),# 
help_text=password_validation.password_validators_help_text_html(),)
password2 = forms.CharField(label=_("Password confirmation"),
widget=forms.PasswordInput(attrs={'autocomplete': 'new-password'}),
strip=False,help_text=_("Enter the same password as before, for 
verification."),) class Meta:model = CustomUser# fields 
= "('username',  'password' ,'password2', 'userchoice')"fields = 
("username",)# field_classes = {'username': UsernameField}
def __init__(self, *args, **kwargs):super().__init__(*args, 
**kwargs)     self.fields['username'].help_text = 'Enter you Staff ID'

def clean_password2(self):password1 = 
self.cleaned_data.get("password1")password2 = 
self.cleaned_data.get("password2")if password1 and password2 and 
password1 != password2:raise ValidationError(
self.error_messages['password_mismatch'],
code='password_mismatch',)return password2

def save(self, commit=True):user = super().save(commit=False)   
 user.set_password(self.cleaned_data["password1"])if commit:
user.save()return user



..
the is_doctor , is_nurse   and is_admin fields comes at the userchageform.. is 
there a way to validate the fields at admin level.  I mean if someone , checked 
more than one designation then , a field error have to appear on the admin 
userchangeform,   Is there any way to customize the userchangeform...
Any help would be highly appreciable , 



-- 
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/da01a016-26fc-4590-992d-eaf86a502d7an%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/1660007552.1091046.1620738931856%40mail.yahoo.com.


Validate UserChangeForm from admin site

2021-05-11 Thread Ayush Bisht
# admin.py
class CustomUserAdmin(UserAdmin):
model = CustomUser
add_form = CustomUserCreationForm
fieldsets = (

*UserAdmin.fieldsets, (
'User type',{
'fields' : (
'is_admin',
'is_doctor',
'is_nurse',

),
'description': "Select any one of them "
}
)
)

# models.py

class CustomUser(AbstractUser):
username = models.CharField(max_length=50, unique=True, blank=False, 
null=False)   
is_doctor = models.BooleanField(default=False, blank=False, null=False)
is_nurse = models.BooleanField(default=False, blank=False, null=False)  
  
is_admin = models.BooleanField(default=False, blank=False, null=False)


# forms.py

class CustomUserCreationForm(forms.ModelForm):
"""
A form that creates a user, with no privileges, from the given username and
password.
"""
error_messages = {
'password_mismatch': _('The two password fields didn’t match.'),
}
password1 = forms.CharField(
label=_("Password"),
strip=False,
widget=forms.PasswordInput(attrs={'autocomplete': 'new-password'}),
# help_text=password_validation.password_validators_help_text_html(),
)
password2 = forms.CharField(
label=_("Password confirmation"),
widget=forms.PasswordInput(attrs={'autocomplete': 'new-password'}),
strip=False,
help_text=_("Enter the same password as before, for verification."),
)
 
class Meta:
model = CustomUser
# fields = "('username',  'password' ,'password2', 'userchoice')"
fields = ("username",)
# field_classes = {'username': UsernameField}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) 
self.fields['username'].help_text = 'Enter you Staff ID'


def clean_password2(self):
password1 = self.cleaned_data.get("password1")
password2 = self.cleaned_data.get("password2")
if password1 and password2 and password1 != password2:
raise ValidationError(
self.error_messages['password_mismatch'],
code='password_mismatch',
)
return password2


def save(self, commit=True):
user = super().save(commit=False)
user.set_password(self.cleaned_data["password1"])
if commit:
user.save()
return user



..

the is_doctor , is_nurse   and is_admin fields comes at the userchageform.. 
is there a way to validate the fields at admin level.  I mean if someone , 
checked more than one designation then , a field error have to appear on 
the admin userchangeform,   Is there any way to customize the 
userchangeform...

Any help would be highly appreciable , 


-- 
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/da01a016-26fc-4590-992d-eaf86a502d7an%40googlegroups.com.


Re: Problem with admin site

2021-03-03 Thread kolo1
Re: Problem with admin siteThanx for your replay. I found my mistake. I 
have incorrectly implemented the qrcode software in urls.py in two 
applications in my project. 
I have:
path('pdf_page', lost.home, include('qr_code.urls', namespace="qr_code"), 
name='pdf_page')
change to:
path('pdf_page', include('qr_code.urls', namespace="qr_code"))
For some reason everything was working with my err path only admin site not 
(why?). After change path seems everything works fine.

środa, 3 marca 2021 o 17:11:43 UTC+1 mr.xof...@gmail.com napisał(a):

> Show your model.py
>
> On Wed, 3 Mar 2021, 19:41 kolo1,  wrote:
>
>> Hey
>> I've made some project with couples apps and now I'd like to manage by 
>> admin site but when I try to open localhost:8000/admin I get error
>> """
>> TypeError at /admin/'tuple' object is not a mappingRequest Method:
>> GETRequest URL: http://localhost:8000/admin/
>> Django Version: 3.1.6Exception Type:
>> TypeErrorException Value: 'tuple' object is not a mappingException 
>> Location:/usr/lib/python3.9/site-packages/django/urls/resolvers.py, line 
>> 486, in _populate
>> Python Executable:/usr/bin/python3Python 
>> Version: 3.9.1
>> """
>> I can't find the problem? 
>> My urls.py
>> """
>> from django.contrib import admin
>> from django.urls import include,path
>>
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('main.urls')),
>> path('raporty/', include('raporty.urls')), 
>> path('settings/', include('settings.urls'))
>>
>> ]
>> """
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c64b8f71-35a7-4fb9-b902-93082aab64f7n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/c64b8f71-35a7-4fb9-b902-93082aab64f7n%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/e3bb96d7-8306-4522-9da3-0d4ca2b5bb41n%40googlegroups.com.


Re: Problem with admin site

2021-03-03 Thread Mr. X Offencer
Show your model.py

On Wed, 3 Mar 2021, 19:41 kolo1,  wrote:

> Hey
> I've made some project with couples apps and now I'd like to manage by
> admin site but when I try to open localhost:8000/admin I get error
> """
> TypeError at /admin/'tuple' object is not a mappingRequest Method:
> GETRequest URL: http://localhost:8000/admin/
> Django Version: 3.1.6Exception Type:
> TypeErrorException Value: 'tuple' object is not a mappingException
> Location:/usr/lib/python3.9/site-packages/django/urls/resolvers.py, line
> 486, in _populate
> Python Executable:/usr/bin/python3Python
> Version: 3.9.1
> """
> I can't find the problem?
> My urls.py
> """
> from django.contrib import admin
> from django.urls import include,path
>
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('', include('main.urls')),
> path('raporty/', include('raporty.urls')),
> path('settings/', include('settings.urls'))
>
> ]
> """
>
> --
> 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/c64b8f71-35a7-4fb9-b902-93082aab64f7n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c64b8f71-35a7-4fb9-b902-93082aab64f7n%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/CABz7kDTw1xVqNBfyed-Zn-dRZ6aruUoDeLHWkRfd-NS0WgBVOA%40mail.gmail.com.


Problem with admin site

2021-03-03 Thread kolo1
Hey
I've made some project with couples apps and now I'd like to manage by 
admin site but when I try to open localhost:8000/admin I get error
"""
TypeError at /admin/'tuple' object is not a mappingRequest Method:
GETRequest URL: http://localhost:8000/admin/
Django Version: 3.1.6Exception Type:
TypeErrorException Value: 'tuple' object is not a mappingException 
Location:/usr/lib/python3.9/site-packages/django/urls/resolvers.py, line 
486, in _populate
Python Executable:/usr/bin/python3Python 
Version: 3.9.1
"""
I can't find the problem? 
My urls.py
"""
from django.contrib import admin
from django.urls import include,path


urlpatterns = [
path('admin/', admin.site.urls),
path('', include('main.urls')),
path('raporty/', include('raporty.urls')), 
path('settings/', include('settings.urls'))

]
"""

-- 
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/c64b8f71-35a7-4fb9-b902-93082aab64f7n%40googlegroups.com.


django admin site password changed every time user's attributes are changed

2021-01-10 Thread Vishesh Mangla

https://dpaste.org/bN7d

Please see code at dpaste.

I 'm trying to modify my admin site so that the admin can create new 
accounts there. After clicking save , to whatever email address which the 
admin has entered an email would bbe sent with a random password. It works 
perfectly but when I try to change the users permission in the admin site, 
first of all the password's hash code is visible and the password gets 
substituted with that hash. 

Also why is the password string visible, shouldn't it be dots here?
https://ibb.co/zXjx0BW

Please help me out.

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


Re: having an issue with my admin site after an upgrade from django 3.0 to 3.1

2020-08-15 Thread Diksha Vazirani
There's might the problem in installation

On Sun, Aug 16, 2020, 2:17 AM sapna Choudhary  wrote:

> Once i encountered same issue ,it got resolved by upgrading django and
> deleting all the browser cookies.
>
> On Fri 14 Aug, 2020, 3:41 PM Exactly musty, 
> wrote:
>
>> Yes I have solved the problem,I made an hard clear cache, and hard
>> refresh or you use django jazzmin
>>
>> On Fri, 14 Aug 2020, 10:50 am Tobias Lindenberg, 
>> wrote:
>>
>>> I have the same problem, do you have a solution yet?
>>>
>>> exactmu...@gmail.com schrieb am Dienstag, 11. August 2020 um 20:49:07
>>> UTC+2:
>>>
 Done that already but still not working and I use another browser but
 still the same

 On Tue, 11 Aug 2020, 6:59 pm carlos,  wrote:

> Hi, clean your cache navigator??
>
> On Tue, Aug 11, 2020 at 11:04 AM Exactly musty 
> wrote:
>
>> [image: adm.jpg]
>>
>> [image: adm1.jpg]
>> hi i recently upgraded my django 3.0 to 3.1, then i started the
>> project that i have been working on lately,actually my project is working
>> perfectly but once i switch to the admin i don't get any error tho but i
>> can't edit or change anything to my project anymore from the admin,here 
>> is
>> a screenshot,if i slide into the admin i get to see the normal site admin
>> but once i clicked any of my model i get the second screenshot
>>
>> PS: i am using custom user model and posgresql
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8149a365-2e81-4f25-a1a2-cf1b31c84c0do%40googlegroups.com
>> 
>> .
>>
>
>
> --
> att.
> Carlos Rocha
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com.
>
 To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAM-7rO3CxpiKH0fNWFheQNdzPnxT93PaPyqY7A2JiUu6Ai0xAQ%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/caeef963-30e3-441a-bc0c-06e314c32a14n%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/CAP9DHG1E653kzz08SH6bh4jmqGGW7taO%2B%3D%2BY%2BqgrpX36GMz2Fg%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/CAP6mExhj0z9-24gpm%2Bj8xfkpc6rUvg2ecYKwVMdQPZ3kegcZbw%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/CAM51YKuTTPXpb0aTant7zPKU5ww9Tkh%2BpBsUuPC-gOAVGX4xKg%40mail.gmail.com.


having an issue with my admin site after an upgrade from django 3.0 to 3.1

2020-08-15 Thread Amar prakash
Put commamds: python3 manage.py makemigrations
Python 3 manage.py migrate

-- 
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/d6034814-04e6-4098-86f6-e3dc475cd845o%40googlegroups.com.


Re: having an issue with my admin site after an upgrade from django 3.0 to 3.1

2020-08-15 Thread sapna Choudhary
Once i encountered same issue ,it got resolved by upgrading django and
deleting all the browser cookies.

On Fri 14 Aug, 2020, 3:41 PM Exactly musty, 
wrote:

> Yes I have solved the problem,I made an hard clear cache, and hard refresh
> or you use django jazzmin
>
> On Fri, 14 Aug 2020, 10:50 am Tobias Lindenberg, 
> wrote:
>
>> I have the same problem, do you have a solution yet?
>>
>> exactmu...@gmail.com schrieb am Dienstag, 11. August 2020 um 20:49:07
>> UTC+2:
>>
>>> Done that already but still not working and I use another browser but
>>> still the same
>>>
>>> On Tue, 11 Aug 2020, 6:59 pm carlos,  wrote:
>>>
 Hi, clean your cache navigator??

 On Tue, Aug 11, 2020 at 11:04 AM Exactly musty 
 wrote:

> [image: adm.jpg]
>
> [image: adm1.jpg]
> hi i recently upgraded my django 3.0 to 3.1, then i started the
> project that i have been working on lately,actually my project is working
> perfectly but once i switch to the admin i don't get any error tho but i
> can't edit or change anything to my project anymore from the admin,here is
> a screenshot,if i slide into the admin i get to see the normal site admin
> but once i clicked any of my model i get the second screenshot
>
> PS: i am using custom user model and posgresql
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8149a365-2e81-4f25-a1a2-cf1b31c84c0do%40googlegroups.com
> 
> .
>


 --
 att.
 Carlos Rocha

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.

>>> To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAM-7rO3CxpiKH0fNWFheQNdzPnxT93PaPyqY7A2JiUu6Ai0xAQ%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/caeef963-30e3-441a-bc0c-06e314c32a14n%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/CAP9DHG1E653kzz08SH6bh4jmqGGW7taO%2B%3D%2BY%2BqgrpX36GMz2Fg%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/CAP6mExhj0z9-24gpm%2Bj8xfkpc6rUvg2ecYKwVMdQPZ3kegcZbw%40mail.gmail.com.


Re: having an issue with my admin site after an upgrade from django 3.0 to 3.1

2020-08-14 Thread Exactly musty
Yes I have solved the problem,I made an hard clear cache, and hard refresh
or you use django jazzmin

On Fri, 14 Aug 2020, 10:50 am Tobias Lindenberg, 
wrote:

> I have the same problem, do you have a solution yet?
>
> exactmu...@gmail.com schrieb am Dienstag, 11. August 2020 um 20:49:07
> UTC+2:
>
>> Done that already but still not working and I use another browser but
>> still the same
>>
>> On Tue, 11 Aug 2020, 6:59 pm carlos,  wrote:
>>
>>> Hi, clean your cache navigator??
>>>
>>> On Tue, Aug 11, 2020 at 11:04 AM Exactly musty 
>>> wrote:
>>>
 [image: adm.jpg]

 [image: adm1.jpg]
 hi i recently upgraded my django 3.0 to 3.1, then i started the project
 that i have been working on lately,actually my project is working perfectly
 but once i switch to the admin i don't get any error tho but i can't edit
 or change anything to my project anymore from the admin,here is a
 screenshot,if i slide into the admin i get to see the normal site admin but
 once i clicked any of my model i get the second screenshot

 PS: i am using custom user model and posgresql

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/8149a365-2e81-4f25-a1a2-cf1b31c84c0do%40googlegroups.com
 
 .

>>>
>>>
>>> --
>>> att.
>>> Carlos Rocha
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAM-7rO3CxpiKH0fNWFheQNdzPnxT93PaPyqY7A2JiUu6Ai0xAQ%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/caeef963-30e3-441a-bc0c-06e314c32a14n%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/CAP9DHG1E653kzz08SH6bh4jmqGGW7taO%2B%3D%2BY%2BqgrpX36GMz2Fg%40mail.gmail.com.


Re: having an issue with my admin site after an upgrade from django 3.0 to 3.1

2020-08-14 Thread Tobias Lindenberg
I have the same problem, do you have a solution yet?

exactmu...@gmail.com schrieb am Dienstag, 11. August 2020 um 20:49:07 UTC+2:

> Done that already but still not working and I use another browser but 
> still the same
>
> On Tue, 11 Aug 2020, 6:59 pm carlos,  wrote:
>
>> Hi, clean your cache navigator??
>>
>> On Tue, Aug 11, 2020 at 11:04 AM Exactly musty  
>> wrote:
>>
>>> [image: adm.jpg]
>>>
>>> [image: adm1.jpg]
>>> hi i recently upgraded my django 3.0 to 3.1, then i started the project 
>>> that i have been working on lately,actually my project is working perfectly 
>>> but once i switch to the admin i don't get any error tho but i can't edit 
>>> or change anything to my project anymore from the admin,here is a 
>>> screenshot,if i slide into the admin i get to see the normal site admin but 
>>> once i clicked any of my model i get the second screenshot 
>>>
>>> PS: i am using custom user model and posgresql
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/8149a365-2e81-4f25-a1a2-cf1b31c84c0do%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>
>>
>> -- 
>> att.
>> Carlos Rocha
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAM-7rO3CxpiKH0fNWFheQNdzPnxT93PaPyqY7A2JiUu6Ai0xAQ%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/caeef963-30e3-441a-bc0c-06e314c32a14n%40googlegroups.com.


Re: How to change how foreign keys are view in admin site

2019-11-15 Thread Paras Jain
after that model write like this
def __str__(self):
  return self.title

On Fri, Nov 15, 2019 at 6:18 PM Usman Hassan 
wrote:

> I have a problem with my django app, I created a an that has two models
> one which is post and the other is comment, and the comment has a foreign
> key relationship to post. But anytime I view the admin site and I tried to
> relate a comment to a post I made, it won't show me the title of the post
> but instead it will show 'post object (1)'. Pls I there any way I can
> change that???
>
> --
> 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/c92d6f0a-b50f-4d7a-adf8-fd0e3b04a801%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/CAMtmBS9LiH7F9D_T0DRNT8-eNJNzGs6rmfxMJOuyqkoCb%3DsHEw%40mail.gmail.com.


How to change how foreign keys are view in admin site

2019-11-15 Thread Usman Hassan
I have a problem with my django app, I created a an that has two models one 
which is post and the other is comment, and the comment has a foreign key 
relationship to post. But anytime I view the admin site and I tried to relate a 
comment to a post I made, it won't show me the title of the post but instead it 
will show 'post object (1)'. Pls I there any way I can change that???

-- 
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/c92d6f0a-b50f-4d7a-adf8-fd0e3b04a801%40googlegroups.com.


Re: Admin site error reporting

2019-10-23 Thread Derek
Well, assuming you have followed all the advice given in that link I posted 
and have eliminated all those sources of error, then it seems like you will 
need to add more error trapping to pin down where the error occurs.  If the 
log files are not been written to (which itself seems problematic & you'll 
need to see why), then try simply writing out key steps to a text file so 
you can at least see where your code is malfunctioning.

On Wednesday, 23 October 2019 13:52:20 UTC+2, Dieter Gyselinck wrote:
>
> Thanx for the response.  The normal logging works, I see errors in the 
> error log file if they occur outside the Django Admin.  However, the error 
> with the change form in the admin does not occur in the logfiles.  Same 
> behaviour as with the error mailing.  
>
> Op woensdag 23 oktober 2019 10:57:05 UTC+2 schreef Derek:
>>
>> Does the normal logging work i.e. are you seeing those errors reported in 
>> the log files?  And do you have trapping/handling for the email-sending 
>> code as well?
>>
>> Also have a look at: 
>>
>> https://stackoverflow.com/questions/15128135/setting-debug-false-causes-500-erro
>> for a brief discussion around the difference between running your app 
>> with DEBUG on or off and how logging can help with this.
>>
>>
>> On Tuesday, 22 October 2019 14:32:50 UTC+2, Dieter Gyselinck wrote:
>>>
>>> When a change form is accessed in the admin site and an error occurs we 
>>> receive an error screen if debug equals True.  If I  run into the same 
>>> error on production, where debug equals False, I don't receive an error 
>>> email.  The error handling is probably configured correctly as I do get 
>>> error emails when the error occurs outside of the admin pages.  I have the 
>>> impression that there is an issue with the error reporting in the admin.  
>>> Does anybody know what is happening and is there a possible 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f9052904-6b8e-421e-9127-c1553bc88604%40googlegroups.com.


Re: Admin site error reporting

2019-10-23 Thread Dieter Gyselinck
Thanx for the response.  The normal logging works, I see errors in the 
error log file if they occur outside the Django Admin.  However, the error 
with the change form in the admin does not occur in the logfiles.  Same 
behaviour as with the error mailing.  

Op woensdag 23 oktober 2019 10:57:05 UTC+2 schreef Derek:
>
> Does the normal logging work i.e. are you seeing those errors reported in 
> the log files?  And do you have trapping/handling for the email-sending 
> code as well?
>
> Also have a look at: 
>
> https://stackoverflow.com/questions/15128135/setting-debug-false-causes-500-erro
> for a brief discussion around the difference between running your app with 
> DEBUG on or off and how logging can help with this.
>
>
> On Tuesday, 22 October 2019 14:32:50 UTC+2, Dieter Gyselinck wrote:
>>
>> When a change form is accessed in the admin site and an error occurs we 
>> receive an error screen if debug equals True.  If I  run into the same 
>> error on production, where debug equals False, I don't receive an error 
>> email.  The error handling is probably configured correctly as I do get 
>> error emails when the error occurs outside of the admin pages.  I have the 
>> impression that there is an issue with the error reporting in the admin.  
>> Does anybody know what is happening and is there a possible 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/32d28aea-0fa4-4fbe-8704-d64118d13ede%40googlegroups.com.


Re: Admin site error reporting

2019-10-23 Thread Derek
Does the normal logging work i.e. are you seeing those errors reported in 
the log files?  And do you have trapping/handling for the email-sending 
code as well?

Also have a look at: 
https://stackoverflow.com/questions/15128135/setting-debug-false-causes-500-erro
for a brief discussion around the difference between running your app with 
DEBUG on or off and how logging can help with this.


On Tuesday, 22 October 2019 14:32:50 UTC+2, Dieter Gyselinck wrote:
>
> When a change form is accessed in the admin site and an error occurs we 
> receive an error screen if debug equals True.  If I  run into the same 
> error on production, where debug equals False, I don't receive an error 
> email.  The error handling is probably configured correctly as I do get 
> error emails when the error occurs outside of the admin pages.  I have the 
> impression that there is an issue with the error reporting in the admin.  
> Does anybody know what is happening and is there a possible 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d8cead2-cecc-4894-903e-5815921d629b%40googlegroups.com.


Admin site error reporting

2019-10-22 Thread Dieter Gyselinck
When a change form is accessed in the admin site and an error occurs we 
receive an error screen if debug equals True.  If I  run into the same 
error on production, where debug equals False, I don't receive an error 
email.  The error handling is probably configured correctly as I do get 
error emails when the error occurs outside of the admin pages.  I have the 
impression that there is an issue with the error reporting in the admin.  
Does anybody know what is happening and is there a possible 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/95a5d69b-9158-4a90-93b1-60c9f99c2f29%40googlegroups.com.


Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-31 Thread abel otugeme
How do you explain the admin site too? A missing tag in just one part of 
the html file shouldn't break the entire site. I'll send you the files so 
you can review them

On Monday, December 31, 2018 at 4:24:14 AM UTC+1, Joel Mathew wrote:
>
> Your site has more wrong with it than just static css. Your html is 
> appearing as html. You need to unescape them in template or check your tags
>
> On Mon, 31 Dec, 2018, 1:10 AM abel otugeme   wrote:
>
>> I have done all that i used the docs first and it did not work. Then i 
>> tired this video https://www.youtube.com/watch?v=YH-ipgxlJzs
>>
>> On Sun, Dec 30, 2018 at 5:09 PM Lunga Baliwe > > wrote:
>>
>>> Please have a look at this link 
>>> https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/ on 
>>> how to setup static files.
>>> You may also want to run python manage.py collectstatic 
>>>
>>> On Sun, Dec 30, 2018 at 4:31 AM abel otugeme >> > wrote:
>>>
>>>> This is how a site looks when i open it up in my browser No CSS! i 
>>>> have done the necessary settings for Django to find the static files
>>>>
>>>> On Sat, Dec 29, 2018 at 5:14 PM Kasper Laudrup >>> > wrote:
>>>>
>>>>> Hi Abel,
>>>>>
>>>>> On 29/12/2018 08.07, abel otugeme wrote:
>>>>> > I really need help i have combed through stackover flow and this 
>>>>> group 
>>>>> > but the solutions provided don't work for me.  i use a 32bit windows 
>>>>> 7 
>>>>> > OS and the latest version of django
>>>>> > 
>>>>>
>>>>> It would probably be easier for someone to help you if you tried to 
>>>>> describe what your actual problem is.
>>>>>
>>>>> Kind regards,
>>>>>
>>>>> Kasper Laudrup
>>>>>
>>>>> -- 
>>>>> 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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk
>>>>> .
>>>>> 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 https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%40mail.gmail.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...@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/CANDnEWfqpqyk-nesQcAKT-4i9tzAw8aJne2VjXFkgxqFWKJXiA%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/CANDnEWfqpqyk-nesQcAKT-4i9tzAw8aJne2VjXFkgxqFWKJXiA%40mail.gmail.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 user

Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-30 Thread Joel Mathew
Your site has more wrong with it than just static css. Your html is
appearing as html. You need to unescape them in template or check your tags

On Mon, 31 Dec, 2018, 1:10 AM abel otugeme  I have done all that i used the docs first and it did not work. Then i
> tired this video https://www.youtube.com/watch?v=YH-ipgxlJzs
>
> On Sun, Dec 30, 2018 at 5:09 PM Lunga Baliwe  wrote:
>
>> Please have a look at this link
>> https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/ on
>> how to setup static files.
>> You may also want to run python manage.py collectstatic
>>
>> On Sun, Dec 30, 2018 at 4:31 AM abel otugeme  wrote:
>>
>>> This is how a site looks when i open it up in my browser No CSS! i
>>> have done the necessary settings for Django to find the static files
>>>
>>> On Sat, Dec 29, 2018 at 5:14 PM Kasper Laudrup 
>>> wrote:
>>>
 Hi Abel,

 On 29/12/2018 08.07, abel otugeme wrote:
 > I really need help i have combed through stackover flow and this
 group
 > but the solutions provided don't work for me.  i use a 32bit windows
 7
 > OS and the latest version of django
 >

 It would probably be easier for someone to help you if you tried to
 describe what your actual problem is.

 Kind regards,

 Kasper Laudrup

 --
 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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk
 .
 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/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%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/CANDnEWfqpqyk-nesQcAKT-4i9tzAw8aJne2VjXFkgxqFWKJXiA%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/CAMrS0S_3dqSeH6osEsganiWJHk%3Dd%2B0Di0j2V9iqhDr0uD4qvag%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/CAA%3Diw_9oqRts%3DjYUj%3DXkQBFXkfK-gU27vGTBfzxsTUpyichF3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-30 Thread Okware Aldo
I can have a look if you give me access to the code, we could do
teamviewer, or  repo.

Let me know.

On Sun, 30 Dec 2018, 22:40 abel otugeme,  wrote:

> I have done all that i used the docs first and it did not work. Then i
> tired this video https://www.youtube.com/watch?v=YH-ipgxlJzs
>
> On Sun, Dec 30, 2018 at 5:09 PM Lunga Baliwe  wrote:
>
>> Please have a look at this link
>> https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/ on
>> how to setup static files.
>> You may also want to run python manage.py collectstatic
>>
>> On Sun, Dec 30, 2018 at 4:31 AM abel otugeme  wrote:
>>
>>> This is how a site looks when i open it up in my browser No CSS! i
>>> have done the necessary settings for Django to find the static files
>>>
>>> On Sat, Dec 29, 2018 at 5:14 PM Kasper Laudrup 
>>> wrote:
>>>
 Hi Abel,

 On 29/12/2018 08.07, abel otugeme wrote:
 > I really need help i have combed through stackover flow and this
 group
 > but the solutions provided don't work for me.  i use a 32bit windows
 7
 > OS and the latest version of django
 >

 It would probably be easier for someone to help you if you tried to
 describe what your actual problem is.

 Kind regards,

 Kasper Laudrup

 --
 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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk
 .
 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/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%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/CANDnEWfqpqyk-nesQcAKT-4i9tzAw8aJne2VjXFkgxqFWKJXiA%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/CAMrS0S_3dqSeH6osEsganiWJHk%3Dd%2B0Di0j2V9iqhDr0uD4qvag%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/CAMEZma9ja8TOwuh_n5fpzaBrANt3igG1%2BkBhz%3DSearvJw1NQAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django admin site change_related_template_url problem

2018-12-30 Thread Ryan Nowakowski
You're better off not using the HTML rewriting features of your reverse proxy. 
Instead configure Django to use the reverse proxied url prefix for all it's 
URLs.

On December 29, 2018 9:03:39 AM CST, Zhe Li  wrote:
>Hi,
>
>I am having issues with django installed on a server reversed proxied
>to 
>the main website. Most of the sites work just fine except a very small 
>detail in the admin site, change form page.
>
>Django is running on server A, served at / on port 12345. Server B
>which is 
>the main web server and has a domain www.example.com, and serves
>content 
>(reverse proxies) from server A under /app/myapp.
>
>i.e. *http://A:12345/admin/* translates to 
>*https://www.example.com/app/myapp/admin*.
>
>Everything is fine except when I try to modify a foreign key value from
>the 
>model that it is referenced. You know, if I modify fields of model A in
>the 
>django admin site, I can click on these buttons to change a foreign key
>
>model B.
>
>[image: Screen Shot 2018-12-29 at 9.45.42
>AM.png] 
>
>
>
>
>
>
>The problem is that the links are not properly translated on server B.
>The 
>"add" button is fine, but the "change" and the "delete" buttons are
>not. 
>For example, the correct "change" button should point to 
>*https://www.example.com/app/myapp/admin/main/modelb/1/change/?_to_field=id&_popup=1*,
>
>but it actually points to 
>*https://www.example.com/admin/main/modelb/1/change/?_to_field=id&_popup=1*,
>
>which does not exist. The problem is that the relative URL is stored in
>the 
>"data-href-template" attribute of the  tag, like this
>
>*> id="change_id_modelb" 
>>
>data-href-template="/admin/main/modelb/__fk__/change/?_to_field=id_popup=1"
>
>> title="Change selected modelb">*
>>
>
>which is parsed by static/admin/js/admin/RelatedObjectLookups.js, which
>
>adds a "real" href attribute via JS, giving
>
>*> id="change_id_system" 
>>
>data-href-template="/admin/main/modelb/__fk__/change/?_to_field=id_popup=1"
>
>> title="Change selected modelb" 
>> href="/admin/main/modelb/1/change/?_to_field=id_popup=1">> src="/app/myapp/static/admin/img/icon-changelink.svg"
>alt="Change">*
>
>
>The reverse proxy program, however, only translates whatever is in the
>HTML 
>, and does nothing about this customized data field.
>
>This is not necessarily a bug, as it only happens in special cases like
>
>mine. I am not sure what to do -- I can modify this
>RelatedObjectLookups.js 
>and just add '/app/myapp' in front of every link it produces, which
>should 
>work and fix this problem at this point. However, a more complete
>solution 
>would be to overhaul this lookup js and put a real link there, which is
>
>quite some work to do. Should I write a new ticket to Django Project,
>or do 
>you have better suggestions?
>
>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 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/cf876c89-c3e7-414e-8290-1e050f80f7b7%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/758772A2-552D-4B90-8D8D-B3F94DCF8EA9%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-30 Thread abel otugeme
I have done all that i used the docs first and it did not work. Then i
tired this video https://www.youtube.com/watch?v=YH-ipgxlJzs

On Sun, Dec 30, 2018 at 5:09 PM Lunga Baliwe  wrote:

> Please have a look at this link
> https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/ on
> how to setup static files.
> You may also want to run python manage.py collectstatic
>
> On Sun, Dec 30, 2018 at 4:31 AM abel otugeme  wrote:
>
>> This is how a site looks when i open it up in my browser No CSS! i
>> have done the necessary settings for Django to find the static files
>>
>> On Sat, Dec 29, 2018 at 5:14 PM Kasper Laudrup 
>> wrote:
>>
>>> Hi Abel,
>>>
>>> On 29/12/2018 08.07, abel otugeme wrote:
>>> > I really need help i have combed through stackover flow and this group
>>> > but the solutions provided don't work for me.  i use a 32bit windows 7
>>> > OS and the latest version of django
>>> >
>>>
>>> It would probably be easier for someone to help you if you tried to
>>> describe what your actual problem is.
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>> --
>>> 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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk
>>> .
>>> 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/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%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/CANDnEWfqpqyk-nesQcAKT-4i9tzAw8aJne2VjXFkgxqFWKJXiA%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/CAMrS0S_3dqSeH6osEsganiWJHk%3Dd%2B0Di0j2V9iqhDr0uD4qvag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-30 Thread Lunga Baliwe
Please have a look at this link
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/ on how
to setup static files.
You may also want to run python manage.py collectstatic

On Sun, Dec 30, 2018 at 4:31 AM abel otugeme  wrote:

> This is how a site looks when i open it up in my browser No CSS! i
> have done the necessary settings for Django to find the static files
>
> On Sat, Dec 29, 2018 at 5:14 PM Kasper Laudrup 
> wrote:
>
>> Hi Abel,
>>
>> On 29/12/2018 08.07, abel otugeme wrote:
>> > I really need help i have combed through stackover flow and this group
>> > but the solutions provided don't work for me.  i use a 32bit windows 7
>> > OS and the latest version of django
>> >
>>
>> It would probably be easier for someone to help you if you tried to
>> describe what your actual problem is.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> 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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk
>> .
>> 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/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%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/CANDnEWfqpqyk-nesQcAKT-4i9tzAw8aJne2VjXFkgxqFWKJXiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-29 Thread abel otugeme
This is how a site looks when i open it up in my browser No CSS! i have
done the necessary settings for Django to find the static files

On Sat, Dec 29, 2018 at 5:14 PM Kasper Laudrup 
wrote:

> Hi Abel,
>
> On 29/12/2018 08.07, abel otugeme wrote:
> > I really need help i have combed through stackover flow and this group
> > but the solutions provided don't work for me.  i use a 32bit windows 7
> > OS and the latest version of django
> >
>
> It would probably be easier for someone to help you if you tried to
> describe what your actual problem is.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk
> .
> 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/CAMrS0S91GG0A%3D3Z263Q9nxLccStat-URs3NsW_pfqES_J5uU2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-29 Thread Kasper Laudrup

Hi Abel,

On 29/12/2018 08.07, abel otugeme wrote:
I really need help i have combed through stackover flow and this group 
but the solutions provided don't work for me.  i use a 32bit windows 7 
OS and the latest version of django




It would probably be easier for someone to help you if you tried to 
describe what your actual problem is.


Kind regards,

Kasper Laudrup

--
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/c8273be3-bc53-2103-f503-ae7668f01622%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


STATIC FILES not working for admin site, projects and apps on DJANGO

2018-12-29 Thread abel otugeme
I really need help i have combed through stackover flow and this group but 
the solutions provided don't work for me.  i use a 32bit windows 7 OS and 
the latest version of django

-- 
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/b9e5b171-5c2d-4233-9766-86343c34777e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django admin site change_related_template_url problem

2018-12-29 Thread Zhe Li
Hi,

I am having issues with django installed on a server reversed proxied to 
the main website. Most of the sites work just fine except a very small 
detail in the admin site, change form page.

Django is running on server A, served at / on port 12345. Server B which is 
the main web server and has a domain www.example.com, and serves content 
(reverse proxies) from server A under /app/myapp.

i.e. *http://A:12345/admin/* translates to 
*https://www.example.com/app/myapp/admin*.

Everything is fine except when I try to modify a foreign key value from the 
model that it is referenced. You know, if I modify fields of model A in the 
django admin site, I can click on these buttons to change a foreign key 
model B.

[image: Screen Shot 2018-12-29 at 9.45.42 AM.png] 






The problem is that the links are not properly translated on server B. The 
"add" button is fine, but the "change" and the "delete" buttons are not. 
For example, the correct "change" button should point to 
*https://www.example.com/app/myapp/admin/main/modelb/1/change/?_to_field=id&_popup=1*,
 
but it actually points to 
*https://www.example.com/admin/main/modelb/1/change/?_to_field=id&_popup=1*, 
which does not exist. The problem is that the relative URL is stored in the 
"data-href-template" attribute of the  tag, like this

* id="change_id_modelb" 
> data-href-template="/admin/main/modelb/__fk__/change/?_to_field=id_popup=1"
>  
> title="Change selected modelb">*
>

which is parsed by static/admin/js/admin/RelatedObjectLookups.js, which 
adds a "real" href attribute via JS, giving

* id="change_id_system" 
> data-href-template="/admin/main/modelb/__fk__/change/?_to_field=id_popup=1"
>  
> title="Change selected modelb" 
> href="/admin/main/modelb/1/change/?_to_field=id_popup=1"> src="/app/myapp/static/admin/img/icon-changelink.svg" alt="Change">*


The reverse proxy program, however, only translates whatever is in the HTML 
, and does nothing about this customized data field.

This is not necessarily a bug, as it only happens in special cases like 
mine. I am not sure what to do -- I can modify this RelatedObjectLookups.js 
and just add '/app/myapp' in front of every link it produces, which should 
work and fix this problem at this point. However, a more complete solution 
would be to overhaul this lookup js and put a real link there, which is 
quite some work to do. Should I write a new ticket to Django Project, or do 
you have better suggestions?

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 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/cf876c89-c3e7-414e-8290-1e050f80f7b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-12-12 Thread Theodore D
https://stackoverflow.com/a/50827230/1198074

On Wednesday, June 27, 2018 at 10:59:58 PM UTC+3, Pato wrote:
>
> Ahmed, 
>
> Did you manage to figure out what was the problem? I ran into the same 
> problem. All POST requests  are throwing Page not found (404)
> Request Method: POST
>
>
> Let me know 
>
> Thanks
>
>
> On Friday, March 2, 2018 at 7:19:10 AM UTC-5, Tanvir Ahmed wrote:
>>
>> Hello, 
>>
>> I am fairly new to the web hosting world. I recently purchased a plan at 
>> a2hosting. It's a shared hosting plan. After some problems with FastCGI, I 
>> was told to use passenger to host django. I couldn't find much on this 
>> topic and somehow managed to get the website working. However, soon I 
>> realized that the post forms weren't working. More importantly, the admin 
>> site wasn't working properly. I get to the admin site login but once I try 
>> to login, I get a page not found error. 
>>
>> I have contacted the hosting provider and they seem to think that my 
>> configuration with passenger is wrong. They were kind enough to offer to 
>> change any server side settings if needed. So any idea what I am doing 
>> wrong? Could you guys provide me the steps to get django working with 
>> passenger? Or is it some server side settings fault?
>>
>> Please note that I decided to get rid of everything and start fresh. I 
>> created a project by, first creating a virtualenv using CPanel's setup 
>> python app. This also creates a passenger_wsgi.py and a .htaccess file. I 
>> edited the passenger_wsgi.py to the following code: 
>> from projectname.wsgi import application 
>>
>> After that I configured the settings where I made changes to the allowed 
>> hosts and provided the static and media files and directories. Then I ran 
>> collectstatics and made migrations and created superuser. Then, (keep in 
>> mind I am using the project I just created and haven't changed anything or 
>> added any apps) I went to, www.example.com/admin and the login appeared. 
>> But, once I do try to login, I get a page not found error.
>>
>> The directory looks something like this: 
>>
>> root(/home/username)
>> -virtualenv
>> -website
>> -passenger_wsgi.py
>> -manage.py
>> -public
>> -tmp
>> -project
>> -__init__.py
>> -settings.py
>> -wsgi.py
>> -urls.py
>>
>> Please note: there are other files but I included the ones I thought were 
>> necessary.
>>
>> Thank you in advance and sorry for any inconveniences
>>
>

-- 
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/9dead6a2-92c8-4f7e-88aa-8d5b126b3e96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-06-27 Thread Pato
Ahmed, 

Did you manage to figure out what was the problem? I ran into the same 
problem. All POST requests  are throwing Page not found (404)
Request Method: POST


Let me know 

Thanks


On Friday, March 2, 2018 at 7:19:10 AM UTC-5, Tanvir Ahmed wrote:
>
> Hello, 
>
> I am fairly new to the web hosting world. I recently purchased a plan at 
> a2hosting. It's a shared hosting plan. After some problems with FastCGI, I 
> was told to use passenger to host django. I couldn't find much on this 
> topic and somehow managed to get the website working. However, soon I 
> realized that the post forms weren't working. More importantly, the admin 
> site wasn't working properly. I get to the admin site login but once I try 
> to login, I get a page not found error. 
>
> I have contacted the hosting provider and they seem to think that my 
> configuration with passenger is wrong. They were kind enough to offer to 
> change any server side settings if needed. So any idea what I am doing 
> wrong? Could you guys provide me the steps to get django working with 
> passenger? Or is it some server side settings fault?
>
> Please note that I decided to get rid of everything and start fresh. I 
> created a project by, first creating a virtualenv using CPanel's setup 
> python app. This also creates a passenger_wsgi.py and a .htaccess file. I 
> edited the passenger_wsgi.py to the following code: 
> from projectname.wsgi import application 
>
> After that I configured the settings where I made changes to the allowed 
> hosts and provided the static and media files and directories. Then I ran 
> collectstatics and made migrations and created superuser. Then, (keep in 
> mind I am using the project I just created and haven't changed anything or 
> added any apps) I went to, www.example.com/admin and the login appeared. 
> But, once I do try to login, I get a page not found error.
>
> The directory looks something like this: 
>
> root(/home/username)
> -virtualenv
> -website
> -passenger_wsgi.py
> -manage.py
> -public
> -tmp
> -project
> -__init__.py
> -settings.py
> -wsgi.py
> -urls.py
>
> Please note: there are other files but I included the ones I thought were 
> necessary.
>
> Thank you in advance and sorry for any inconveniences
>

-- 
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/19651712-8b5d-4a93-ad50-eab4daac474d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble adding users through admin site

2018-06-10 Thread Dylan Moreland
Ah, perfect! I was inheriting from django.contrib.admin.ModelAdmin instead of 
django.contrib.auth.admin.UserAdmin. That worked. Thanks so much!

Dylan Moreland
Industrial Engineering Student
California Polytechnic State University, San Luis Obispo

> On Jun 9, 2018, at 17:30, Daniel Germano Travieso  
> wrote:
> 
> Hello Dylan
> 
> You will never see a user password as a raw text on django (only maybe if you 
> intercept the request the user creation form sent to the django view that 
> handles the creation)
> 
> User passwords are stored as their appropriate hash, and you can just use the 
> add user admin page to add a new user to your project (setting first it's 
> username and password and then the other settings).
> 
> Also, if you are using a custom User model that inherits AbstractUser, you 
> need to set it's UserAdmin (from django.contrib.auth.admin) via the admin.py 
> 
> You also need the setting AUTH_USER_MODEL to point to your custom User and do 
> this before creating or running any migrations or migrating
> 
> Check out the official docs [0] on the matter to learn more!
> 
> Also on an important note:
> User passwords are not displayed in the admin (nor stored in the database), 
> but the password storage details are displayed. Included in the display of 
> this information is a link to a password change form that allows admins to 
> change user passwords [1]
> 
> 
> [0] 
> https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project
>  
> <https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project>
> [1] https://djangobook.com/managing-users-admin/ 
> <https://djangobook.com/managing-users-admin/>
> 
> 
> 
> On Sat, Jun 9, 2018, 18:38 Dylan Moreland  <mailto:dylan.c.morel...@gmail.com>> wrote:
> Hello!
> 
> I've created a Django app for my company to track employee infractions 
> (missed punch, late to a shift, etc.), but I'm at a roadblock in terms of 
> adding users. Currently, the only way I can add users is through the command 
> line. I'd much rather be able to add users through the django.contrib.admin 
> site. However, I've found that if I input a password there, it treats is as 
> the value to enter into the database (post hashing/salting/etc.) rather than 
> raw text. This obviously does not work.
> 
> I'm using an AbstractUser model called Employee to represent users instead of 
> the default User model. This is just so I have the option of customizing my 
> model down the road if need be without having to deal with broken ForeignKey 
> relationships.
> 
> If this were on the frontend, I would write a view that would take the raw 
> password and send it through set_password(), and that would be the end of it. 
> But I'm not sure how to do that with the admin site.
> 
> Models.py:
> from django.db import models
> from django.contrib.auth.models import AbstractUser
> 
> # Create your models here.
> class Employee(AbstractUser):
>  def __str__(self):
>  return self.first_name
> 
> class InfractionType(models.Model):
>  description = models.CharField(max_length=30)
> 
>  def __str__(self):
>  return self.description
> 
> 
> class Infraction(models.Model):
>  timestamp = models.DateTimeField()
>  employee = models.ForeignKey(Employee, on_delete=models.CASCADE)
>  type = models.ForeignKey(InfractionType, on_delete=models.CASCADE)
>  has_comment = models.BooleanField(default=False)
>  description = models.CharField(max_length=200)
> 
>  def __str__(self):
>  return str(self.employee) + ": " + self.description
> 
> 
> Admin.py:
> from django.contrib import admin
> 
> # Register your models here.
> from .models import Employee, InfractionType, Infraction
> 
> class InfractionInline(admin.TabularInline):
>  model = Infraction
>  extra = 0
> 
> class EmployeeAdmin(admin.ModelAdmin):
>  fieldsets = [
>  ('Authentication and Metadata', {'fields': ['username', 'first_name', 
> 'last_name', 'email', 'groups', 'is_staff', 'is_active'], 'classes': 
> ['collapse']}),
> 
>  ]
>  inlines = [InfractionInline]
> 
>  # Prevent users from getting deleted (should be made inactive instead)
>  def has_delete_permission(self, request, obj=None):
>  return False
> 
> admin.site.register(Employee, EmployeeAdmin)
> admin.site.register(InfractionType)
> 
> What I see on the admin site:
> 
>  
> <https://lh3.googleusercontent.com/-NRNE_-LKhwo/WxxISxYyisI/Wms/hpmqa5_9fZQHn-42NK8PQJ_AuOo9C2dDwCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.32.03.png>
>  
> <https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI

Re: Trouble adding users through admin site

2018-06-09 Thread Daniel Germano Travieso
Hello Dylan

You will never see a user password as a raw text on django (only maybe if
you intercept the request the user creation form sent to the django view
that handles the creation)

User passwords are stored as their appropriate hash, and you can just use
the add user admin page to add a new user to your project (setting first
it's username and password and then the other settings).

Also, if you are using a custom User model that inherits AbstractUser, you
need to set it's UserAdmin (from django.contrib.auth.admin) via the
admin.py

You also need the setting AUTH_USER_MODEL to point to your custom User and
do this before creating or running any migrations or migrating

Check out the official docs [0] on the matter to learn more!

Also on an important note:
User passwords are not displayed in the admin (nor stored in the database),
but the password storage details are displayed. Included in the display of
this information is a link to a password change form that allows admins to
change user passwords [1]


[0]
https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project
[1] https://djangobook.com/managing-users-admin/



On Sat, Jun 9, 2018, 18:38 Dylan Moreland 
wrote:

> Hello!
>
> I've created a Django app for my company to track employee infractions
> (missed punch, late to a shift, etc.), but I'm at a roadblock in terms of
> adding users. Currently, the only way I can add users is through the
> command line. I'd much rather be able to add users through the
> django.contrib.admin site. However, I've found that if I input a password
> there, it treats is as the value to enter into the database (post
> hashing/salting/etc.) rather than raw text. This obviously does not work.
>
> I'm using an AbstractUser model called Employee to represent users instead
> of the default User model. This is just so I have the option of customizing
> my model down the road if need be without having to deal with broken
> ForeignKey relationships.
>
> If this were on the frontend, I would write a view that would take the raw
> password and send it through set_password(), and that would be the end of
> it. But I'm not sure how to do that with the admin site.
>
> *Models.py:*
> from django.db import models
> from django.contrib.auth.models import AbstractUser
>
> # Create your models here.
> class Employee(AbstractUser):
>  def __str__(self):
>  return self.first_name
>
> class InfractionType(models.Model):
>  description = models.CharField(max_length=30)
>
>  def __str__(self):
>  return self.description
>
>
> class Infraction(models.Model):
>  timestamp = models.DateTimeField()
>  employee = models.ForeignKey(Employee, on_delete=models.CASCADE)
>  type = models.ForeignKey(InfractionType, on_delete=models.CASCADE)
>  has_comment = models.BooleanField(default=False)
>  description = models.CharField(max_length=200)
>
>  def __str__(self):
>  return str(self.employee) + ": " + self.description
>
>
> *Admin.py:*
> from django.contrib import admin
>
> # Register your models here.
> from .models import Employee, InfractionType, Infraction
>
> class InfractionInline(admin.TabularInline):
>  model = Infraction
>  extra = 0
>
> class EmployeeAdmin(admin.ModelAdmin):
>  fieldsets = [
>  ('Authentication and Metadata', {'fields': ['username', 'first_name',
> 'last_name', 'email', 'groups', 'is_staff', 'is_active'], 'classes': [
> 'collapse']}),
>
>  ]
>  inlines = [InfractionInline]
>
>  # Prevent users from getting deleted (should be made inactive instead)
>  def has_delete_permission(self, request, obj=None):
>  return False
>
> admin.site.register(Employee, EmployeeAdmin)
> admin.site.register(InfractionType)
>
> What I see on the admin site:
>
>
> <https://lh3.googleusercontent.com/-NRNE_-LKhwo/WxxISxYyisI/Wms/hpmqa5_9fZQHn-42NK8PQJ_AuOo9C2dDwCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.32.03.png>
>
> <https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI/Wmo/Q8PlbP1shHkNp2O70uZJcpyDGpevZVw2gCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.31.33.png>
> <https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI/Wmo/Q8PlbP1shHkNp2O70uZJcpyDGpevZVw2gCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.31.33.png>
>
>
> Thanks for your help!
>
> --
> 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 t

Trouble adding users through admin site

2018-06-09 Thread Dylan Moreland
Hello!

I've created a Django app for my company to track employee infractions 
(missed punch, late to a shift, etc.), but I'm at a roadblock in terms of 
adding users. Currently, the only way I can add users is through the 
command line. I'd much rather be able to add users through the 
django.contrib.admin site. However, I've found that if I input a password 
there, it treats is as the value to enter into the database (post 
hashing/salting/etc.) rather than raw text. This obviously does not work.

I'm using an AbstractUser model called Employee to represent users instead 
of the default User model. This is just so I have the option of customizing 
my model down the road if need be without having to deal with broken 
ForeignKey relationships.

If this were on the frontend, I would write a view that would take the raw 
password and send it through set_password(), and that would be the end of 
it. But I'm not sure how to do that with the admin site.

*Models.py:*
from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.
class Employee(AbstractUser):
 def __str__(self):
 return self.first_name

class InfractionType(models.Model):
 description = models.CharField(max_length=30)

 def __str__(self):
 return self.description


class Infraction(models.Model):
 timestamp = models.DateTimeField()
 employee = models.ForeignKey(Employee, on_delete=models.CASCADE)
 type = models.ForeignKey(InfractionType, on_delete=models.CASCADE)
 has_comment = models.BooleanField(default=False)
 description = models.CharField(max_length=200)

 def __str__(self):
 return str(self.employee) + ": " + self.description


*Admin.py:*
from django.contrib import admin

# Register your models here.
from .models import Employee, InfractionType, Infraction

class InfractionInline(admin.TabularInline):
 model = Infraction
 extra = 0

class EmployeeAdmin(admin.ModelAdmin):
 fieldsets = [
 ('Authentication and Metadata', {'fields': ['username', 'first_name', 
'last_name', 'email', 'groups', 'is_staff', 'is_active'], 'classes': [
'collapse']}),

 ]
 inlines = [InfractionInline]

 # Prevent users from getting deleted (should be made inactive instead)
 def has_delete_permission(self, request, obj=None):
 return False

admin.site.register(Employee, EmployeeAdmin)
admin.site.register(InfractionType)

What I see on the admin site:

<https://lh3.googleusercontent.com/-NRNE_-LKhwo/WxxISxYyisI/Wms/hpmqa5_9fZQHn-42NK8PQJ_AuOo9C2dDwCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.32.03.png>
<https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI/Wmo/Q8PlbP1shHkNp2O70uZJcpyDGpevZVw2gCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.31.33.png>
 
<https://lh3.googleusercontent.com/-lIc4yE6amNM/WxxIPuf0eCI/Wmo/Q8PlbP1shHkNp2O70uZJcpyDGpevZVw2gCLcBGAs/s1600/Screen%2BShot%2B2018-06-09%2Bat%2B14.31.33.png>


Thanks for your help!

-- 
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/974890d1-9492-45a1-b3d9-6ba09558cbd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Admin site: pass data from AdminModel object to ModelForm object (or another way to pass data to "add" form)

2018-05-30 Thread Артур Скок
Globally, we need call "add" form for model in admin site, but with options 
selected by user: 
1. user checks items in "changelist" of objects RepoFile
2. select action "create job"
3. redirect user to standard "add" form for new object DeviceCronJob where 
field download_files already checked by selected files.
May be there is another way to do it. Variants that i tried is below.

I have add form for appropriate model. This model contains multichoice 
field:
*models.py:*



*class DeviceCronJob(models.Model):...download_files = 
models.TextField(max_length=250, blank=True, verbose_name=_("Files for 
downloading"))*

*forms.py:*

class DeviceCronJobAddForm(forms.ModelForm):
download_files = forms.MultipleChoiceField(
widget=forms.CheckboxSelectMultiple(), 
choices=[(file.hash, "%s [%s]" % (file.full_name,file.link)) 
for file in RepoFile.objects.filter()]
)

All work fine if i use standard admin "add".
I have other model RepoFile and customized Action: "Create download cronjob 
in template". On selecting files and pushing this action i need to pass 
selected files to DeviceCronJobAddForm.
i tried this:
*admin.py*
class DeviceCronJobAdmin(ModelAdmin):
model = DeviceCronJob
add_form = DeviceCronJobAddForm
list_display = ('cron_date', 'template', 'description', 
'download_files', 'cron_user', 'cron_path', 'cron_mode', 'cdate')
...
def get_form(self, request, obj=None, **kwargs):
defaults = {}
setted = request.GET.get('setted','').split(",")
if obj is None: # if add new
if len(setted):
defaults.update({'form': self.add_form(setted=setted)})
else:
defaults.update({'form': self.add_form})
else: # if change view
defaults.update({
'form': self.add_form,
})
defaults.update(kwargs)
return super(DeviceCronJobAdmin, self).get_form(request, obj, 
**defaults)

*models.py:*
class DeviceCronJobAddForm(forms.ModelForm):
...
def __init__(self, *args, **kwargs):
files = kwargs.pop('setted','')
# actions with files
super(DeviceCronJobAddForm, self).__init__(*args, **kwargs)

but it raises error: unknown setted in* super(DeviceCronJobAddForm, 
self).__init__(*args, **kwargs)*
Also i tried pass selected files like GET arguments, but Form has not 
access to request object

-- 
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/f0bafe2d-4ee7-4a65-a20d-553ffd8a63e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Fidel Leon
May we see your admin.py?

El vie., 4 may. 2018 a las 8:32, Harish Soni ()
escribió:

> Hi All,
> whenever I create a new model(table) and migrate. I can see it is
> available in mysql but its not showing in admin. I have to delete my db and
> make migrations of all the tables again to make that table show in admin.
>  any help would be appreciate.
>
> Regards
> Harish Soni Swarnkar
>
> --
> 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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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/CAHXg%3DN2Le%2BO1jRE7ELTOs1UTy75azLAoe6oqXeLzMFTrF2bC4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Harish Soni
I've added to app's admin.py then only mentioned in mail.

On Fri 4 May, 2018, 2:58 PM Fidel Leon,  wrote:

> You need to add your model to the app's admin.py file.
>
> As an example:
> https://docs.djangoproject.com/en/2.0/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin
>
> El vie., 4 may. 2018 a las 8:32, Harish Soni ()
> escribió:
>
>> Hi All,
>> whenever I create a new model(table) and migrate. I can see it is
>> available in mysql but its not showing in admin. I have to delete my db and
>> make migrations of all the tables again to make that table show in admin.
>>  any help would be appreciate.
>>
>> Regards
>> Harish Soni Swarnkar
>>
>> --
>> 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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Fidel Leon
> fi...@flm.cat
> Phone: +34 622 26 44 92
>
> --
> 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/CAHXg%3DN0GgESWXjOhJHjvdMnT0UGOY5usryLGGc_nNujWJOoPfw%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/CAMOFmonAV8UZAsJnYsTT8JN9FU8pysUm%2B15kzvjoPG%3D6wiUpqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Fidel Leon
You need to add your model to the app's admin.py file.

As an example:
https://docs.djangoproject.com/en/2.0/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin

El vie., 4 may. 2018 a las 8:32, Harish Soni ()
escribió:

> Hi All,
> whenever I create a new model(table) and migrate. I can see it is
> available in mysql but its not showing in admin. I have to delete my db and
> make migrations of all the tables again to make that table show in admin.
>  any help would be appreciate.
>
> Regards
> Harish Soni Swarnkar
>
> --
> 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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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/CAHXg%3DN0GgESWXjOhJHjvdMnT0UGOY5usryLGGc_nNujWJOoPfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Admin site and Model

2018-05-04 Thread Harish Soni
Hi All,
whenever I create a new model(table) and migrate. I can see it is available
in mysql but its not showing in admin. I have to delete my db and make
migrations of all the tables again to make that table show in admin.
 any help would be appreciate.

Regards
Harish Soni Swarnkar

-- 
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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and ModelAdmin

2018-05-04 Thread Mike Dewhirst

On 4/05/2018 7:02 AM, jt.oldn...@gmail.com wrote:

Thanks for the response Mike.

I generally don't like it when a design has to change to fit a framework,


I agree. My design is almost entirely in the models. I want an API to be 
able to work without Django forms.


however, in this case I decided to try your solution. I ran into a 
couple of problems though :-(
 1) The fields that I'm looking up were required fields. Validation 
failed and error messages were displayed until I changed my model to 
not require those fields (which creates other problems I'd need to 
fix). Is there a way to hook in before validation?


Maybe but not in the model. I think you should be able to intercept form 
validation. But see below.


I over-road the model save function. Would the pre-save signal method 
fix this problem?

No

Or maybe ModelAdmin.save_model?

Don't know. Possibly.

Django forms automatically do all the python-wise cleaning of data prior 
to the model's save() being called by the form If you are putting data 
independently from the form into fields inside the save() method (or via 
a pre_save hook) you have to be certain it is valid data.


I might be wrong but I don't think there is any effective difference 
between pre and post save signals and my approach. Maybe transaction 
management. Maybe not. This is my exact substance.save() method ...


    def save(self, *args, **kwargs):
    links = self._pre_save()
    super(Substance, self).save(*args, **kwargs)
    self._post_save(links)
    self._post_post_save()

Stuff which occurs in _pre_save() happens before the record is saved to 
the database. For example, the record may not yet have a primary key 
because it is new and hasn't ever been saved to the database. Stuff in 
_post_save() and _post_post_save() happens afterwards. I use those to 
create related records if required because by then (under normal circs) 
I can guarantee self.id is no longer null.


The last thing which happens prior to save() is the model's clean() 
method (if it exists) is called by the form. I put checks in there to be 
certain data in whatever fields I care deeply about is valid and raise a 
ValidationError if not. If that happens, the save() is aborted and the 
user has to fix the problem before trying again. Here is an example ...


    def clean(self):
    if self.physical_state is None:
    raise ValidationError('Physical form is required')

If you are getting external data you have no choice but to be certain it 
is good data. You need to validate it Python-wise en route to the 
destination model fields, perhaps in _pre_save() and business-rule-wise 
in Employee.clean()


The actual validation checks can be factored out and called from clean() 
or anywhere else such as save().


The actual sequence of events (form calls model.clean() before 
model.save()) indicates to me that Employee.clean() ought to be able to 
insert (clean) data into Employee fields before running its own business 
rule validation. However, whenever I have tried this I haven't been 
successful. Therefore I'm missing something. Maybe transaction 
management. Maybe someone can enlighten me?


A side note is that if you are not using a form, clean() does not get 
called. This matters for unit testing where there is no form. You have 
to deliberately call clean() to get the benefit of any checks.


 2) The desired result of the lookup would be to display the change 
form so that the information could be verified.


Sorry but that implies javascript and an API to fetch the data for 
verification if you want to do it all at once.


OTOH maybe you could save the Employee model without the external data 
and use a separate 1:1 model to carry it. That could be fetched 
separately after the Emplyee.save() has run. In my scenario it would be 
fetched in the _post_save() method and verified python-wise in there 
before adding the 1:1 model if it didn't already exist. The Employee 
would need to be saved again so the 1:1 model gets saved. The 1:1 model 
could check the business rule logic in its clean() method. Maybe the 
advantage here would be splitting the activity into separate atomic 
transactions and a 1:1 model validation error wouldn't interrupt the 
preceding Employee.save()


In other words, if doing the lookup, 'SAVE' (and 'Save and add 
another') should behave as if 'Save and continue editing' had been 
selected.


There is no save/clean difference between any of those. Just what 
happens next in the Admin.





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

Re: Admin site and ModelAdmin

2018-05-03 Thread jt . oldnews
Thanks for the response Mike.

I generally don't like it when a design has to change to fit a framework, 
however, in this case I decided to try your solution. I ran into a couple 
of problems though :-(
 1) The fields that I'm looking up were required fields. Validation failed 
and error messages were displayed until I changed my model to not require 
those fields (which creates other problems I'd need to fix). Is there a way 
to hook in before validation? I over-road the model save function. Would 
the pre-save signal method fix this problem? Or maybe ModelAdmin.save_model?
 2) The desired result of the lookup would be to display the change form so 
that the information could be verified. In other words, if doing the 
lookup, 'SAVE' (and 'Save and add another') should behave as if 'Save and 
continue editing' had been selected.


-- 
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/26f88b4c-b2dd-4bce-aea7-d885295aa609%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and ModelAdmin

2018-05-02 Thread Mike Dewhirst

On 3/05/2018 10:33 AM, Mike Dewhirst wrote:

On 3/05/2018 7:00 AM, jt.oldn...@gmail.com wrote:
I'm new to Django and web development in general (C++ background) and 
I've got amazingly far very quickly, but there's one thing I've been 
struggling with for a couple days now :-(. Forgive me if I screw up 
the lingo.


I've got a ModelAdmin page for registrants of a conference which has 
fields for Employee ID, Name, email etc. The registrant does not have 
to be an employee, but if they are I could lookup their name, email 
etc. from an external source (already have the Python code for this). 
I'd like to have a button next to the employee id field which would 
lookup the employee's details and fill in the appropriate fields. 
This seems to me that it shouldn't be too hard but I am spinning my 
wheels here.  Do I need to ditch ModelAdmin?  Can someone please 
point me in the right direction.


You may not need a button which, in the Admin, implies javascript and 
an API. In your model you can intercept the save() method to visit 
another database/system to fetch the detail before the record is 
saved. There are probably many ways to do this. One uses a pre-save 
signal [1] but I prefer to override save() [2].


class Employee(models.Model):

    ... all the fields etc

    fetchdata = models.BooleanField(default=False, blank=True)

    def save(self, *args, **kwargs):
    if self.fetchdata:
    self.fetchdata = False
            try:
        self.this, self.that = self.fetch_data()
    except Exception:
    # avoid losing other changes
    pass

 super(Employee, self).save(*args, **kwargs)

Sorry - should have read what I pasted in


super(Substance, self).save(*args, **kwargs)

    def fetch_data(self):
        #call external database with employee ID and return necessary 
detail

    return this, that

[1] https://docs.djangoproject.com/en/1.11/ref/signals/#pre-save
[2] 
https://docs.djangoproject.com/en/2.0/ref/models/instances/#saving-objects


hth



Thanks,
JT
--
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/1324e38c-ed15-4f3c-8e1e-cd7df220b96e%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/88249111-78d2-5076-0ea9-b0cb5d5d5ae6%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and ModelAdmin

2018-05-02 Thread Mike Dewhirst

On 3/05/2018 7:00 AM, jt.oldn...@gmail.com wrote:
I'm new to Django and web development in general (C++ background) and 
I've got amazingly far very quickly, but there's one thing I've been 
struggling with for a couple days now :-(. Forgive me if I screw up 
the lingo.


I've got a ModelAdmin page for registrants of a conference which has 
fields for Employee ID, Name, email etc. The registrant does not have 
to be an employee, but if they are I could lookup their name, email 
etc. from an external source (already have the Python code for this). 
I'd like to have a button next to the employee id field which would 
lookup the employee's details and fill in the appropriate fields. This 
seems to me that it shouldn't be too hard but I am spinning my wheels 
here.  Do I need to ditch ModelAdmin?  Can someone please point me in 
the right direction.


You may not need a button which, in the Admin, implies javascript and an 
API. In your model you can intercept the save() method to visit another 
database/system to fetch the detail before the record is saved. There 
are probably many ways to do this. One uses a pre-save signal [1] but I 
prefer to override save() [2].


class Employee(models.Model):

    ... all the fields etc

    fetchdata = models.BooleanField(default=False, blank=True)

    def save(self, *args, **kwargs):
    if self.fetchdata:
    self.fetchdata = False
            try:
        self.this, self.that = self.fetch_data()
    except Exception:
    # avoid losing other changes
    pass
    super(Substance, self).save(*args, **kwargs)

    def fetch_data(self):
        #call external database with employee ID and return necessary 
detail

    return this, that

[1] https://docs.djangoproject.com/en/1.11/ref/signals/#pre-save
[2] 
https://docs.djangoproject.com/en/2.0/ref/models/instances/#saving-objects


hth



Thanks,
JT
--
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/1324e38c-ed15-4f3c-8e1e-cd7df220b96e%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/add76f8e-b999-e9df-be5f-01bd2de26c3f%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Admin site and ModelAdmin

2018-05-02 Thread jt . oldnews
I'm new to Django and web development in general (C++ background) and I've 
got amazingly far very quickly, but there's one thing I've been struggling 
with for a couple days now :-(. Forgive me if I screw up the lingo.

I've got a ModelAdmin page for registrants of a conference which has fields 
for Employee ID, Name, email etc. The registrant does not have to be an 
employee, but if they are I could lookup their name, email etc. from an 
external source (already have the Python code for this). I'd like to have a 
button next to the employee id field which would lookup the employee's 
details and fill in the appropriate fields. This seems to me that it 
shouldn't be too hard but I am spinning my wheels here.  Do I need to ditch 
ModelAdmin?  Can someone please point me in the right direction.

Thanks,
JT

-- 
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/1324e38c-ed15-4f3c-8e1e-cd7df220b96e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread carlos
[i.fields for i in self.ingredients.objects.all()]
fields is you method __str__ back, try comments __str__ method in model
Ingredients

or this function get_ingredient create in admin files and used obj parameter

cheers

On Tue, Apr 3, 2018 at 10:34 AM, Muhammad bin-haneef <fakhirha...@gmail.com>
wrote:

> kindly share the code where you registered your product for admin site and
> you are calling "get_ ingredients()" method.
>
> As the error shows your method needs 2 arguments to pass when you call
> "get_ingredients()".
>
> On Tue, Apr 3, 2018 at 12:05 PM, mansi thakkar <mansithakkar...@gmail.com>
> wrote:
>
>> It is there in ProductIngredient.png.
>>
>> On Tuesday, April 3, 2018 at 11:57:38 AM UTC-4, squal poreover wrote:
>>>
>>> I need to see get_ingredients() . To guess what's happening?
>>>
>>> On Tue, 3 Apr 2018, 21:22 mansi thakkar, <mansith...@gmail.com> wrote:
>>>
>>>> Hello ,
>>>>
>>>> In my database, there is one table named Product and the other table is
>>>> Ingredient. Both are related with ManyToMany Relationship using bridge
>>>> entity (table) named ProductIngredient.
>>>>
>>>> I am trying to display Many To Many field named ingredient in my Django
>>>> admin site.
>>>>
>>>> Here is the attached code and screen shot of the error.
>>>>
>>>> I would like to know the solution of this error and also any other way
>>>> to display  the list of ingredients for each product.
>>>>
>>>> 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...@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/ms
>>>> gid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%40goog
>>>> legroups.com
>>>> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%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/ms
>> gid/django-users/2de0db4a-e455-464b-8a46-dae694ed52e4%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/2de0db4a-e455-464b-8a46-dae694ed52e4%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/CABFB2NVuBTs_GiJyVFOwC4VbpwyvmCBpGZBYJ0kDHn
> aqwPp_OQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABFB2NVuBTs_GiJyVFOwC4VbpwyvmCBpGZBYJ0kDHnaqwPp_OQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
att.
Carlos Rocha

-- 
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/CAM-7rO1prTG37fPSDeYpvH0TVNtg41dm-Y20e%3DvNSQZU4jd8RQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread Muhammad bin-haneef
kindly share the code where you registered your product for admin site and
you are calling "get_ ingredients()" method.

As the error shows your method needs 2 arguments to pass when you call "get_
ingredients()".

On Tue, Apr 3, 2018 at 12:05 PM, mansi thakkar <mansithakkar...@gmail.com>
wrote:

> It is there in ProductIngredient.png.
>
> On Tuesday, April 3, 2018 at 11:57:38 AM UTC-4, squal poreover wrote:
>>
>> I need to see get_ingredients() . To guess what's happening?
>>
>> On Tue, 3 Apr 2018, 21:22 mansi thakkar, <mansith...@gmail.com> wrote:
>>
>>> Hello ,
>>>
>>> In my database, there is one table named Product and the other table is
>>> Ingredient. Both are related with ManyToMany Relationship using bridge
>>> entity (table) named ProductIngredient.
>>>
>>> I am trying to display Many To Many field named ingredient in my Django
>>> admin site.
>>>
>>> Here is the attached code and screen shot of the error.
>>>
>>> I would like to know the solution of this error and also any other way
>>> to display  the list of ingredients for each product.
>>>
>>> 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...@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/ms
>>> gid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%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/2de0db4a-e455-464b-8a46-dae694ed52e4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2de0db4a-e455-464b-8a46-dae694ed52e4%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/CABFB2NVuBTs_GiJyVFOwC4VbpwyvmCBpGZBYJ0kDHnaqwPp_OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread mansi thakkar
Yes I have. But it didn't work. Basically my product has many ingredients 
and on ingredient is contained in many products so all I need is just 
display product with all the ingredients it contains on admin site.

On Tuesday, April 3, 2018 at 12:48:34 PM UTC-4, Julio Biason wrote:
>
> It seems your `get_ingredients()` is expecting the Product itself and 
> another object (for some reason).
>
> Have you tried to remove `obj` from the parameters and use `self` in that 
> function?
>
> On Tue, Apr 3, 2018 at 12:22 PM, mansi thakkar <mansith...@gmail.com 
> > wrote:
>
>> Hello ,
>>
>> In my database, there is one table named Product and the other table is 
>> Ingredient. Both are related with ManyToMany Relationship using bridge 
>> entity (table) named ProductIngredient. 
>>
>> I am trying to display Many To Many field named ingredient in my Django 
>> admin site. 
>>
>> Here is the attached code and screen shot of the error.
>>
>> I would like to know the solution of this error and also any other way to 
>> display  the list of ingredients for each product. 
>>
>> 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...@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/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> *Julio Biason*, Sofware Engineer
> *AZION*  |  Deliver. Accelerate. Protect.
> Office: +55 51 3083 8101  |  Mobile: +55 51 *99907 0554*
>

-- 
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/fd1fc0fe-a997-46f2-b9bf-96c7041e7108%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread Julio Biason
It seems your `get_ingredients()` is expecting the Product itself and
another object (for some reason).

Have you tried to remove `obj` from the parameters and use `self` in that
function?

On Tue, Apr 3, 2018 at 12:22 PM, mansi thakkar <mansithakkar...@gmail.com>
wrote:

> Hello ,
>
> In my database, there is one table named Product and the other table is
> Ingredient. Both are related with ManyToMany Relationship using bridge
> entity (table) named ProductIngredient.
>
> I am trying to display Many To Many field named ingredient in my Django
> admin site.
>
> Here is the attached code and screen shot of the error.
>
> I would like to know the solution of this error and also any other way to
> display  the list of ingredients for each product.
>
> 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 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/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101 <callto:+555130838101>  |  Mobile: +55 51
<callto:+5551996209291>*99907 0554*

-- 
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/CAEM7gE2ufSQNgKq-jrY3WBPM9N8Jd4b%3DZL%2B%3DxvLPgC-fepCXEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread mansi thakkar
It is there in ProductIngredient.png.

On Tuesday, April 3, 2018 at 11:57:38 AM UTC-4, squal poreover wrote:
>
> I need to see get_ingredients() . To guess what's happening?
>
> On Tue, 3 Apr 2018, 21:22 mansi thakkar, <mansith...@gmail.com 
> > wrote:
>
>> Hello ,
>>
>> In my database, there is one table named Product and the other table is 
>> Ingredient. Both are related with ManyToMany Relationship using bridge 
>> entity (table) named ProductIngredient. 
>>
>> I am trying to display Many To Many field named ingredient in my Django 
>> admin site. 
>>
>> Here is the attached code and screen shot of the error.
>>
>> I would like to know the solution of this error and also any other way to 
>> display  the list of ingredients for each product. 
>>
>> 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...@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/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%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/2de0db4a-e455-464b-8a46-dae694ed52e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread squal poreover
I need to see get_ingredients() . To guess what's happening?

On Tue, 3 Apr 2018, 21:22 mansi thakkar, <mansithakkar...@gmail.com> wrote:

> Hello ,
>
> In my database, there is one table named Product and the other table is
> Ingredient. Both are related with ManyToMany Relationship using bridge
> entity (table) named ProductIngredient.
>
> I am trying to display Many To Many field named ingredient in my Django
> admin site.
>
> Here is the attached code and screen shot of the error.
>
> I would like to know the solution of this error and also any other way to
> display  the list of ingredients for each product.
>
> 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 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/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%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/CANQmjds1Re5g9gyUQEQfxfz4S3VuHbOjqfyWUF2OhToE6k4fxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django tutorial 2.0 problem on admin site

2018-03-28 Thread Zhizhong Kang
Thank you. You are right there are problems in both my mysite/urls.py and 
polls/urls.py. I fixed it by following the tutorial.

On Wednesday, March 28, 2018 at 10:35:01 AM UTC-7, Daniel Hepper wrote:
>
> My guess is that there is a problem with your URL definition.
>
> Double-check your mysite/urls.py and polls/urls.py
>
> When in doubt, post the source of both files (preferably as text, 
> not screenshot).
>
> Hope that helps,
> Daniel
>
> On Wednesday, March 28, 2018 at 6:25:12 PM UTC+2, Zhizhong Kang wrote:
>>
>> Hey guys what's up. I've got problem on the poll app in the admin site. 
>> For now I can enter the admin site and poll app is displayed.
>>
>> <https://lh3.googleusercontent.com/-UJhq9WMUsag/Wru_b-UuSUI/A9g/bggjpv8rhOgZEb5SwqpO_EzX3MZtckL5ACLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.11.54%2BAM.png>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> However, when I clicked the 'Question', I didn't get the change lists 
>> page for Question. My admin.py is the same as the tutorial admin.py.
>>
>>
>> <https://lh3.googleusercontent.com/-RZHZJW78Da8/Wru_lSwraZI/A9k/LZ-RNbdnJKAVPGvP4CgufBoPWgOfE1cRwCLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.12.00%2BAM.png>
>>  
>> <https://lh3.googleusercontent.com/-PFZ5_IzS3pU/WrvAPHpbV9I/A9o/0GmjdO4AyLEtP8Q1pz5nxqf574Jn2RpMACLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.12.19%2BAM.png>
>>
>>
>> The env is python3 + django 2.0.3 + macOS 10.12.6.
>>
>>
>>
>>
>>
>>
>>

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


Re: Django tutorial 2.0 problem on admin site

2018-03-28 Thread Daniel Hepper
My guess is that there is a problem with your URL definition.

Double-check your mysite/urls.py and polls/urls.py

When in doubt, post the source of both files (preferably as text, 
not screenshot).

Hope that helps,
Daniel

On Wednesday, March 28, 2018 at 6:25:12 PM UTC+2, Zhizhong Kang wrote:
>
> Hey guys what's up. I've got problem on the poll app in the admin site. 
> For now I can enter the admin site and poll app is displayed.
>
> <https://lh3.googleusercontent.com/-UJhq9WMUsag/Wru_b-UuSUI/A9g/bggjpv8rhOgZEb5SwqpO_EzX3MZtckL5ACLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.11.54%2BAM.png>
>
>
>
>
>
>
>
>
>
>
>
>
>
> However, when I clicked the 'Question', I didn't get the change lists page 
> for Question. My admin.py is the same as the tutorial admin.py.
>
>
> <https://lh3.googleusercontent.com/-RZHZJW78Da8/Wru_lSwraZI/A9k/LZ-RNbdnJKAVPGvP4CgufBoPWgOfE1cRwCLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.12.00%2BAM.png>
>  
> <https://lh3.googleusercontent.com/-PFZ5_IzS3pU/WrvAPHpbV9I/A9o/0GmjdO4AyLEtP8Q1pz5nxqf574Jn2RpMACLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.12.19%2BAM.png>
>
>
> The env is python3 + django 2.0.3 + macOS 10.12.6.
>
>
>
>
>
>
>

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


Django tutorial 2.0 problem on admin site

2018-03-28 Thread Zhizhong Kang
Hey guys what's up. I've got problem on the poll app in the admin site. For 
now I can enter the admin site and poll app is displayed.
<https://lh3.googleusercontent.com/-UJhq9WMUsag/Wru_b-UuSUI/A9g/bggjpv8rhOgZEb5SwqpO_EzX3MZtckL5ACLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.11.54%2BAM.png>













However, when I clicked the 'Question', I didn't get the change lists page 
for Question. My admin.py is the same as the tutorial admin.py.

   
<https://lh3.googleusercontent.com/-RZHZJW78Da8/Wru_lSwraZI/A9k/LZ-RNbdnJKAVPGvP4CgufBoPWgOfE1cRwCLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.12.00%2BAM.png>
 
<https://lh3.googleusercontent.com/-PFZ5_IzS3pU/WrvAPHpbV9I/A9o/0GmjdO4AyLEtP8Q1pz5nxqf574Jn2RpMACLcBGAs/s1600/Screen%2BShot%2B2018-03-28%2Bat%2B9.12.19%2BAM.png>


The env is python3 + django 2.0.3 + macOS 10.12.6.






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


Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread team . readerspoint


On Friday, March 2, 2018 at 9:27:29 PM UTC+6, Vinicius Assef wrote:
>
> My bad. It's urls.py 
>
> On 2 March 2018 at 12:25, Vinicius Assef <vinic...@gmail.com > 
> wrote: 
> > Probably you have a problem with route. 
> > 
> > Check your routes.py again. 
> > 
> > On 2 March 2018 at 10:28,  <team.rea...@gmail.com > wrote: 
> >> 
> >> 
> >> On Friday, March 2, 2018 at 6:24:49 PM UTC+6, Vinicius Assef wrote: 
> >>> 
> >>> Some time ago I wrote this post [0]  about setting Python and Django 
> >>> on Dreamhost. They use passenger. 
> >>> 
> >>> Maybe it's useful to you. 
> >>> 
> >>> 
> >>> [0] 
> >>> 
> http://aprenda-python.blogspot.com.br/2016/06/setup-python-with-django-or-pyramid-on-dreamhost.html
>  
> >>> 
> >> 
> >>> 
> >>> 
> >>> 
> >>> On 2 March 2018 at 04:56, Tanvir Ahmed <team.rea...@gmail.com> wrote: 
> >>> > Hello, 
> >>> > 
> >>> > I am fairly new to the web hosting world. I recently purchased a 
> plan at 
> >>> > a2hosting. It's a shared hosting plan. After some problems with 
> FastCGI, 
> >>> > I 
> >>> > was told to use passenger to host django. I couldn't find much on 
> this 
> >>> > topic 
> >>> > and somehow managed to get the website working. However, soon I 
> realized 
> >>> > that the post forms weren't working. More importantly, the admin 
> site 
> >>> > wasn't 
> >>> > working properly. I get to the admin site login but once I try to 
> login, 
> >>> > I 
> >>> > get a page not found error. 
> >>> > 
> >>> > I have contacted the hosting provider and they seem to think that my 
> >>> > configuration with passenger is wrong. They were kind enough to 
> offer to 
> >>> > change any server side settings if needed. So any idea what I am 
> doing 
> >>> > wrong? Could you guys provide me the steps to get django working 
> with 
> >>> > passenger? Or is it some server side settings fault? 
> >>> > 
> >>> > Please note that I decided to get rid of everything and start fresh. 
> I 
> >>> > created a project by, first creating a virtualenv using CPanel's 
> setup 
> >>> > python app. This also creates a passenger_wsgi.py and a .htaccess 
> file. 
> >>> > I 
> >>> > edited the passenger_wsgi.py to the following code: 
> >>> > from projectname.wsgi import application 
> >>> > 
> >>> > After that I configured the settings where I made changes to the 
> allowed 
> >>> > hosts and provided the static and media files and directories. Then 
> I 
> >>> > ran 
> >>> > collectstatics and made migrations and created superuser. Then, 
> (keep in 
> >>> > mind I am using the project I just created and haven't changed 
> anything 
> >>> > or 
> >>> > added any apps) I went to, www.example.com/admin and the login 
> appeared. 
> >>> > But, once I do try to login, I get a page not found error. 
> >>> > 
> >>> > The directory looks something like this: 
> >>> > 
> >>> > root(/home/username) 
> >>> > -virtualenv 
> >>> > -website 
> >>> > -passenger_wsgi.py 
> >>> > -manage.py 
> >>> > -public 
> >>> > -tmp 
> >>> > -project 
> >>> > -__init__.py 
> >>> > -settings.py 
> >>> > -wsgi.py 
> >>> > -urls.py 
> >>> > 
> >>> > Please note: there are other files but I included the ones I thought 
> >>> > were 
> >>> > necessary. 
> >>> > 
> >>> > Thank you in advance and sorry for any inconveniences 
> >>> > 
> >>> > -- 
> >>> > 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

Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Vinicius Assef
My bad. It's urls.py

On 2 March 2018 at 12:25, Vinicius Assef <vinicius...@gmail.com> wrote:
> Probably you have a problem with route.
>
> Check your routes.py again.
>
> On 2 March 2018 at 10:28,  <team.readerspo...@gmail.com> wrote:
>>
>>
>> On Friday, March 2, 2018 at 6:24:49 PM UTC+6, Vinicius Assef wrote:
>>>
>>> Some time ago I wrote this post [0]  about setting Python and Django
>>> on Dreamhost. They use passenger.
>>>
>>> Maybe it's useful to you.
>>>
>>>
>>> [0]
>>> http://aprenda-python.blogspot.com.br/2016/06/setup-python-with-django-or-pyramid-on-dreamhost.html
>>>
>>
>>>
>>>
>>>
>>> On 2 March 2018 at 04:56, Tanvir Ahmed <team.rea...@gmail.com> wrote:
>>> > Hello,
>>> >
>>> > I am fairly new to the web hosting world. I recently purchased a plan at
>>> > a2hosting. It's a shared hosting plan. After some problems with FastCGI,
>>> > I
>>> > was told to use passenger to host django. I couldn't find much on this
>>> > topic
>>> > and somehow managed to get the website working. However, soon I realized
>>> > that the post forms weren't working. More importantly, the admin site
>>> > wasn't
>>> > working properly. I get to the admin site login but once I try to login,
>>> > I
>>> > get a page not found error.
>>> >
>>> > I have contacted the hosting provider and they seem to think that my
>>> > configuration with passenger is wrong. They were kind enough to offer to
>>> > change any server side settings if needed. So any idea what I am doing
>>> > wrong? Could you guys provide me the steps to get django working with
>>> > passenger? Or is it some server side settings fault?
>>> >
>>> > Please note that I decided to get rid of everything and start fresh. I
>>> > created a project by, first creating a virtualenv using CPanel's setup
>>> > python app. This also creates a passenger_wsgi.py and a .htaccess file.
>>> > I
>>> > edited the passenger_wsgi.py to the following code:
>>> > from projectname.wsgi import application
>>> >
>>> > After that I configured the settings where I made changes to the allowed
>>> > hosts and provided the static and media files and directories. Then I
>>> > ran
>>> > collectstatics and made migrations and created superuser. Then, (keep in
>>> > mind I am using the project I just created and haven't changed anything
>>> > or
>>> > added any apps) I went to, www.example.com/admin and the login appeared.
>>> > But, once I do try to login, I get a page not found error.
>>> >
>>> > The directory looks something like this:
>>> >
>>> > root(/home/username)
>>> > -virtualenv
>>> > -website
>>> > -passenger_wsgi.py
>>> > -manage.py
>>> > -public
>>> > -tmp
>>> > -project
>>> > -__init__.py
>>> > -settings.py
>>> > -wsgi.py
>>> > -urls.py
>>> >
>>> > Please note: there are other files but I included the ones I thought
>>> > were
>>> > necessary.
>>> >
>>> > Thank you in advance and sorry for any inconveniences
>>> >
>>> > --
>>> > 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/CAOe4Nxf_ux%2B9xN1f1Vn0qNN4%2Bi%3DU%2BBsfNy2oAEmgyUV39Pc-Kw%40mail.gmail.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>> Hello,
>>
>> Just followed the tutorial you have provided. The website is up and I do get
>> the welcome page. I also do get the admin login site. However, as I try to
>> login in with one of the superuser I have created, I get a page not found
>> error.
&g

Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Vinicius Assef
Probably you have a problem with route.

Check your routes.py again.

On 2 March 2018 at 10:28,  <team.readerspo...@gmail.com> wrote:
>
>
> On Friday, March 2, 2018 at 6:24:49 PM UTC+6, Vinicius Assef wrote:
>>
>> Some time ago I wrote this post [0]  about setting Python and Django
>> on Dreamhost. They use passenger.
>>
>> Maybe it's useful to you.
>>
>>
>> [0]
>> http://aprenda-python.blogspot.com.br/2016/06/setup-python-with-django-or-pyramid-on-dreamhost.html
>>
>
>>
>>
>>
>> On 2 March 2018 at 04:56, Tanvir Ahmed <team.rea...@gmail.com> wrote:
>> > Hello,
>> >
>> > I am fairly new to the web hosting world. I recently purchased a plan at
>> > a2hosting. It's a shared hosting plan. After some problems with FastCGI,
>> > I
>> > was told to use passenger to host django. I couldn't find much on this
>> > topic
>> > and somehow managed to get the website working. However, soon I realized
>> > that the post forms weren't working. More importantly, the admin site
>> > wasn't
>> > working properly. I get to the admin site login but once I try to login,
>> > I
>> > get a page not found error.
>> >
>> > I have contacted the hosting provider and they seem to think that my
>> > configuration with passenger is wrong. They were kind enough to offer to
>> > change any server side settings if needed. So any idea what I am doing
>> > wrong? Could you guys provide me the steps to get django working with
>> > passenger? Or is it some server side settings fault?
>> >
>> > Please note that I decided to get rid of everything and start fresh. I
>> > created a project by, first creating a virtualenv using CPanel's setup
>> > python app. This also creates a passenger_wsgi.py and a .htaccess file.
>> > I
>> > edited the passenger_wsgi.py to the following code:
>> > from projectname.wsgi import application
>> >
>> > After that I configured the settings where I made changes to the allowed
>> > hosts and provided the static and media files and directories. Then I
>> > ran
>> > collectstatics and made migrations and created superuser. Then, (keep in
>> > mind I am using the project I just created and haven't changed anything
>> > or
>> > added any apps) I went to, www.example.com/admin and the login appeared.
>> > But, once I do try to login, I get a page not found error.
>> >
>> > The directory looks something like this:
>> >
>> > root(/home/username)
>> > -virtualenv
>> > -website
>> > -passenger_wsgi.py
>> > -manage.py
>> > -public
>> > -tmp
>> > -project
>> > -__init__.py
>> > -settings.py
>> > -wsgi.py
>> > -urls.py
>> >
>> > Please note: there are other files but I included the ones I thought
>> > were
>> > necessary.
>> >
>> > Thank you in advance and sorry for any inconveniences
>> >
>> > --
>> > 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/CAOe4Nxf_ux%2B9xN1f1Vn0qNN4%2Bi%3DU%2BBsfNy2oAEmgyUV39Pc-Kw%40mail.gmail.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
>
> Hello,
>
> Just followed the tutorial you have provided. The website is up and I do get
> the welcome page. I also do get the admin login site. However, as I try to
> login in with one of the superuser I have created, I get a page not found
> error.
>
> Page not found (404)
>
>
> Request Method: POST
>
> Request URL: https://www.website.com/admin/login/?next=/admin/
>
> Raised by: django.contrib.admin.sites.login
>
>
> Using the URLconf defined in readerspoint.urls, Django tried these URL
> patterns, in this order:
>
>
> 1) admin/
>
>
> The empty path didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Dja

Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread team . readerspoint


On Friday, March 2, 2018 at 6:24:49 PM UTC+6, Vinicius Assef wrote:
>
> Some time ago I wrote this post [0]  about setting Python and Django 
> on Dreamhost. They use passenger. 
>
> Maybe it's useful to you. 
>
>
> [0] 
> http://aprenda-python.blogspot.com.br/2016/06/setup-python-with-django-or-pyramid-on-dreamhost.html
>  
>
>  

>
>
> On 2 March 2018 at 04:56, Tanvir Ahmed <team.rea...@gmail.com 
> > wrote: 
> > Hello, 
> > 
> > I am fairly new to the web hosting world. I recently purchased a plan at 
> > a2hosting. It's a shared hosting plan. After some problems with FastCGI, 
> I 
> > was told to use passenger to host django. I couldn't find much on this 
> topic 
> > and somehow managed to get the website working. However, soon I realized 
> > that the post forms weren't working. More importantly, the admin site 
> wasn't 
> > working properly. I get to the admin site login but once I try to login, 
> I 
> > get a page not found error. 
> > 
> > I have contacted the hosting provider and they seem to think that my 
> > configuration with passenger is wrong. They were kind enough to offer to 
> > change any server side settings if needed. So any idea what I am doing 
> > wrong? Could you guys provide me the steps to get django working with 
> > passenger? Or is it some server side settings fault? 
> > 
> > Please note that I decided to get rid of everything and start fresh. I 
> > created a project by, first creating a virtualenv using CPanel's setup 
> > python app. This also creates a passenger_wsgi.py and a .htaccess file. 
> I 
> > edited the passenger_wsgi.py to the following code: 
> > from projectname.wsgi import application 
> > 
> > After that I configured the settings where I made changes to the allowed 
> > hosts and provided the static and media files and directories. Then I 
> ran 
> > collectstatics and made migrations and created superuser. Then, (keep in 
> > mind I am using the project I just created and haven't changed anything 
> or 
> > added any apps) I went to, www.example.com/admin and the login 
> appeared. 
> > But, once I do try to login, I get a page not found error. 
> > 
> > The directory looks something like this: 
> > 
> > root(/home/username) 
> > -virtualenv 
> > -website 
> > -passenger_wsgi.py 
> > -manage.py 
> > -public 
> > -tmp 
> > -project 
> > -__init__.py 
> > -settings.py 
> > -wsgi.py 
> > -urls.py 
> > 
> > Please note: there are other files but I included the ones I thought 
> were 
> > necessary. 
> > 
> > Thank you in advance and sorry for any inconveniences 
> > 
> > -- 
> > 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/CAOe4Nxf_ux%2B9xN1f1Vn0qNN4%2Bi%3DU%2BBsfNy2oAEmgyUV39Pc-Kw%40mail.gmail.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 


Hello, 

Just followed the tutorial you have provided. The website is up and I do 
get the welcome page. I also do get the admin login site. However, as I try 
to login in with one of the superuser I have created, I get a page not 
found error. 

*Page not found (404)*


*Request Method: POST*

*Request URL: https://www.website.com/admin/login/?next=/admin/ 
<https://www.website.com/admin/login/?next=/admin/>*

*Raised by: django.contrib.admin.sites.login*


*Using the URLconf defined in readerspoint.urls, Django tried these URL 
patterns, in this order:*


*1) admin/*


*The empty path didn't match any of these.*

*You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.*


This is what the error looks like.

>  

-- 
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/0b59e202-8ce2-4d42-9d99-e217864b791d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread emepe
On Friday, March 2, 2018 at 9:19:10 AM UTC-3, Tanvir Ahmed wrote:
>
> I am fairly new to the web hosting world. I recently purchased a plan at 
> a2hosting. It's a shared hosting plan. After some problems with FastCGI, I 
> was told to use passenger to host django. I couldn't find much on this 
> topic and somehow managed to get the website working. However, soon I 
> realized that the post forms weren't working. More importantly, the admin 
> site wasn't working properly. I get to the admin site login but once I try 
> to login, I get a page not found error. 
>

For simple websites I might recommend using Webfaction. It is really easy 
and fast to have a site with Django and has a lot of support for Django 
sites.

- Ezequiel
https://flickrock.com/mikelpierre

-- 
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/44cf118f-912b-4804-b57b-3e3bae76d936%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread emepe

On Friday, March 2, 2018 at 9:19:10 AM UTC-3, Tanvir Ahmed wrote:
>
> I am fairly new to the web hosting world. I recently purchased a plan at 
> a2hosting. It's a shared hosting plan. After some problems with FastCGI, I 
> was told to use passenger to host django. I couldn't find much on this 
> topic and somehow managed to get the website working. However, soon I 
> realized that the post forms weren't working. More importantly, the admin 
> site wasn't working properly. I get to the admin site login but once I try 
> to login, I get a page not found error. 
>

Para websites sencillos podría recomendar usar Webfaction.  Es realmente 
fácil y rápido tener un sitio con Django y tiene mucho soporte para sitios 
Django.

- Ezequiel
http://flickrock.com/mikelpierre 

-- 
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/4cbd86d3-6795-4eea-b969-1accdc1c2b37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Vinicius Assef
Some time ago I wrote this post [0]  about setting Python and Django
on Dreamhost. They use passenger.

Maybe it's useful to you.


[0] 
http://aprenda-python.blogspot.com.br/2016/06/setup-python-with-django-or-pyramid-on-dreamhost.html



On 2 March 2018 at 04:56, Tanvir Ahmed <team.readerspo...@gmail.com> wrote:
> Hello,
>
> I am fairly new to the web hosting world. I recently purchased a plan at
> a2hosting. It's a shared hosting plan. After some problems with FastCGI, I
> was told to use passenger to host django. I couldn't find much on this topic
> and somehow managed to get the website working. However, soon I realized
> that the post forms weren't working. More importantly, the admin site wasn't
> working properly. I get to the admin site login but once I try to login, I
> get a page not found error.
>
> I have contacted the hosting provider and they seem to think that my
> configuration with passenger is wrong. They were kind enough to offer to
> change any server side settings if needed. So any idea what I am doing
> wrong? Could you guys provide me the steps to get django working with
> passenger? Or is it some server side settings fault?
>
> Please note that I decided to get rid of everything and start fresh. I
> created a project by, first creating a virtualenv using CPanel's setup
> python app. This also creates a passenger_wsgi.py and a .htaccess file. I
> edited the passenger_wsgi.py to the following code:
> from projectname.wsgi import application
>
> After that I configured the settings where I made changes to the allowed
> hosts and provided the static and media files and directories. Then I ran
> collectstatics and made migrations and created superuser. Then, (keep in
> mind I am using the project I just created and haven't changed anything or
> added any apps) I went to, www.example.com/admin and the login appeared.
> But, once I do try to login, I get a page not found error.
>
> The directory looks something like this:
>
> root(/home/username)
> -virtualenv
> -website
> -passenger_wsgi.py
> -manage.py
> -public
> -tmp
> -project
> -__init__.py
> -settings.py
> -wsgi.py
> -urls.py
>
> Please note: there are other files but I included the ones I thought were
> necessary.
>
> Thank you in advance and sorry for any inconveniences
>
> --
> 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/CAOe4Nxf_ux%2B9xN1f1Vn0qNN4%2Bi%3DU%2BBsfNy2oAEmgyUV39Pc-Kw%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/CAFmXjSADGMPzkwvPA-aDtV7y6%2B3VtrG6wFPK2Oh2RjHu7BTpDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Tanvir Ahmed
Hello,

I am fairly new to the web hosting world. I recently purchased a plan at
a2hosting. It's a shared hosting plan. After some problems with FastCGI, I
was told to use passenger to host django. I couldn't find much on this
topic and somehow managed to get the website working. However, soon I
realized that the post forms weren't working. More importantly, the admin
site wasn't working properly. I get to the admin site login but once I try
to login, I get a page not found error.

I have contacted the hosting provider and they seem to think that my
configuration with passenger is wrong. They were kind enough to offer to
change any server side settings if needed. So any idea what I am doing
wrong? Could you guys provide me the steps to get django working with
passenger? Or is it some server side settings fault?

Please note that I decided to get rid of everything and start fresh. I
created a project by, first creating a virtualenv using CPanel's setup
python app. This also creates a passenger_wsgi.py and a .htaccess file. I
edited the passenger_wsgi.py to the following code:
from projectname.wsgi import application

After that I configured the settings where I made changes to the allowed
hosts and provided the static and media files and directories. Then I ran
collectstatics and made migrations and created superuser. Then, (keep in
mind I am using the project I just created and haven't changed anything or
added any apps) I went to, www.example.com/admin and the login appeared.
But, once I do try to login, I get a page not found error.

The directory looks something like this:

root(/home/username)
-virtualenv
-website
-passenger_wsgi.py
-manage.py
-public
-tmp
-project
-__init__.py
-settings.py
-wsgi.py
-urls.py

Please note: there are other files but I included the ones I thought were
necessary.

Thank you in advance and sorry for any inconveniences

-- 
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/CAOe4Nxf_ux%2B9xN1f1Vn0qNN4%2Bi%3DU%2BBsfNy2oAEmgyUV39Pc-Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: There seems an issue in Django(1.11)'s password displaying form in admin site.

2017-04-19 Thread Xdynix
Thank you Simon, it's good to hear that.

在 2017年4月20日星期四 UTC+8上午10:03:27,Simon Charette写道:
>
> Hey there,
>
> It looks like it has been fixed already[0] and will be part of the 
> upcoming 1.11.1 release.
>
> Cheers,
> Simon
>
> [0] 
> https://github.com/django/django/commit/dff559ff83a6aac14de0bbca58101786edf4195f
>
> Le mercredi 19 avril 2017 17:31:47 UTC-4, Xdynix a écrit :
>>
>> Hello everyone.
>>
>> I'm new to django community and I'm not sure what should I do to what I 
>> found. So I decide to post it here.
>>
>> I would be very appreciated if someone could tell me whether it is still 
>> an issue or it has been fixed. And what should I do next.
>>
>> After I update my django from 1.10 to 1.11, I found the password 
>> displaying in admin site became like this:
>>
>>
>> <https://lh3.googleusercontent.com/-6b2Xv9sDDOU/WPe9QvFFs9I/AFM/aX12CoOF17ArKAav3fxrI1j45uY5VEDEwCLcB/s1600/TIM%25E6%2588%25AA%25E5%259B%25BE20170420034030.png>
>> The entries of encrypt information get into a mess!
>>
>> So I look into django's package and 
>> found 
>> \django\contrib\auth\templates\auth\widgets\read_only_password_hash.html
>>
>> The code in it is:
>>
>> {% for entry in summary %}
>>> <div{% include 'django/forms/widgets/attrs.html' %}>{{ 
>>> entry.label }}{% if entry.value %}: {{ entry.value }}{% endif %}
>>> {% endfor %}
>>
>>
>> Refer to the old looking, I edit the code into:
>>
>> <div{% include 'django/forms/widgets/attrs.html' %}>
>>> {% for entry in summary %}{{ entry.label }}{% if 
>>> entry.value %}: {{ entry.value }}{% endif %} {% endfor %}
>>> 
>>
>>
>> It worked! The password displaying in admin site looks just like old 
>> version.
>>
>>
>> <https://lh3.googleusercontent.com/-giRVrUilJP0/WPe_ueEiB_I/AFc/lY5mJyvLYqQ-X_qzEDkTMS9l8bzY19L6QCLcB/s1600/TIM%25E6%2588%25AA%25E5%259B%25BE20170420034921.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 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/76be3fe1-fa63-4f41-8bf4-05e866c0c101%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: There seems an issue in Django(1.11)'s password displaying form in admin site.

2017-04-19 Thread Simon Charette
Hey there,

It looks like it has been fixed already[0] and will be part of the upcoming 
1.11.1 release.

Cheers,
Simon

[0] 
https://github.com/django/django/commit/dff559ff83a6aac14de0bbca58101786edf4195f

Le mercredi 19 avril 2017 17:31:47 UTC-4, Xdynix a écrit :
>
> Hello everyone.
>
> I'm new to django community and I'm not sure what should I do to what I 
> found. So I decide to post it here.
>
> I would be very appreciated if someone could tell me whether it is still 
> an issue or it has been fixed. And what should I do next.
>
> After I update my django from 1.10 to 1.11, I found the password 
> displaying in admin site became like this:
>
>
> <https://lh3.googleusercontent.com/-6b2Xv9sDDOU/WPe9QvFFs9I/AFM/aX12CoOF17ArKAav3fxrI1j45uY5VEDEwCLcB/s1600/TIM%25E6%2588%25AA%25E5%259B%25BE20170420034030.png>
> The entries of encrypt information get into a mess!
>
> So I look into django's package and 
> found \django\contrib\auth\templates\auth\widgets\read_only_password_hash.html
>
> The code in it is:
>
> {% for entry in summary %}
>> <div{% include 'django/forms/widgets/attrs.html' %}>{{ 
>> entry.label }}{% if entry.value %}: {{ entry.value }}{% endif %}
>> {% endfor %}
>
>
> Refer to the old looking, I edit the code into:
>
> <div{% include 'django/forms/widgets/attrs.html' %}>
>> {% for entry in summary %}{{ entry.label }}{% if 
>> entry.value %}: {{ entry.value }}{% endif %} {% endfor %}
>> 
>
>
> It worked! The password displaying in admin site looks just like old 
> version.
>
>
> <https://lh3.googleusercontent.com/-giRVrUilJP0/WPe_ueEiB_I/AFc/lY5mJyvLYqQ-X_qzEDkTMS9l8bzY19L6QCLcB/s1600/TIM%25E6%2588%25AA%25E5%259B%25BE20170420034921.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 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/6cd37d2c-2647-43db-b5a4-0448e47cc7fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


There seems an issue in Django(1.11)'s password displaying form in admin site.

2017-04-19 Thread Xdynix
Hello everyone.

I'm new to django community and I'm not sure what should I do to what I 
found. So I decide to post it here.

I would be very appreciated if someone could tell me whether it is still an 
issue or it has been fixed. And what should I do next.

After I update my django from 1.10 to 1.11, I found the password displaying 
in admin site became like this:

<https://lh3.googleusercontent.com/-6b2Xv9sDDOU/WPe9QvFFs9I/AFM/aX12CoOF17ArKAav3fxrI1j45uY5VEDEwCLcB/s1600/TIM%25E6%2588%25AA%25E5%259B%25BE20170420034030.png>
The entries of encrypt information get into a mess!

So I look into django's package and 
found \django\contrib\auth\templates\auth\widgets\read_only_password_hash.html

The code in it is:

{% for entry in summary %}
> <div{% include 'django/forms/widgets/attrs.html' %}>{{ entry.label 
> }}{% if entry.value %}: {{ entry.value }}{% endif %}
> {% endfor %}


Refer to the old looking, I edit the code into:

<div{% include 'django/forms/widgets/attrs.html' %}>
> {% for entry in summary %}{{ entry.label }}{% if 
> entry.value %}: {{ entry.value }}{% endif %} {% endfor %}
> 


It worked! The password displaying in admin site looks just like old 
version.

<https://lh3.googleusercontent.com/-giRVrUilJP0/WPe_ueEiB_I/AFc/lY5mJyvLYqQ-X_qzEDkTMS9l8bzY19L6QCLcB/s1600/TIM%25E6%2588%25AA%25E5%259B%25BE20170420034921.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 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/ba0c395a-9b74-4468-af83-4bd7e7939d3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django official tutorial part 2 problem - model won't show on admin site

2017-02-23 Thread ludovic coues
Do you mind showing your admin.py ?

On 23 Feb 2017 3:27 a.m., "t0mgs" <t...@kidonpoint.com> wrote:

> Hi there,
>
> I've posted another topic but it seems to have gotten lost somehow. Not
> sure if there's approval needed or something.
>
> Anyways - I got stuck in this part of the tutorial
> <https://docs.djangoproject.com/en/1.10/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin>,
> and I've tried a few things to no avail - I can't seem to see the model in
> question (called Question) in my admin site:
>
> -Registered my app in the admin.py file.
> -Added it to INSTALLED_APPS in settings.py in my project folder.
> -Ran python manage.py makemigrations & python manage.py migrate without
> any changes (btw, for future readers - that's the new >1.8 incarnation of
> syncdb, I believe).
> -Made sure the user I'm signing in with has superuser priviliges (as per
> this answer).
> -Restarted my nginx.
>
> Thoughts?
>
> -T
>
> --
> 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/efeff828-13d0-469d-ab94-4515383a7240%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/efeff828-13d0-469d-ab94-4515383a7240%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/CAEuG%2BTZrEyvU8%3Dpp%3DgdZEvZ-2DcEmbwA6YBOjTwLjfPNa4%3DY4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django official tutorial part 2 problem - model won't show on admin site

2017-02-22 Thread t0mgs
Hi there,

I've posted another topic but it seems to have gotten lost somehow. Not 
sure if there's approval needed or something.

Anyways - I got stuck in this part of the tutorial 
<https://docs.djangoproject.com/en/1.10/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin>,
 
and I've tried a few things to no avail - I can't seem to see the model in 
question (called Question) in my admin site:

-Registered my app in the admin.py file.
-Added it to INSTALLED_APPS in settings.py in my project folder.
-Ran python manage.py makemigrations & python manage.py migrate without any 
changes (btw, for future readers - that's the new >1.8 incarnation of 
syncdb, I believe).
-Made sure the user I'm signing in with has superuser priviliges (as per 
this answer).
-Restarted my nginx.

Thoughts?

-T

-- 
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/efeff828-13d0-469d-ab94-4515383a7240%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django shell on django admin site

2017-01-28 Thread Grzegorz Tężycki
Hi everyone.
I created small application which can execute python code in django project 
environment.Maybe someone will be interested and has any suggestions.

django-admin-shell:
https://github.com/djk2/django-admin-shell

-- 
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/6d6e0491-714b-42f7-acd8-66c00d4ecaab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Admin site paginator does not appear

2016-11-30 Thread Xavier Pidelaserra
 

I'm setting up a django paginator in the Django Admin Site in order to 
display the elements 30by30 on the changelist. To do so, I'm using 
"list_per_page=30" on the DocumentAdmin.

It works fine on Firefox, but the paginator doesn't appear on Safari, 
either in iMac, iPad or iPhone... so I can only see the first 30 elements. 
However, it does appear when I reduce the amount of elements I want to 
display, for instance, 8. I have similar problems using Chrome.

Am I missing something? Any help is really welcome.

Thanks for your 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/41104ca8-def5-491a-8844-8a5ba560b7eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to hook into the admin site to count login attempts with REST API / proxy?

2016-11-20 Thread Luis Zárate
Hi
You can override the admin login page overwriting the URLs, you can put
your own login view in admin/account/login after admin include in URLs


El domingo, 20 de noviembre de 2016, Reza Shalbafzadeh <
rezashal...@gmail.com> escribió:
> Hi
> you still can use Django axes as described in Django axes  documentation:
>
> django-axes requires a supported Django version. The application is
intended to work around the Django admin and the regular
django.contrib.auth login-powered pages.
>
> Also you can manually register urls for Django axes
>
http://django-axes.readthedocs.io/en/latest/issues.html#not-being-locked-out-after-failed-attempts
> add watch_login to your admin url
>
> On Friday, November 4, 2016 at 8:16:20 PM UTC+3:30, Daniel Grace wrote:
>>
>> Hello, I have a REST API which is not publicly accessible as it is
behind a proxy.  However the admin site is publicly available through an
NGINX server.  The REST API already has functionality to count failed login
attempts and I would like to duplicate that functionality on the admin
login page.  How do I hook into the admin login page and add the
appropriate code?  Can I still use Django Axes or should I create my own
login form as a replacement?
>> 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/1d87fca9-1d1d-4a6f-ba10-30c47152917b%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyOrAyKEJNux3%3DRjFQ2sonWEzJKmQmFXGOSoO5k4AOrtxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to hook into the admin site to count login attempts with REST API / proxy?

2016-11-20 Thread Reza Shalbafzadeh
Hi
you still can use Django axes as described in Django axes  documentation 
<http://django-axes.readthedocs.io/en/latest/requirements.html?highlight=django%20admin>
:

django-axes requires a supported Django version. The application is 
intended to work around the Django admin and the regular django.contrib.auth 
login-powered pages. 

Also you can manually register urls for Django axes
http://django-axes.readthedocs.io/en/latest/issues.html#not-being-locked-out-after-failed-attempts
add watch_login to your admin url 

On Friday, November 4, 2016 at 8:16:20 PM UTC+3:30, Daniel Grace wrote:
>
> Hello, I have a REST API which is not publicly accessible as it is behind 
> a proxy.  However the admin site is publicly available through an NGINX 
> server.  The REST API already has functionality to count failed login 
> attempts and I would like to duplicate that functionality on the admin 
> login page.  How do I hook into the admin login page and add the 
> appropriate code?  Can I still use Django Axes or should I create my own 
> login form as a replacement?
> 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/1d87fca9-1d1d-4a6f-ba10-30c47152917b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to hook into the admin site to count login attempts with REST API / proxy?

2016-11-17 Thread T Thomas


Hi Daniel,

 

Hope this email finds you well! We are App Innovation Technologies 
<http://www.aitechindia.com/> expertise in Microsoft SharePoint, with the 
latest .NET Framework 3.5, 4.0 and 4.5 and sound knowledge in developing 
WPF based window and web applications. We use PHP, Word-Press and other 
open source technologies for website development and on mobile we work on 
iOS, Android and Windows applications. 

 

 Our lab is equipped with dedicated TFS 2012, MS SQL server 2012, MS 
SharePoint 2010 Enterprise servers in the base of Windows Server 2012 and 
Windows Server 2012 R2. We offer good quality work on a reasonable cost.

 

If you have any project, Please let me know.

 

Our work:

1. ASP.Net / .Net <http://www.aitechindia.com/experdocs/>

2. Website <http://www.aitechindia.com/unique/>

3. iOS Application <http://www.aitechindia.com/goamormobile/>

 

 Thanks & Regards,

Thomas Russell

+1-224-636-9884 

App Innovation Technologies <http://www.aitechindia.com/>




On Friday, November 4, 2016 at 10:16:20 PM UTC+5:30, Daniel Grace wrote:
>
> Hello, I have a REST API which is not publicly accessible as it is behind 
> a proxy.  However the admin site is publicly available through an NGINX 
> server.  The REST API already has functionality to count failed login 
> attempts and I would like to duplicate that functionality on the admin 
> login page.  How do I hook into the admin login page and add the 
> appropriate code?  Can I still use Django Axes or should I create my own 
> login form as a replacement?
> 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/abd37173-59f6-45b9-8574-5419cf9400e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site - prepopulating field based on foreign key

2016-11-07 Thread dodrian
Thanks, smart-selects has shown me how to do exactly what I wanted.

On Friday, 4 November 2016 10:36:58 UTC-5, Derek wrote:
>
> You need a third-party app e.g.
>
> https://github.com/digi604/django-smart-selects
>
>
> On Thursday, 3 November 2016 19:21:14 UTC+2, dod...@gmail.com wrote:
>>
>> I'm having trouble with my admin site, would appreciate any pointers.
>>
>> I have these three models in my database with relationships as shown:
>>
>> class Customer(models.Model):
>>   name=models.CharField(max_length=30)
>>
>> class Location(models.Model):
>>   name=models.CharField(max_length=30)
>>   customer = models.ForeignKey(Customer, on_delete = models.PROTECT)
>>
>> class License(models.Model):
>>   location=models.ForeignKey(Location, on_delete=models.PROTECT)
>>
>>
>> When the user creates a new License on the admin site, at the moment they 
>> have to choose what location the License is at via a dropdown box (a very 
>> long, confusing list), or create a new one if necessary.
>>
>> It would be much better if they could choose what Customer the license 
>> belongs to, and then choose the Location from the list of locations that 
>> have that customer as their foreign key.  They still may need to add a new 
>> location or even a new customer when doing this.
>>
>> What is the easiest way to do this on the admin site?  
>>
>> I am thinking that I will have to create a new widget with two dropdowns, 
>> and have the selection of the first make an AJAX query to populate the 
>> second.  Am I on the right track?  How can I then tie in this custom widget 
>> for the location field in License?
>>
>> I'm sure that this isn't a unique situation, but I haven't been able to 
>> find any tutorial or solution showing how to handle a follow-the-foreign 
>> key relationship.
>>
>

-- 
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/9cd8c293-a593-4fb3-bb01-5c88afffbac6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site - prepopulating field based on foreign key

2016-11-04 Thread Rafael E. Ferrero
Or you can filter the select with this
<https://docs.djangoproject.com/es/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey>


Rafael E. Ferrero

2016-11-04 12:36 GMT-03:00 Derek <gamesb...@gmail.com>:

> You need a third-party app e.g.
>
> https://github.com/digi604/django-smart-selects
>
>
> On Thursday, 3 November 2016 19:21:14 UTC+2, dod...@gmail.com wrote:
>>
>> I'm having trouble with my admin site, would appreciate any pointers.
>>
>> I have these three models in my database with relationships as shown:
>>
>> class Customer(models.Model):
>>   name=models.CharField(max_length=30)
>>
>> class Location(models.Model):
>>   name=models.CharField(max_length=30)
>>   customer = models.ForeignKey(Customer, on_delete = models.PROTECT)
>>
>> class License(models.Model):
>>   location=models.ForeignKey(Location, on_delete=models.PROTECT)
>>
>>
>> When the user creates a new License on the admin site, at the moment they
>> have to choose what location the License is at via a dropdown box (a very
>> long, confusing list), or create a new one if necessary.
>>
>> It would be much better if they could choose what Customer the license
>> belongs to, and then choose the Location from the list of locations that
>> have that customer as their foreign key.  They still may need to add a new
>> location or even a new customer when doing this.
>>
>> What is the easiest way to do this on the admin site?
>>
>> I am thinking that I will have to create a new widget with two dropdowns,
>> and have the selection of the first make an AJAX query to populate the
>> second.  Am I on the right track?  How can I then tie in this custom widget
>> for the location field in License?
>>
>> I'm sure that this isn't a unique situation, but I haven't been able to
>> find any tutorial or solution showing how to handle a follow-the-foreign
>> key relationship.
>>
> --
> 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/3dddffa5-a4c1-4e64-a3fe-a15b0d39c701%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3dddffa5-a4c1-4e64-a3fe-a15b0d39c701%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/CAJJc_8WdOBZ1m%2BO%3DA9KSCcch58N_u47rL7hEmbBaa76rEfM4fA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to hook into the admin site to count login attempts with REST API / proxy?

2016-11-04 Thread Daniel Grace
Hello, I have a REST API which is not publicly accessible as it is behind a 
proxy.  However the admin site is publicly available through an NGINX 
server.  The REST API already has functionality to count failed login 
attempts and I would like to duplicate that functionality on the admin 
login page.  How do I hook into the admin login page and add the 
appropriate code?  Can I still use Django Axes or should I create my own 
login form as a replacement?
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/69ea593b-4c5e-4eb6-ab9f-fa4639d17445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site - prepopulating field based on foreign key

2016-11-04 Thread Derek
You need a third-party app e.g.

https://github.com/digi604/django-smart-selects


On Thursday, 3 November 2016 19:21:14 UTC+2, dod...@gmail.com wrote:
>
> I'm having trouble with my admin site, would appreciate any pointers.
>
> I have these three models in my database with relationships as shown:
>
> class Customer(models.Model):
>   name=models.CharField(max_length=30)
>
> class Location(models.Model):
>   name=models.CharField(max_length=30)
>   customer = models.ForeignKey(Customer, on_delete = models.PROTECT)
>
> class License(models.Model):
>   location=models.ForeignKey(Location, on_delete=models.PROTECT)
>
>
> When the user creates a new License on the admin site, at the moment they 
> have to choose what location the License is at via a dropdown box (a very 
> long, confusing list), or create a new one if necessary.
>
> It would be much better if they could choose what Customer the license 
> belongs to, and then choose the Location from the list of locations that 
> have that customer as their foreign key.  They still may need to add a new 
> location or even a new customer when doing this.
>
> What is the easiest way to do this on the admin site?  
>
> I am thinking that I will have to create a new widget with two dropdowns, 
> and have the selection of the first make an AJAX query to populate the 
> second.  Am I on the right track?  How can I then tie in this custom widget 
> for the location field in License?
>
> I'm sure that this isn't a unique situation, but I haven't been able to 
> find any tutorial or solution showing how to handle a follow-the-foreign 
> key relationship.
>

-- 
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/3dddffa5-a4c1-4e64-a3fe-a15b0d39c701%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Admin site - prepopulating field based on foreign key

2016-11-03 Thread dodrian
I'm having trouble with my admin site, would appreciate any pointers.

I have these three models in my database with relationships as shown:

class Customer(models.Model):
  name=models.CharField(max_length=30)

class Location(models.Model):
  name=models.CharField(max_length=30)
  customer = models.ForeignKey(Customer, on_delete = models.PROTECT)

class License(models.Model):
  location=models.ForeignKey(Location, on_delete=models.PROTECT)


When the user creates a new License on the admin site, at the moment they 
have to choose what location the License is at via a dropdown box (a very 
long, confusing list), or create a new one if necessary.

It would be much better if they could choose what Customer the license 
belongs to, and then choose the Location from the list of locations that 
have that customer as their foreign key.  They still may need to add a new 
location or even a new customer when doing this.

What is the easiest way to do this on the admin site?  

I am thinking that I will have to create a new widget with two dropdowns, 
and have the selection of the first make an AJAX query to populate the 
second.  Am I on the right track?  How can I then tie in this custom widget 
for the location field in License?

I'm sure that this isn't a unique situation, but I haven't been able to 
find any tutorial or solution showing how to handle a follow-the-foreign 
key relationship.

-- 
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/1f590a65-b47a-4836-a08b-d9654822cbb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom form fields in admin site

2016-09-09 Thread Luis Zárate
Hi,

I started to make a test project, and review the django code in options,
but I see the problem and started to code in other way  the result is in

https://github.com/luisza/onetooneForm

Now is more interesting because I try to provide a way to update onetoone
fields in the same form.  I made an elegant solution rewriting __new__
function of modelform, but I have son dudes about my implementation and I
really need to test it.  (Finished coding a few minutes ago)

In the REAME are the to issues that make me ask for help those are:

   - If I use RelToParentFrom in onetooneForm/forms.py works ok, but I
   wanted something like in onetooneForm/forms_wanted.py
   - No way to sort fields
   - How can I use formfield_callback? it's necesary





2016-09-09 2:01 GMT-06:00 ludovic coues :

> It's not easy to understand what you are trying to do and in which way it
> is failing. It would require us setting up a test project.
> I am assuming you want that the Admin display a form with a field for each
> of Mymodel field plus the myextra_field attribute and what you get is
> either only the name fields and maybe the myextra_field. If that not the
> case, plus give us more information about your problem.
>
> MymodelAdmin.fields is overriding MyForm.fields. If you are curious, it's
> around line 594 of django/contrib/admin/options.py. If fields is set,
> get_fields return that. Else, it will return the form base_fields and the
> modeladmin readonly_fields.
>
>
>
> 2016-09-08 18:41 GMT+02:00 Luis Zárate :
>
>> Hi,  I am trying to do something like
>>
>>
>> class MyForm(forms.ModelForm):
>>  myextra_field = forms.IntegerField()
>>
>> class Meta:
>>   models = Mymodel
>>   fields = '__all__'
>>
>> class MymodelAdmin(admin.ModelAdmin):
>>   form = MyForm
>>   fields = ["name", 'myextra_field']
>>
>> def save(self, *args, **kwargs)
>> do something with myextra_field
>>
>>
>> I know that is possible to specify readonly_fields and fields works but
>> in readonly mode that is not what i want.
>>
>> So is there any way to have extra form fields in admin.ModelAdmin in edit
>> mode?
>>
>>
>>
>> --
>> "La utopía sirve para caminar" Fernando Birri
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAG%2B5VyNVmNPzjkd-9bV_j35%2BNn5PYdjvMzi6GQ
>> v%2BhaDFZLrbug%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Cordialement, Coues Ludovic
> +336 148 743 42
>
> --
> 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/CAEuG%2BTZHhNTu1MXqCq_YXNxbKqX5SjCXeH3VJvV8Me_
> zmXpLXw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyOhBkVXfeOWEh0Y0mA3eHkUs%3DeEV1xaPqoDocE%2BW3uCDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom form fields in admin site

2016-09-09 Thread ludovic coues
It's not easy to understand what you are trying to do and in which way it
is failing. It would require us setting up a test project.
I am assuming you want that the Admin display a form with a field for each
of Mymodel field plus the myextra_field attribute and what you get is
either only the name fields and maybe the myextra_field. If that not the
case, plus give us more information about your problem.

MymodelAdmin.fields is overriding MyForm.fields. If you are curious, it's
around line 594 of django/contrib/admin/options.py. If fields is set,
get_fields return that. Else, it will return the form base_fields and the
modeladmin readonly_fields.



2016-09-08 18:41 GMT+02:00 Luis Zárate :

> Hi,  I am trying to do something like
>
>
> class MyForm(forms.ModelForm):
>  myextra_field = forms.IntegerField()
>
> class Meta:
>   models = Mymodel
>   fields = '__all__'
>
> class MymodelAdmin(admin.ModelAdmin):
>   form = MyForm
>   fields = ["name", 'myextra_field']
>
> def save(self, *args, **kwargs)
> do something with myextra_field
>
>
> I know that is possible to specify readonly_fields and fields works but in
> readonly mode that is not what i want.
>
> So is there any way to have extra form fields in admin.ModelAdmin in edit
> mode?
>
>
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/CAG%2B5VyNVmNPzjkd-9bV_j35%2BNn5PYdjvMzi6GQ
> v%2BhaDFZLrbug%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTZHhNTu1MXqCq_YXNxbKqX5SjCXeH3VJvV8Me_zmXpLXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Custom form fields in admin site

2016-09-08 Thread Luis Zárate
Hi,  I am trying to do something like


class MyForm(forms.ModelForm):
 myextra_field = forms.IntegerField()

class Meta:
  models = Mymodel
  fields = '__all__'

class MymodelAdmin(admin.ModelAdmin):
  form = MyForm
  fields = ["name", 'myextra_field']

def save(self, *args, **kwargs)
do something with myextra_field


I know that is possible to specify readonly_fields and fields works but in
readonly mode that is not what i want.

So is there any way to have extra form fields in admin.ModelAdmin in edit
mode?



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyNVmNPzjkd-9bV_j35%2BNn5PYdjvMzi6GQv%2BhaDFZLrbug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use django.contrib.postgres.forms widgets in the admin site

2016-08-16 Thread François Schiettecatte
Go to the group web page at :

https://groups.google.com/group/django-users

Click on the My Settings icon (human figure and gear icon, top right) and click 
‘Leave this group’

François


> On Aug 16, 2016, at 6:28 AM, Elizabeth Mawer <elizabethma...@hotmail.com> 
> wrote:
> 
> Hi
> 
> I accidentally got signed up with this group and actually don't want to 
> receive emails.
> How do I unsubscribe?
> At the bottom of this email it says: To unsubscribe from this group and stop 
> receiving emails from it, send an email to 
> django-users+unsubscr...@googlegroups.com.
> But when I have used that email it is invalid, so I continue to receive 
> dozens of emails?
> 
> Any ideas?
> 
> Thanks,
> Liz
> 
> 
> From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf 
> of Jay Sheldon <jaysheld...@gmail.com>
> Sent: 16 August 2016 08:55
> To: Django users
> Subject: How to use django.contrib.postgres.forms widgets in the admin site
>  
> Hi there,
> 
> I just recently updated my database to postgres, looking to play with the 
> django supported field types HStoreField and JSONField (reference: 
> https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/fields/ )
> 
> I got the install working fine, but in my admin section - the widgets that 
> come with HStoreField is not appearing (reference: 
> https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/forms/ )
> 
> I cant see to figure out how to get the admin side to use the widget for 
> HStoreField.
> 
> Any ideas?
> 
> Thank you very much,
> Jay
> -- 
> 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/ce96dfbc-765d-4fb8-9ea8-9c6b3fa5017c%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/VI1PR07MB14708EEBB3B8CBB3C3DB6DEFC3130%40VI1PR07MB1470.eurprd07.prod.outlook.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/B6918EDB-AA0E-453A-9A67-A6D7C242B057%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use django.contrib.postgres.forms widgets in the admin site

2016-08-16 Thread Elizabeth Mawer
Hi


I accidentally got signed up with this group and actually don't want to receive 
emails.

How do I unsubscribe?

At the bottom of this email it says: To unsubscribe from this group and stop 
receiving emails from it, send an email to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.

But when I have used that email it is invalid, so I continue to receive dozens 
of emails?


Any ideas?


Thanks,

Liz



From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf 
of Jay Sheldon <jaysheld...@gmail.com>
Sent: 16 August 2016 08:55
To: Django users
Subject: How to use django.contrib.postgres.forms widgets in the admin site

Hi there,

I just recently updated my database to postgres, looking to play with the 
django supported field types HStoreField and JSONField (reference: 
https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/fields/ )

I got the install working fine, but in my admin section - the widgets that come 
with HStoreField is not appearing (reference: 
https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/forms/ )

I cant see to figure out how to get the admin side to use the widget for 
HStoreField.

Any ideas?

Thank you very much,
Jay

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce96dfbc-765d-4fb8-9ea8-9c6b3fa5017c%40googlegroups.com<https://groups.google.com/d/msgid/django-users/ce96dfbc-765d-4fb8-9ea8-9c6b3fa5017c%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/VI1PR07MB14708EEBB3B8CBB3C3DB6DEFC3130%40VI1PR07MB1470.eurprd07.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


How to use django.contrib.postgres.forms widgets in the admin site

2016-08-16 Thread Jay Sheldon
Hi there,

I just recently updated my database to postgres, looking to play with the 
django supported field types HStoreField and JSONField 
(reference: https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/fields/ 
)

I got the install working fine, but in my admin section - the widgets that 
come with HStoreField is not appearing (reference: 
https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/forms/ )

I cant see to figure out how to get the admin side to use the widget for 
HStoreField.

Any ideas?

Thank you very much,
Jay

-- 
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/ce96dfbc-765d-4fb8-9ea8-9c6b3fa5017c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Possible bug in Django Admin site in tabular inline or stacked inline with datetime shortcuts

2016-04-25 Thread Константин Попов
If anyone is interested in this question, I have fixed this myself, with 
approach number 2.
I had to copy two js files from django to my project and then fix that 
files.

вторник, 19 апреля 2016 г., 15:02:30 UTC+3 пользователь Константин Попов 
написал:
>
> Hi, django users.
>
> I have found possible bug in django admin site, using tabular inline with 
> datetime field. The same bug exists in stacked inline as I can see form 
> code.
>
> I am not sure what is the best way to report the bug, so I decided to 
> write here first.
> Please, give me advice on my next steps.
>
> Now, about the bug.
>
> Any datetime field is supplied with calendar and clock 
> shortcuts. static/admin/js/admin/DateTimeShortcuts.js contains code, wich 
> generated all html markup for them, this code runs on page load event.
> This code makes both span class="datetimeshortcuts" and hidden div 
> class="calendarbox module" or class="clockbox module".
>
> TabularFormset and stackedFormset jquery plugins, that live 
> in static/admin/js/inlines.js, both need to reinit datetime fields in the 
> newly added formset rows.
> They do it with this function:
>
> var reinitDateTimeShortCuts = function() {
>
> // Reinitialize the calendar and clock widgets by force, yuck.
> if (typeof DateTimeShortcuts !== "undefined") {
> $(".datetimeshortcuts").remove();
> DateTimeShortcuts.init();
> } 
>
> };
>
>
> As anyone can see, this function removes datetimeshortcuts spans but doesn't 
> remove "calendarbox module" and clockbox module" divs.
>
> Then, call to the DateTimeShortcuts.init() again and again adds both the 
> spans and the divs for all datetime fields on the page.
>
>
> Thus, by adding 20 rows in formset, I have about 400 useless hidden divs on 
> my page.
>
>
>
> I see several ways to fix this bug.
>
>
> 1. Modify DateTimeShortcuts.js to use single hidden div for all datetime 
> fields on the page
>
> 2. Modify DateTimeShortcuts.js init function to check if the datetime field 
> is alreay initialized to avoid it's re-initialization, and exclude removing 
> any DOM elements from reinitDateTimeShortCuts 
>
> 3. Expand set of elements, removed in reinitDateTimeShortCuts and remove divs 
> together with spans. Maybe it would be better to add reinit function into 
> DateTimeShortcuts.js
>
>

-- 
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/449afd1f-3c16-490a-a9fe-d3a73c1fa409%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Possible bug in Django Admin site in tabular inline or stacked inline with datetime shortcuts

2016-04-19 Thread Константин Попов
Hi, django users.

I have found possible bug in django admin site, using tabular inline with 
datetime field. The same bug exists in stacked inline as I can see form 
code.

I am not sure what is the best way to report the bug, so I decided to write 
here first.
Please, give me advice on my next steps.

Now, about the bug.

Any datetime field is supplied with calendar and clock 
shortcuts. static/admin/js/admin/DateTimeShortcuts.js contains code, wich 
generated all html markup for them, this code runs on page load event.
This code makes both span class="datetimeshortcuts" and hidden div 
class="calendarbox module" or class="clockbox module".

TabularFormset and stackedFormset jquery plugins, that live 
in static/admin/js/inlines.js, both need to reinit datetime fields in the 
newly added formset rows.
They do it with this function:

var reinitDateTimeShortCuts = function() {

// Reinitialize the calendar and clock widgets by force, yuck.
if (typeof DateTimeShortcuts !== "undefined") {
$(".datetimeshortcuts").remove();
DateTimeShortcuts.init();
} 

};


As anyone can see, this function removes datetimeshortcuts spans but doesn't 
remove "calendarbox module" and clockbox module" divs.

Then, call to the DateTimeShortcuts.init() again and again adds both the spans 
and the divs for all datetime fields on the page.


Thus, by adding 20 rows in formset, I have about 400 useless hidden divs on my 
page.



I see several ways to fix this bug.


1. Modify DateTimeShortcuts.js to use single hidden div for all datetime fields 
on the page

2. Modify DateTimeShortcuts.js init function to check if the datetime field is 
alreay initialized to avoid it's re-initialization, and exclude removing any 
DOM elements from reinitDateTimeShortCuts 

3. Expand set of elements, removed in reinitDateTimeShortCuts and remove divs 
together with spans. Maybe it would be better to add reinit function into 
DateTimeShortcuts.js

-- 
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/1e8a2e42-64e7-4ccf-9932-ed97462e9ea1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: form as filter in admin site

2016-02-22 Thread Luis Zárate
I need something like this, of course magic is in FormFilter :), so I am
lookig for something in admin app with this behaivor


class MatriculaForm(forms.Form):
# I am using django-ajax-selects, lookups are out of scope
disciplina = AutoCompleteSelectMultipleField('disciplinas',
 required=False,
 help_text=None)
ciclo = forms.ModelMultipleChoiceField(queryset=Ciclo.objects.all(),
   required=False)
proyecto = AutoCompleteSelectMultipleField('proyectos',
   required=False,
   help_text=None)



class MatriculaFilter(FormFilter):
template = "matriculafilter/filter_template.html"
form = MatriculaForm
title = "Matricula Filter"
# Needs for autocomplete fields that insert other input
remove_params = ['filtro', 'disciplina_text', 'proyecto_text']
#Map form fields with model fields for example FK relations
map_parameters = {'ciclo': 'proyeccion__ciclo'}



class MatriculaAdmin(admin.ModelAdmin)
list_filter = (
   MatriculaFilter,
   )

2016-02-20 9:56 GMT-06:00 Luis Zárate <luisz...@gmail.com>:

> I am trying to insert a filter in the admin site that have 2 autocomplete
> inputs so I was thinking to do  passed a form  with a custom filter, but I
> only find a list filter documentation.
>
> I solved the problem writing a custom filter, with a little problem with
> css, because change list view  has few width space for filter so input
> looks terrible.
>
> i needed to search in the django code because i didn't find in
> documentation.
>
> I think my solution is generic so I am asking me if django has this
> functionally implemented, I didn't find but maybe you know something about.
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>


-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyN-aRsTn06BmFaJjG0JP_-f5X7J4eH0%3DyB5ziAEFRmd5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
from django.contrib import admin

class FormFilter(admin.ListFilter):
template = "formfilter/filter_template.html"
form = None
form_instance = None
remove_params = []
map_parameters = None  # {}
delimeter = "|"

def _get_map_filter(self):
if self.map_parameters is None:
self.map_parameters = {}
for param in self._get_parameter_name():
if param not in self.map_parameters:
self.map_parameters[param] = param
return self.map_parameters

def get_map_filter(self):
""" Overwrite this function to provide new map params
def get_map_filter(self):
dev = super(MyClass, self).get_map_filter
dev['myparam'] = 'query_set_param'
return dev
"""
return self._get_map_filter()

def _get_parameter_name(self, request=None):
if self.form_instance is None:
if request is not None:
self.form_instance = self.form(request.GET)
else:
self.form_instance = self.form()
return self.form_instance.fields.keys()

def __init__(self, request, params, model, model_admin):

self.used_parameters = {}
# intentional comment this line
# super(FormFilter, self).__init__(
#request, params, model, model_admin)
if self.form is None:
raise ImproperlyConfigured(
"The form filter '%s' does not specify "
"a 'form'." % self.__class__.__name__)

for parameter_name in self._get_parameter_name(request):
if parameter_name in params:
value = params.pop(parameter_name)
self.used_parameters[parameter_name] = value

for param in self.remove_params:
if param in params:
params.pop(param)

def has_output(self):
return True

def value(self):
"""
Returns the value (in string format) provided in the request's
query string for this filter, if any. If the value wasn't provided then
returns None.
"""
return None  

  1   2   3   4   5   6   7   8   9   >