Re: How to send dict to template and use it

2020-05-06 Thread 'Amitesh Sahay' via Django users
Your view seems to have incorrect render.

Sent from Yahoo Mail on Android 
 
  On Thu, 7 May 2020 at 11:25, Mohsen Pahlevanzadeh 
wrote:   I have the following view function:

def index(request, question_id):
    latest_question_list = User.objects.all() #Post.objects.all()
    template = loader.get_template('posts/index.html')
    context = {
          'latest_question_list': latest_question_list,
      }
    return HttpResponse(template.render(context))
#
And the following template:

{% if latest_question_list %}

          salaam
          {{ latest_question_list }}
 {% endif %}
###

I see the following result in my browser:
#

salaam
]>


##

How Can I some field in my Queryset in template?

-- 
You received this message because you are subscribed 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/CAJFFGZLhqwkvNVbHtGoU2zG5HdNjy-xbL7NbSTWJxfN0tnaZKQ%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/1903469156.1738920.1588832205464%40mail.yahoo.com.


How to send dict to template and use it

2020-05-06 Thread Mohsen Pahlevanzadeh
I have the following view function:

def index(request, question_id):
latest_question_list = User.objects.all() #Post.objects.all()
template = loader.get_template('posts/index.html')
 context = {
   'latest_question_list': latest_question_list,
   }
 return HttpResponse(template.render(context))
#
And the following template:

{% if latest_question_list %}

   salaam
  {{ latest_question_list }}
 {% endif %}
###

I see the following result in my browser:
#

salaam
]>


##

How Can I some field in my Queryset in template?

-- 
You received this message because you are subscribed 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/CAJFFGZLhqwkvNVbHtGoU2zG5HdNjy-xbL7NbSTWJxfN0tnaZKQ%40mail.gmail.com.


Re: Create a function which fill automatically a field in my models

2020-05-06 Thread Anselme SERI
Thanks you for your answer. I know how to make a default value in charfield
but I don't know  how to build function which returns value for my default
field. In my case this function must retrieve last id on my model and must
concataned it with a string and the final result must be affected to
default charfield. Have you an example ? Help me plz.

Le mer. 6 mai 2020 à 18:44, Motaz Hejaze  a écrit :

> Yes you can make a normal charfield and assign its default attribute to a
> function you declare
>
> On Wed, 6 May 2020, 6:53 pm Anselme SERI, 
> wrote:
>
>> Hi,
>>
>> I use Django 3.0 and I would like to create a function which fill
>> automatically a field in my models.
>> Can I do it directly in models.py ? How?
>>
>> Thanks a lot
>>
>> --
>> You received this message because you are subscribed 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/5f810453-c7ca-4c10-bca1-4cfe11ea496a%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/CAHV4E-dDRD%3DLteuDo7KuATzjKem-ThvtozzHuaqkwAeAC%2BBrZw%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/CACbA33rshU-SxKu89dTUXAKfvkbBCxyUGY4F1_qhT3nOYRf%3Dzw%40mail.gmail.com.


Re: Best hosting for Django Application?

2020-05-06 Thread Sherif Adigun
Now I'm very confused and my client will request for the project to be
hosting in two weeks. I don't want to make a mistake about host

On Wed, May 6, 2020, 11:44 PM Gabriel Araya Garcia <
gabrielaraya2...@gmail.com> wrote:

> I've learned Django for a year, and I have my project hosted in
> PYTHONANYWHERE, however, I never had have a problem. It's very easy, you
> can If you are a beginner to use the free account, or else a paid one.
> If you have any question, don't hesitate to ask me.
>
> Regards,
>
> Gabriel Araya Garcia
> GMI - Desarrollo de Sistemas Informáticos
> Santiago de Chile
> 99.7721.15.70
>
>
>
> El mié., 6 may. 2020 a las 14:18, Nomeh Uchenna Gabriel (<
> nomehgabri...@gmail.com>) escribió:
>
>> please don't ever use "python-anywhere" for a serious project unless you
>> have enough tears 😭 in your eye balls to cry out when the time comes.
>>
>> ... I suggest "digitalocean/linode" so that the heavy problems of "SSL
>> certificates" won't beat you up
>>
>> --
>> You received this message because you are subscribed 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/ee7b3e5b-20f8-4f70-aca2-3fc689a30a37%40googlegroups.com
>> .
>>
> --
> 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/DU9_nRpJcz4/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/CAKVvSDDzT8xJf5c1qxpb6CL%3DSUeNZ_evHEnfLyPihaBiZi17OA%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/CACP0aXhDBUgPQJs3HRd6103zLvN2-h4_eEwR_sE29ZwC-Zhp3g%40mail.gmail.com.


Seeking django plugin for SAML integration for SPA application

2020-05-06 Thread suman patel
Hi All,

I have a SPA in React-Django 2.2.x and we need to implement SAML for
SSO. Looking for suggestion on django plugin for Authentication and
authorization. Looking for stable package where user auth, permission and
groups can be handled from external IDP and seamless integration with
Django 2.x

I have explored Django-saml2 and python3-saml package but not getting good
documentation around this.
 Appreciate help.

Thanks
Patel

-- 
You received this message because you are subscribed 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/CAPjHK8CdpGKSH9r6cJzLGOozNP-D6gwqZwJN3M6-wCGKyYOEXQ%40mail.gmail.com.


Running sync_to_async to create object, but YET raise .ASynchronous exception

2020-05-06 Thread DAVID ALEJANDRO Pineda
Hello guys!

I'm stucked on this problem, i have some script to save data to database 
using a django object.

The script is with async,so i have to use the 'sync_to_async' function.

Beyond that, running the script raise the ASynchronous exception, but it's 
look correct.

Code:

```
async def cycle_send_to_dj(self, *args):
"""
Leer la cola que recibe de rmq
Enviar cada dato recibido de la cola y cargarlo
"""
queue = args[0]
data = []
try:
#breakpoint()
async for elem in read_async_queue(queue):
gprint("Recibiendo data en async queue")
rprint(elem)
# transformar elem para que sea guardable
try:
data_log = await statusdata2log(
elem.get("station"), **elem.get("data"))
if data_log:
try:
bprint("="*20+">")
gprint("Data log")
rprint(data_log)
bprint("ready to build")
breakpoint()
value = await 
sync_to_async(LogUnidadGNSS)(**data_log)
rprint(value)
data.append(value)
except Exception as e:
bprint("Creando lista de logs, error %s, 
LogUnidadGNSS create" % e)
raise e
except Exception as e:
print("Error al transformar elem %s" % e)

gprint("Data to save")
[print(elem) for elem in data]
if data:
#await  dbaccess(LogUnidadGNSS.objects.bulk_create)(data)
await dbaccess(LogUnidadGNSS.objects.bulk_create)(data)
except Exception as e:
print("Hubo una excepción al guardar los datos de LogGNSS")
raise e
return args
```

I'm worng in somethinkg?

-- 
You received this message because you are subscribed 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/70ef401a-636d-4464-a912-a3f004e2de3a%40googlegroups.com.


Custom Mysql Lookup for FULLTEXT Search Returns empy on test runs

2020-05-06 Thread Gui Talarico
Hi everyone - I am sorry if this is not the right place or format to ask 
for this typo of help.
I have been trying to solve this issue for a while but have not had any 
luck.


I created a Custom Lookup to be able to do full text search on mysql:

```

# lookup

class Search(models.Lookup):
lookup_name = "search"

def as_mysql(self, compiler, connection):
lhs, lhs_params = self.process_lhs(compiler, connection)
rhs, rhs_params = self.process_rhs(compiler, connection)
params = lhs_params + rhs_params
return f"MATCH (%s) AGAINST (%s IN BOOLEAN MODE)" % (lhs, rhs), params


models.TextField.register_lookup(Search)

# Migrations

  from django.db import migrations, models

# Table details
table_name = "by_api_casesnapshot"
field_name = "text"
index_name = f"{table_name}_{field_name}_index"

class Migration(migrations.Migration):

dependencies = [("by_api", "0033_add_tag_color")]

operations = [
migrations.CreateModel(...), # As auto-generated
migrations.RunSQL(
f"CREATE FULLTEXT INDEX {index_name} ON {table_name} 
({field_name})",
f"DROP INDEX {index_name} ON {table_name}",
),
]

```

The __search works fine, but I use it inside a test suite it returns empty.

Any help or feedback is appreciated


Details are here
https://stackoverflow.com/questions/61486725/django-mysql-fulltext-search-works-but-not-on-tests

-- 
You received this message because you are subscribed 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/3fea10db-692b-4865-9733-b87bb647055f%40googlegroups.com.


Re: Best hosting for Django Application?

2020-05-06 Thread Gabriel Araya Garcia
I've learned Django for a year, and I have my project hosted in
PYTHONANYWHERE, however, I never had have a problem. It's very easy, you
can If you are a beginner to use the free account, or else a paid one.
If you have any question, don't hesitate to ask me.

Regards,

Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos
Santiago de Chile
99.7721.15.70



El mié., 6 may. 2020 a las 14:18, Nomeh Uchenna Gabriel (<
nomehgabri...@gmail.com>) escribió:

> please don't ever use "python-anywhere" for a serious project unless you
> have enough tears 😭 in your eye balls to cry out when the time comes.
>
> ... I suggest "digitalocean/linode" so that the heavy problems of "SSL
> certificates" won't beat you up
>
> --
> You received this message because you are subscribed 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/ee7b3e5b-20f8-4f70-aca2-3fc689a30a37%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/CAKVvSDDzT8xJf5c1qxpb6CL%3DSUeNZ_evHEnfLyPihaBiZi17OA%40mail.gmail.com.


Re: Best hosting for Django Application?

2020-05-06 Thread Sherif Adigun
Oh, thank you for that. I'm really afraid for I don't want my client to
tear my hair out.

How about heroku? Have you tried that ?

On Wed, May 6, 2020, 7:19 PM Nomeh Uchenna Gabriel 
wrote:

> please don't ever use "python-anywhere" for a serious project unless you
> have enough tears 😭 in your eye balls to cry out when the time comes.
>
> ... I suggest "digitalocean/linode" so that the heavy problems of "SSL
> certificates" won't beat you up
>
> --
> 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/DU9_nRpJcz4/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/ee7b3e5b-20f8-4f70-aca2-3fc689a30a37%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/CACP0aXiOhLXwfpRQe6PTbPH-a5pU9PmZA8xPs_n%2B-ia6-c7saQ%40mail.gmail.com.


Re: How to create variables for an e-commerce website

2020-05-06 Thread Lunga Baliwe
maybe also check https://djangopackages.org/grids/g/ecommerce/ for django
ecommerce packages

On Wed, May 6, 2020 at 8:35 PM Motaz Hejaze  wrote:

> One solution is to make a 3 columns table , the first column is
> 'property_name' , second column 'property_value' , third column is a
> foriegn key to the item that this property belongs to 'item_id'
>
> On Wed, 6 May 2020, 8:06 pm Ahmed Khairy, 
> wrote:
>
>> Hi am looking for resources to create variables such as size and color to
>> an e-commerce website
>>
>> --
>> You received this message because you are subscribed 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/e6ce14b0-c0ff-46fa-8903-635ed60c4459%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/CAHV4E-fUaT793Yctyim_cyY-SzrpNkw_Sbn6dO4O-8QEm-agOg%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/CANDnEWcAnK0QHTWyiHtr%2BC3AkGwmvtq0EP3YG6jQBFCgyZD8XA%40mail.gmail.com.


Re: Create a function which fill automatically a field in my models

2020-05-06 Thread Motaz Hejaze
Yes you can make a normal charfield and assign its default attribute to a
function you declare

On Wed, 6 May 2020, 6:53 pm Anselme SERI,  wrote:

> Hi,
>
> I use Django 3.0 and I would like to create a function which fill
> automatically a field in my models.
> Can I do it directly in models.py ? How?
>
> Thanks a lot
>
> --
> You received this message because you are subscribed 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/5f810453-c7ca-4c10-bca1-4cfe11ea496a%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/CAHV4E-dDRD%3DLteuDo7KuATzjKem-ThvtozzHuaqkwAeAC%2BBrZw%40mail.gmail.com.


Re: How to create variables for an e-commerce website

2020-05-06 Thread Motaz Hejaze
One solution is to make a 3 columns table , the first column is
'property_name' , second column 'property_value' , third column is a
foriegn key to the item that this property belongs to 'item_id'

On Wed, 6 May 2020, 8:06 pm Ahmed Khairy, 
wrote:

> Hi am looking for resources to create variables such as size and color to
> an e-commerce website
>
> --
> You received this message because you are subscribed 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/e6ce14b0-c0ff-46fa-8903-635ed60c4459%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/CAHV4E-fUaT793Yctyim_cyY-SzrpNkw_Sbn6dO4O-8QEm-agOg%40mail.gmail.com.


Re:

2020-05-06 Thread Nomeh Uchenna Gabriel
That's quite easy -
___
models.py:
class num(models.Model):
item = models.BigIntegerField(...)
___
views.py:
from . import models
def funct(request):
mdl = models.num.objects.get(id__exact=1)
mdl2 = models.num.objects.get(id__exact=1)

adds = int(mdl.item) + int(mdl2.item)
dict = {"adds_temp" : adds}
return render(request, "home.html", context=dict)

___
templates/home.html


  Addition: {{adds_temp}}



On Tuesday, May 5, 2020, fahad rasool  wrote:

> Can someone tell that how to perform an operation ,for example we retreive
> two numbers from database and want to add them and display on template in
> 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 view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CACqgSmCzazz4W5AuwKOzgvyjSDAMb
> XwgD-B%3DkM%2BtG3T0t2Mb%3DQ%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/CALcUgYyh9G157%2BZb8XaM2nNc9fdUfHwejGTLJAB4XwpjQStNZQ%40mail.gmail.com.


Re: Best hosting for Django Application?

2020-05-06 Thread Nomeh Uchenna Gabriel
please don't ever use "python-anywhere" for a serious project unless you have 
enough tears 😭 in your eye balls to cry out when the time comes.

... I suggest "digitalocean/linode" so that the heavy problems of "SSL 
certificates" won't beat you up

-- 
You received this message because you are subscribed 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/ee7b3e5b-20f8-4f70-aca2-3fc689a30a37%40googlegroups.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-06 Thread Nomeh Uchenna Gabriel
That's great to hear! 

-- 
You received this message because you are subscribed 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/56235ef4-df14-4857-9c73-53a48f27acfe%40googlegroups.com.


How to create variables for an e-commerce website

2020-05-06 Thread Ahmed Khairy
Hi am looking for resources to create variables such as size and color to 
an e-commerce website 

-- 
You received this message because you are subscribed 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/e6ce14b0-c0ff-46fa-8903-635ed60c4459%40googlegroups.com.


Create a function which fill automatically a field in my models

2020-05-06 Thread Anselme SERI


Hi,

I use Django 3.0 and I would like to create a function which fill 
automatically a field in my models.
Can I do it directly in models.py ? How?

Thanks a lot

-- 
You received this message because you are subscribed 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/5f810453-c7ca-4c10-bca1-4cfe11ea496a%40googlegroups.com.


Re: I am building an open source School Management System

2020-05-06 Thread Sherif Adigun
Thanks. Checked. Good job. I think I've got more features than you.

Latest commits now have authentications

On Tuesday, May 5, 2020 at 9:37:26 PM UTC+1, Sherif Adigun wrote:
>
> I am currently building an open source school Management System on django 
> and it's currently available on GitHub.
>
> https://github.com/adigunsherif/Django-School-Management-System
>
> I need contributors and collaboration.
>
> Feel free to fork me on GitHub, send a message and let's build a 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/06798eec-0e61-4149-9315-9d95cf7aec65%40googlegroups.com.


Re: How to make Custom User Registration and Login

2020-05-06 Thread Kushal Neupane
For you following web pages or video will help you.
https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
https://www.youtube.com/watch?v=oZUb372g6Do
https://docs.djangoproject.com/en/3.0/topics/auth/customizing/
https://testdriven.io/blog/django-custom-user-model/
https://www.codingforentrepreneurs.com/blog/how-to-create-a-custom-django-user-model

On Wed, May 6, 2020 at 8:57 PM Camilo Garcia 
wrote:

> This might come in handy
> https://learndjango.com/tutorials/django-custom-user-model
>
> On Wednesday, May 6, 2020 at 5:09:29 AM UTC-5, Anubhav Madhav wrote:
>>
>> I am new to Django. I need to make a custom sign up and log in page.
>> Because, during Sign Up, I also want to get User's Address and Contact
>> Number. In Django's 'User' module, it isn't supported. So, how can I make a
>> custom sign up and sign in page. Please 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/408862b0-3958-4484-a989-9ede6aa57a59%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/CAFWyajXo4m4%2BXUA-HrtEuXD4q0vBKjro1jSsee6jROb_JofD1g%40mail.gmail.com.


Re: How to make Custom User Registration and Login

2020-05-06 Thread Camilo Garcia
This might come in 
handy https://learndjango.com/tutorials/django-custom-user-model

On Wednesday, May 6, 2020 at 5:09:29 AM UTC-5, Anubhav Madhav wrote:
>
> I am new to Django. I need to make a custom sign up and log in page. 
> Because, during Sign Up, I also want to get User's Address and Contact 
> Number. In Django's 'User' module, it isn't supported. So, how can I make a 
> custom sign up and sign in page. Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/408862b0-3958-4484-a989-9ede6aa57a59%40googlegroups.com.


Re: Django Media Static Files

2020-05-06 Thread Jorge Gimeno
On Wed, May 6, 2020 at 3:09 AM ilda.pedro1993 
wrote:

> Hello, everyone!
> My name is Ilda, i'm getting a page not found when trying to load django
> media files.
>
> My django settings file looks like below:
>
> [image: Captura de Tela (148).png]
>
>
>
>
>
>
>
> And saw many suggestions to concatenate my app urls with the static one
> like:
>
> urlpatterns +=static(setting.MEDIA_URL, document_root=MEDIA_ROOT)
>
> But after storing the media files when i try to load a get always a not
> found page.
>
> Im using Django 3.0.2
>
> Can anybody help me out there?
>
> --
> You received this message because you are subscribed 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/c08b99df-9423-46b6-8edf-34f01f550bc7%40googlegroups.com
> 
> .
>

Are you getting a 404 in production, or while using the development server
(manage.py runserver)?

-Jorge

-- 
You received this message because you are subscribed 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/CANfN%3DK8F%2BR1JmugS1jj9wzQ6C%2BkdjfcL6OL75sU_6pzz-2cesQ%40mail.gmail.com.


Re: I am building an open source School Management System

2020-05-06 Thread Milson Munakami
Thanks, now it is loading as desired. Try my repo also:
https://github.com/Milstein/Student_Management_System may be this is a bit
more functional what you are looking for.

On Wed, May 6, 2020 at 4:39 AM Sherif Adigun  wrote:

> Now updated. Please confirm it's working fine now.
>
> --
> You received this message because you are subscribed 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/CACP0aXgVGM2%3DpDgzeuFNVFB-LwOcpq7aDf%3Dr2J5Xir2J2qmUyA%40mail.gmail.com
> 
> .
>


-- 
Thank you,

Milson Munakami

Mobile: 208.220.2943  <208.220.2943>

-- 
You received this message because you are subscribed 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/CAP1qhGsCjEry4QDm5HCmOORtp4-ganj%2Bzht4Z9jCRcBLH1D-SQ%40mail.gmail.com.


Re: register_converter

2020-05-06 Thread Andréas Kühne
Great - thanks also for posting the answer here as well!

Regards.

Andréas


‪Den ons 6 maj 2020 kl 14:37 skrev ‫אורי‬‎ :‬

> Hi,
>
> I checked and if I define a converter with a name of a default converter,
> such as "slug" - it overrides the default converter. The line that causes
> this is the line return {**DEFAULT_CONVERTERS, **REGISTERED_CONVERTERS}
>  in get_converters() in Django.
>
> אורי
> u...@speedy.net
>
>
> On Wed, May 6, 2020 at 3:04 PM Andréas Kühne 
> wrote:
>
>> Hi,
>>
>> You register your converter in the main urls.py file (which is usually in
>> the main project name, alongside settings.py). That's all you need to do.
>>
>> I don't know about the slug converter though - I would just reregister it
>> and see what happens :)
>>
>> Regards,
>>
>> Andréas
>>
>>
>> ‪Den ons 6 maj 2020 kl 11:23 skrev ‫אורי‬‎ :‬
>>
>>> Hi,
>>>
>>> Do I have to use register_converter in any file using it? I have a
>>> project with many urls.py files, and I want to register converters which
>>> will be used in multiple files. How do I register them? Do I have to
>>> register them in all the urls.py files? And where in my project should I
>>> put the converters definitions?
>>>
>>> Also, can I register a converter with the name "slug"? (which is also
>>> defined by Django). I want to define "slug" as any string containing
>>> letters a-z, A-Z, digits 0-9, "-", ".", or "_" (the 2 latest
>>> characters will be redirected to "-"). for example the paths
>>> "/uri_rodberg/" and "/uri.rodberg/" will be redirected to "/uri-rodberg/".
>>> And not to use the Django-defined "slug".
>>>
>>> I also want to define "digits" as any sequence of digits 0-9, but it's a
>>> string - not an integer. For example an ID of a user or entity. It can
>>> start with any numbers of leading zeros.
>>> אורי
>>> u...@speedy.net
>>>
>>> --
>>> You received this message because you are subscribed 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/CABD5YeHRp7rvqrBirbSObVFOsxwfDX%2BDnKoxraoq5Wyc4Fu84g%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/CAK4qSCcprGp2LH6ox3Qu4s8svfriWq-3d9hLH8-bqqKsRYpbRQ%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/CABD5YeHi07etdpqAevrpRAtZ_Mm%3DqgfXmH5OfbUtA1xXNXdd8Q%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/CAK4qSCdozH-aWFPyFwnR6y-3PURs08gRK27Qm0mp-RXijPfmZQ%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sherif Adigun
You are welcome.

I'm happy to 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACP0aXgBC%2BdYEST_PDyYkKACthoG%3D5uycoMuNS6Ry%2BRW8jhffQ%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sergei Sokov
Thank you very much!!
You are best!!!

среда, 6 мая 2020 г., 15:09:39 UTC+2 пользователь Sherif Adigun написал:
>
> https://us04web.zoom.us/j/79500561313?pwd=TnIzekVTMU0xRDNsaGpaS0kxQlhTdz09
>
>
> JOIN NOW
>

-- 
You received this message because you are subscribed 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/60cfdac9-6060-4605-8a89-3477791b27e3%40googlegroups.com.


Re: How to fork LocaleMiddleware? I need to make a small change.

2020-05-06 Thread Aldian Fazrihady
You can just extend LocaleMiddleware like this:
```
class MyLocaleMiddleware(LocaleMiddleware):

def process_request(self, request):
super().process_request(request)
# TODO: add my custom code
```
Save it to a python file, such as `middleware.py`

On the django settings file, replace the LocaleMiddleware with yours:
```
MIDDLEWARE = [
'..MyLocaleMiddleware',
]
```

On Wed, May 6, 2020 at 7:42 PM Oleg Barbos  wrote:

> When LocaleMiddleware sees the request coming in, it tries to parse the
> language from the request. See
> https://github.com/django/django/blob/92507bf3ea4dc467f68edf81a686548fac7ff0e9/django/utils/translation/trans_real.py#L46
>  for
> the regular expression used. The allowed format is: any sequence of word
> characters, and optionally a dash and more word characters, after that it
> expects either the end of the string, or a /. In my case, it matches
> id-button/, and understands that id-button is the language prefix for
> that request, causing Django to activate the id language.
>
> I need to change this behaviour, so it would check if second part like 
> "button"
> is in a whitelist of languages from SETTINGS.
> so the languages "id", "de", "zh-Hans" should work properly, but when
> slug is "id-button/" - it should get English language.
>
> --
> You received this message because you are subscribed 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/75b39a9f-05b6-430c-bf78-3b6e6cc0a641%40googlegroups.com
> 
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAZGU_Bk9xYZ0imxoz5tu6WrXu9i%3DRvNwtd%3DFgJymnJWSw%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sherif Adigun
https://us04web.zoom.us/j/79500561313?pwd=TnIzekVTMU0xRDNsaGpaS0kxQlhTdz09


JOIN NOW

-- 
You received this message because you are subscribed 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/CACP0aXj_%2BXL-X7kDSY_MzQfSp4eEouQj_wu0VgSTNkNo0v%3DEKg%40mail.gmail.com.


Re: How to customize the authentication system?

2020-05-06 Thread Jorge Gimeno
On Wed, May 6, 2020, 3:08 AM Camilo Garcia 
wrote:

> I want to use the authentication system that django comes with, but the
> default model doesn't work for me, so I have to implement my own user
> model, the truth is that I don't know how I could do it without losing the
> power that this system offers me.
>
> Any step-by-step guide you recommend? I'm a newbie, so far I'm learning
> how to use the framework.
>
> I thank you in advance and hope you can help me.
>
> --
> You received this message because you are subscribed 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/f40de223-b53c-4a14-89dd-ec8bd65b2880%40googlegroups.com
> 
> .
>

There's a tutorial here:
https://wsvincent.com/django-custom-user-model-tutorial/

-Jorge

>

-- 
You received this message because you are subscribed 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/CANfN%3DK_2Rtc4oacPRbHoSHzsSwhOVfdSt6gXPX-y5MqjRZCmLA%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sergei Sokov
I am ready

среда, 6 мая 2020 г., 12:35:28 UTC+2 пользователь Sherif Adigun написал:
>
> ok. send a reply when you are available.
>
> On Wed, May 6, 2020 at 11:13 AM Sergei Sokov  > wrote:
>
>> I can a little bit later, ok?
>> I think in 2 hour
>>
>> среда, 6 мая 2020 г., 12:00:13 UTC+2 пользователь Sherif Adigun написал:
>>>
>>> Please join the meeting now let's quickly fix it .
>>>
>>>
>>> https://us04web.zoom.us/j/77729655336?pwd=c1o2Q0JQOFJiYm5hTlJTYjgra0dOQT09
>>>
>>> On Monday, May 4, 2020 at 4:37:39 PM UTC+1, Sergei Sokov wrote:

 I have two forms in one template, but one of them doesn't  have data to 
 my database.
 Why does it happen and how to fix it?

 When I fill out the Pack form and press "submit" the terminal shows 
 that: "POST" /sklad HTTP/1.1" 200 9937
 This data doesn't save to my database.

 When I fill out the Sklad form and press "submit" the terminal shows 
 that: "POST" /sklad HTTP/1.1" 302 0
 This data saves to my database fine.

 views.py
 class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
 CreateView):
 model = Sklad
 template_name = 'sklad.html'
 form_class = SkladForm
 success_url = reverse_lazy('sklad')
 success_msg = 'Материал сохранён'
 def get_context_data(self, **kwargs):
 kwargs['sklad_form'] = SkladForm
 kwargs['pack_form'] = PackForm
 kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
 kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
 return super().get_context_data(**kwargs) 
 def form_valid(self, form):
 self.object = form.save(commit=False)
 self.object.author = self.request.user
 self.object.save()
 return super().form_valid(form)

 models.py
 class Sklad(models.Model):
 author = models.ForeignKey(User, on_delete = models.CASCADE, 
 verbose_name='автор склада', null=True)
 material = models.CharField('название', max_length=200)
 unit = models.CharField('единица измерения', max_length=200)
 description = models.CharField('описание', max_length=200, null=True)
 price_buy = models.IntegerField('цена закупки', )
 price_sell = models.IntegerField('цена продажи', )
 amount = models.IntegerField('количество', default='0')

 def __str__(self):
 return self.material

 class Pack(models.Model):
 author = models.ForeignKey(User, on_delete = models.CASCADE, 
 verbose_name='автор упаковки', null=True)
 name_pack = models.CharField('название', max_length=100)
 price_pack = models.IntegerField('цена', )

 def __str__(self):
 return self.name_pack


 forms.py
 class SkladForm(forms.ModelForm):
 class Meta:
 model = Sklad
 fields = (
 'material',
 'unit',
 'description',
 'price_buy',
 'price_sell',
 'amount',
 )

 def __init__(self, *args, **kwargs):
 super().__init__(*args, **kwargs)
 for field in self.fields:
 self.fields[field].widget.attrs['class'] = 'form-control'

 class PackForm(forms.ModelForm):
 class Meta:
 model = Pack
 fields = (
 'name_pack',
 'price_pack',
 )

 def __init__(self, *args, **kwargs):
 super().__init__(*args, **kwargs)
 for field in self.fields:
 self.fields[field].widget.attrs['class'] = 'form-control'


 -- 
>> 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/I_32m8lWd-g/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/257e308b-91d3-4fa3-8f8f-ca758b72e7e0%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/1ec08501-5c34-4f1b-b5e2-10e03362e835%40googlegroups.com.


How to fork LocaleMiddleware? I need to make a small change.

2020-05-06 Thread Oleg Barbos
When LocaleMiddleware sees the request coming in, it tries to parse the 
language from the request. See 
https://github.com/django/django/blob/92507bf3ea4dc467f68edf81a686548fac7ff0e9/django/utils/translation/trans_real.py#L46
 for 
the regular expression used. The allowed format is: any sequence of word 
characters, and optionally a dash and more word characters, after that it 
expects either the end of the string, or a /. In my case, it matches 
id-button/, and understands that id-button is the language prefix for that 
request, causing Django to activate the id language.

I need to change this behaviour, so it would check if second part like "button" 
is in a whitelist of languages from SETTINGS.
so the languages "id", "de", "zh-Hans" should work properly, but when slug 
is "id-button/" - it should get English language.

-- 
You received this message because you are subscribed 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/75b39a9f-05b6-430c-bf78-3b6e6cc0a641%40googlegroups.com.


Re: How to glue Django and React together?

2020-05-06 Thread Aldian Fazrihady
Hi,

I am using that stack for my website aldianfazrihady.com.
It uses these modules:
https://pypi.org/project/django-webpack-loader/
https://www.npmjs.com/package/react-router-dom

On web browser, open my website, and use developer tools or view source to
see how it interacts with django backend.
I am using django only as API gateway using DRF and only to load simple
page that points to JS that will initialize React.
UI rendering is done on web browser side.

On Wed, May 6, 2020 at 6:39 PM Abhiram P  wrote:

> I want to use react as front end and Django as back end. And the URL
> routing must be done by Django. How to do this
>
> --
> You received this message because you are subscribed 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/0f786aad-14cc-4c45-99a8-8b2b7cf4c1f7%40googlegroups.com
> 
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAYictmzfjR81jEmJd%2BVJfezcLp_oyaEuKdNthapveapXQ%40mail.gmail.com.


Re: register_converter

2020-05-06 Thread אורי
Hi,

I checked and if I define a converter with a name of a default converter,
such as "slug" - it overrides the default converter. The line that causes
this is the line return {**DEFAULT_CONVERTERS, **REGISTERED_CONVERTERS} in
get_converters() in Django.

אורי
u...@speedy.net


On Wed, May 6, 2020 at 3:04 PM Andréas Kühne 
wrote:

> Hi,
>
> You register your converter in the main urls.py file (which is usually in
> the main project name, alongside settings.py). That's all you need to do.
>
> I don't know about the slug converter though - I would just reregister it
> and see what happens :)
>
> Regards,
>
> Andréas
>
>
> ‪Den ons 6 maj 2020 kl 11:23 skrev ‫אורי‬‎ :‬
>
>> Hi,
>>
>> Do I have to use register_converter in any file using it? I have a
>> project with many urls.py files, and I want to register converters which
>> will be used in multiple files. How do I register them? Do I have to
>> register them in all the urls.py files? And where in my project should I
>> put the converters definitions?
>>
>> Also, can I register a converter with the name "slug"? (which is also
>> defined by Django). I want to define "slug" as any string containing
>> letters a-z, A-Z, digits 0-9, "-", ".", or "_" (the 2 latest
>> characters will be redirected to "-"). for example the paths
>> "/uri_rodberg/" and "/uri.rodberg/" will be redirected to "/uri-rodberg/".
>> And not to use the Django-defined "slug".
>>
>> I also want to define "digits" as any sequence of digits 0-9, but it's a
>> string - not an integer. For example an ID of a user or entity. It can
>> start with any numbers of leading zeros.
>> אורי
>> u...@speedy.net
>>
>> --
>> You received this message because you are subscribed 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/CABD5YeHRp7rvqrBirbSObVFOsxwfDX%2BDnKoxraoq5Wyc4Fu84g%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/CAK4qSCcprGp2LH6ox3Qu4s8svfriWq-3d9hLH8-bqqKsRYpbRQ%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/CABD5YeHi07etdpqAevrpRAtZ_Mm%3DqgfXmH5OfbUtA1xXNXdd8Q%40mail.gmail.com.


Re: register_converter

2020-05-06 Thread Andréas Kühne
Hi,

You register your converter in the main urls.py file (which is usually in
the main project name, alongside settings.py). That's all you need to do.

I don't know about the slug converter though - I would just reregister it
and see what happens :)

Regards,

Andréas


‪Den ons 6 maj 2020 kl 11:23 skrev ‫אורי‬‎ :‬

> Hi,
>
> Do I have to use register_converter in any file using it? I have a project
> with many urls.py files, and I want to register converters which will be
> used in multiple files. How do I register them? Do I have to register them
> in all the urls.py files? And where in my project should I put the
> converters definitions?
>
> Also, can I register a converter with the name "slug"? (which is also
> defined by Django). I want to define "slug" as any string containing
> letters a-z, A-Z, digits 0-9, "-", ".", or "_" (the 2 latest
> characters will be redirected to "-"). for example the paths
> "/uri_rodberg/" and "/uri.rodberg/" will be redirected to "/uri-rodberg/".
> And not to use the Django-defined "slug".
>
> I also want to define "digits" as any sequence of digits 0-9, but it's a
> string - not an integer. For example an ID of a user or entity. It can
> start with any numbers of leading zeros.
> אורי
> u...@speedy.net
>
> --
> You received this message because you are subscribed 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/CABD5YeHRp7rvqrBirbSObVFOsxwfDX%2BDnKoxraoq5Wyc4Fu84g%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/CAK4qSCcprGp2LH6ox3Qu4s8svfriWq-3d9hLH8-bqqKsRYpbRQ%40mail.gmail.com.


How to glue Django and React together?

2020-05-06 Thread Desmond Nyamador
Hi, what you're trying to do is called server side rendering.  Django does this 
out of the box with it's templating language , however since you want to use an 
SPA (React) I suggest you look into Nextjs. It's built like this out of the 
box.  

-- 
You received this message because you are subscribed 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/bb640851-d9e3-4848-8541-69e3d7a84370%40googlegroups.com.


How to glue Django and React together?

2020-05-06 Thread Abhiram P
I want to use react as front end and Django as back end. And the URL 
routing must be done by Django. How to do this

-- 
You received this message because you are subscribed 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/0f786aad-14cc-4c45-99a8-8b2b7cf4c1f7%40googlegroups.com.


Re:

2020-05-06 Thread Adedotun Richard
Can i see your views.py.
you can create a *decorator.py* that will help you handle that

something like: you create a decorator.py file
then do the following:
from django.http import HttpResponse
from django.shortcuts import redirect

def unauthenticated_user(view_func):
def wrapper_func(request, *args, **kwargs):
if request.user.is_authenticated:
return redirect('home') #this can be whatever name you call
your homepage or the page you want to redirect to
else:
return view_func(request, *args, **kwargs)

return wrapper_func


then you go to your views and import the decorator.py

from django.contrib.auth import authenticate,
from django.shortcuts import render, redirect
from .decorators import unauthenticated_user,

then at the beginning of your userinfo view function you do this:

def userinfo(request):
if request.user.is_authenticated:
return redirect('home')

else:
#then you recall the function that call the inserinfo form.

I hope this will be able to help you resolve the issue.

Kind regards.

Adedotun Richard



On Wed, May 6, 2020 at 9:41 AM fahad rasool 
wrote:

> I want to ask that i am working on django platform on a project ,which is
> basically an system that generates a diet plan for user..
>
> The flow is that a user has to register and sign up after registration, a
> form (userinfo form )is to be filled by user,on basis of which diet plan is
> generated.
>
> Now my question is when the same user login second time ,i did not want
> userinfo form to be displayed again and and again,r ather i want user to
> redirect to userprofile page..
>
> Please help i have stuck here for about 3 days..
>
> --
> You received this message because you are subscribed 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/CACqgSmCE4gxFtUSaXYRCTfuni3iS65TNrOOGQpz8CueD38u2pQ%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/CA%2BndhOPXw5RBX5EvnqNfb0b8Et0m8RUzTm2GnHd9bX%2BYTkC_cA%40mail.gmail.com.


I can't catch a URL in Django

2020-05-06 Thread אורי
Hi,

I'm trying to convert my website from using re_path to path. I have a URL
https://en.speedy.net/about/  , and if the user types any URL which starts
with /about/, such as https://en.speedy.net/about/1/ - he is redirected to
https://en.speedy.net/about/ .

In urls.py I have:

re_path(route=r'^about/', view=include('speedy.core.about.urls', namespace=
'about')),

And in about/urls.py:
re_path(route=r'', view=views.AboutView.as_view(), name='about'),

The view handles the redirect if necessary.

Now, I changed urls.py to:

path(route='about/', view=include('speedy.core.about.urls', namespace='about')),

And about/urls.py to:

path(route='', view=views.AboutView.as_view(), name='about'),

But, if the user enters /about/1/, he is redirected to /about/, but then I
receive error 404. What is the problem and how should I define it? I prefer
not to have to use  but catch any url which starts with /about/ .

Thanks,
Uri.
אורי
u...@speedy.net

-- 
You received this message because you are subscribed 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/CABD5YeETsfwLTtQ4%2BGzJrzJ4gbVvfUwBFD7wFPTB9dbikw%3DaNw%40mail.gmail.com.


Re: Drop down dependent on two other form fields

2020-05-06 Thread Sherif Adigun
Check this

https://simpleisbetterthancomplex.com/tutorial/2018/01/29/how-to-implement-dependent-or-chained-dropdown-list-with-django.html

-- 
You received this message because you are subscribed 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/6c583d01-2b5b-4649-abec-e20e29850237%40googlegroups.com.


Re: Two forms in one template

2020-05-06 Thread Sherif Adigun
ok. send a reply when you are available.

On Wed, May 6, 2020 at 11:13 AM Sergei Sokov  wrote:

> I can a little bit later, ok?
> I think in 2 hour
>
> среда, 6 мая 2020 г., 12:00:13 UTC+2 пользователь Sherif Adigun написал:
>>
>> Please join the meeting now let's quickly fix it .
>>
>> https://us04web.zoom.us/j/77729655336?pwd=c1o2Q0JQOFJiYm5hTlJTYjgra0dOQT09
>>
>> On Monday, May 4, 2020 at 4:37:39 PM UTC+1, Sergei Sokov wrote:
>>>
>>> I have two forms in one template, but one of them doesn't  have data to
>>> my database.
>>> Why does it happen and how to fix it?
>>>
>>> When I fill out the Pack form and press "submit" the terminal shows
>>> that: "POST" /sklad HTTP/1.1" 200 9937
>>> This data doesn't save to my database.
>>>
>>> When I fill out the Sklad form and press "submit" the terminal shows
>>> that: "POST" /sklad HTTP/1.1" 302 0
>>> This data saves to my database fine.
>>>
>>> views.py
>>> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin,
>>> CreateView):
>>> model = Sklad
>>> template_name = 'sklad.html'
>>> form_class = SkladForm
>>> success_url = reverse_lazy('sklad')
>>> success_msg = 'Материал сохранён'
>>> def get_context_data(self, **kwargs):
>>> kwargs['sklad_form'] = SkladForm
>>> kwargs['pack_form'] = PackForm
>>> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
>>> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
>>> return super().get_context_data(**kwargs)
>>> def form_valid(self, form):
>>> self.object = form.save(commit=False)
>>> self.object.author = self.request.user
>>> self.object.save()
>>> return super().form_valid(form)
>>>
>>> models.py
>>> class Sklad(models.Model):
>>> author = models.ForeignKey(User, on_delete = models.CASCADE,
>>> verbose_name='автор склада', null=True)
>>> material = models.CharField('название', max_length=200)
>>> unit = models.CharField('единица измерения', max_length=200)
>>> description = models.CharField('описание', max_length=200, null=True)
>>> price_buy = models.IntegerField('цена закупки', )
>>> price_sell = models.IntegerField('цена продажи', )
>>> amount = models.IntegerField('количество', default='0')
>>>
>>> def __str__(self):
>>> return self.material
>>>
>>> class Pack(models.Model):
>>> author = models.ForeignKey(User, on_delete = models.CASCADE,
>>> verbose_name='автор упаковки', null=True)
>>> name_pack = models.CharField('название', max_length=100)
>>> price_pack = models.IntegerField('цена', )
>>>
>>> def __str__(self):
>>> return self.name_pack
>>>
>>>
>>> forms.py
>>> class SkladForm(forms.ModelForm):
>>> class Meta:
>>> model = Sklad
>>> fields = (
>>> 'material',
>>> 'unit',
>>> 'description',
>>> 'price_buy',
>>> 'price_sell',
>>> 'amount',
>>> )
>>>
>>> def __init__(self, *args, **kwargs):
>>> super().__init__(*args, **kwargs)
>>> for field in self.fields:
>>> self.fields[field].widget.attrs['class'] = 'form-control'
>>>
>>> class PackForm(forms.ModelForm):
>>> class Meta:
>>> model = Pack
>>> fields = (
>>> 'name_pack',
>>> 'price_pack',
>>> )
>>>
>>> def __init__(self, *args, **kwargs):
>>> super().__init__(*args, **kwargs)
>>> for field in self.fields:
>>> self.fields[field].widget.attrs['class'] = 'form-control'
>>>
>>>
>>> --
> 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/I_32m8lWd-g/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/257e308b-91d3-4fa3-8f8f-ca758b72e7e0%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/CACP0aXjvLuR6PAatcY5rmkPs8gzHk5LhrQ%3DnUE174LQU4aP5qg%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sergei Sokov
I can a little bit later, ok?
I think in 2 hour

среда, 6 мая 2020 г., 12:00:13 UTC+2 пользователь Sherif Adigun написал:
>
> Please join the meeting now let's quickly fix it .
>
> https://us04web.zoom.us/j/77729655336?pwd=c1o2Q0JQOFJiYm5hTlJTYjgra0dOQT09
>
> On Monday, May 4, 2020 at 4:37:39 PM UTC+1, Sergei Sokov wrote:
>>
>> I have two forms in one template, but one of them doesn't  have data to 
>> my database.
>> Why does it happen and how to fix it?
>>
>> When I fill out the Pack form and press "submit" the terminal shows that: 
>> "POST" /sklad HTTP/1.1" 200 9937
>> This data doesn't save to my database.
>>
>> When I fill out the Sklad form and press "submit" the terminal shows 
>> that: "POST" /sklad HTTP/1.1" 302 0
>> This data saves to my database fine.
>>
>> views.py
>> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
>> CreateView):
>> model = Sklad
>> template_name = 'sklad.html'
>> form_class = SkladForm
>> success_url = reverse_lazy('sklad')
>> success_msg = 'Материал сохранён'
>> def get_context_data(self, **kwargs):
>> kwargs['sklad_form'] = SkladForm
>> kwargs['pack_form'] = PackForm
>> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
>> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
>> return super().get_context_data(**kwargs) 
>> def form_valid(self, form):
>> self.object = form.save(commit=False)
>> self.object.author = self.request.user
>> self.object.save()
>> return super().form_valid(form)
>>
>> models.py
>> class Sklad(models.Model):
>> author = models.ForeignKey(User, on_delete = models.CASCADE, 
>> verbose_name='автор склада', null=True)
>> material = models.CharField('название', max_length=200)
>> unit = models.CharField('единица измерения', max_length=200)
>> description = models.CharField('описание', max_length=200, null=True)
>> price_buy = models.IntegerField('цена закупки', )
>> price_sell = models.IntegerField('цена продажи', )
>> amount = models.IntegerField('количество', default='0')
>>
>> def __str__(self):
>> return self.material
>>
>> class Pack(models.Model):
>> author = models.ForeignKey(User, on_delete = models.CASCADE, 
>> verbose_name='автор упаковки', null=True)
>> name_pack = models.CharField('название', max_length=100)
>> price_pack = models.IntegerField('цена', )
>>
>> def __str__(self):
>> return self.name_pack
>>
>>
>> forms.py
>> class SkladForm(forms.ModelForm):
>> class Meta:
>> model = Sklad
>> fields = (
>> 'material',
>> 'unit',
>> 'description',
>> 'price_buy',
>> 'price_sell',
>> 'amount',
>> )
>>
>> def __init__(self, *args, **kwargs):
>> super().__init__(*args, **kwargs)
>> for field in self.fields:
>> self.fields[field].widget.attrs['class'] = 'form-control'
>>
>> class PackForm(forms.ModelForm):
>> class Meta:
>> model = Pack
>> fields = (
>> 'name_pack',
>> 'price_pack',
>> )
>>
>> def __init__(self, *args, **kwargs):
>> super().__init__(*args, **kwargs)
>> for field in self.fields:
>> self.fields[field].widget.attrs['class'] = 'form-control'
>>
>>
>>

-- 
You received this message because you are subscribed 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/257e308b-91d3-4fa3-8f8f-ca758b72e7e0%40googlegroups.com.


Re:

2020-05-06 Thread Ilda Pedro
hello fahad rasool.

just try this.
from django.shortcuts import redirect

return redirect('userprofile)

On Wed, May 6, 2020 at 9:41 AM fahad rasool 
wrote:

> I want to ask that i am working on django platform on a project ,which is
> basically an system that generates a diet plan for user..
>
> The flow is that a user has to register and sign up after registration, a
> form (userinfo form )is to be filled by user,on basis of which diet plan is
> generated.
>
> Now my question is when the same user login second time ,i did not want
> userinfo form to be displayed again and and again,r ather i want user to
> redirect to userprofile page..
>
> Please help i have stuck here for about 3 days..
>
> --
> You received this message because you are subscribed 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/CACqgSmCE4gxFtUSaXYRCTfuni3iS65TNrOOGQpz8CueD38u2pQ%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/CAL%3DqnfUqibNNTQpd%2B7K5uPTf2WcptkFNOO6%2BsSLUS7cUe7895g%40mail.gmail.com.


Re: Drop down dependent on two other form fields

2020-05-06 Thread shefali chudasama
Did you gor the solution.. i want to do the same.. from database


On Tuesday, January 5, 2016 at 1:07:54 AM UTC-5, Arindam sarkar wrote:
>
> Hello,
> In my project I have a from in which there is three drop down. The 3rd 
> drop down is depended on the selected values of the above two drop downs . 
> How can I go for the implementation of it . Please show me a way.
>
> -- 
> Regards,
>
> Arindam
>
> Contact no. 08732822385
>
>
>

-- 
You received this message because you are subscribed 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/832fa52d-0c2f-4f2a-8371-b0ba2556f9c5%40googlegroups.com.


How to make Custom User Registration and Login

2020-05-06 Thread Anubhav Madhav
I am new to Django. I need to make a custom sign up and log in page. Because, 
during Sign Up, I also want to get User's Address and Contact Number. In 
Django's 'User' module, it isn't supported. So, how can I make a custom sign up 
and sign in page. Please 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aabe32ed-51b5-4e71-9d43-26421c957529%40googlegroups.com.


Django Media Static Files

2020-05-06 Thread ilda.pedro1993
Hello, everyone!
My name is Ilda, i'm getting a page not found when trying to load django 
media files. 

My django settings file looks like below:

[image: Captura de Tela (148).png] 







And saw many suggestions to concatenate my app urls with the static one 
like:

urlpatterns +=static(setting.MEDIA_URL, document_root=MEDIA_ROOT)

But after storing the media files when i try to load a get always a not 
found page.

Im using Django 3.0.2

Can anybody help me out there?

-- 
You received this message because you are subscribed 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/c08b99df-9423-46b6-8edf-34f01f550bc7%40googlegroups.com.


How can I custom Django Admin workflow

2020-05-06 Thread Kuncheng Li
I am using Django Admin for some authentication reasons.
I have a model with FileField and I need the following steps:
1-upload a excel file.
2-read the excel file and display its header.
3-user choose some of the header and record to the database.

How can I finish the job in Django 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2a18b698-5612-43f7-834d-2791d9d3aa7d%40googlegroups.com.


How to customize the authentication system?

2020-05-06 Thread Camilo Garcia
I want to use the authentication system that django comes with, but the 
default model doesn't work for me, so I have to implement my own user 
model, the truth is that I don't know how I could do it without losing the 
power that this system offers me.

Any step-by-step guide you recommend? I'm a newbie, so far I'm learning how 
to use the framework.

I thank you in advance and hope you can help me.

-- 
You received this message because you are subscribed 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/f40de223-b53c-4a14-89dd-ec8bd65b2880%40googlegroups.com.


Re: reg: User model data missing from web page

2020-05-06 Thread Chetan Ganji
Ok.

Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Wed, May 6, 2020 at 11:42 AM 'Amitesh Sahay' via Django users <
django-users@googlegroups.com> wrote:

> Hello Chetan,
>
> I got the issue resolved. Below are the correct views:
>
> def userprofileview(request):  # Authenticated user filling the form to 
> complete the registration
> if request.method == 'POST':
> form = UserProfileForm(request.POST, request.FILES)
> if form.is_valid():
> pr = UserProfile()
> pr.user = User.objects.get(id=request.user.id)
> pr.dob = form.cleaned_data['dob']
> pr.country = form.cleaned_data['country']
> pr.State = form.cleaned_data['State']
> pr.District = form.cleaned_data['District']
> pr.phone = form.cleaned_data['phone']
> pr.save()
> messages.success(request, f'Profile has been updated 
> successfully')
> return redirect('/profile')
> else:
> messages.error(request, AssertionError)
> else:
> form = UserProfileForm()
> return render(request, 'authenticate\\bolo.html', context={'form': form})
>
> @login_required
> def profile_page(request):  # Fetching data from DB to show user's complete 
> profile page
> data = get_object_or_404(UserProfile, user=request.user)
> #data2 = get_object_or_404(User, user=request.user)
> data2 = User.objects.get(id = request.user.id)
> context = {'data': data, 'data2': data2}
> return render(request, 'authenticate\\profile.html', locals())
>
>
>
> Regards,
> Amitesh
>
>
> On Wednesday, 6 May, 2020, 10:34:05 am IST, 'Amitesh Sahay' via Django
> users  wrote:
>
>
> Hello Chetan,
>
> Below is how I have created the forms.
>
> from django.contrib.auth.forms import UserCreationForm
> from django.contrib.auth.models import User
> from .models import UserProfile
> from django import forms
>
>
> class SignUpForm(UserCreationForm):
> email = forms.EmailField()
> first_name = forms.CharField(max_length=100)
> last_name = forms.CharField(max_length=100)
>
> class Meta:
> model = User
> fields = ('username', 'first_name', 'last_name', 'email', 
> 'password1', 'password2')
>
>
> class UserProfileForm(forms.ModelForm):
> Photo = forms.FileField( max_length=100)  
> #widget=forms.ClearableFileInput(attrs={'multiple': True}),
> dob = forms.DateField(widget=forms.TextInput(attrs={'type': 'date'}))
> country = forms.CharField(max_length=100)
> State = forms.CharField(max_length=100)
> District = forms.CharField(max_length=100)
> phone = forms.CharField(max_length=10)
>
> class Meta:
> model = UserProfile
> fields = ('Photo', 'dob', 'country', 'State', 'District', 'phone')
>
>
> I hope that helps. Please let me know. Just to let you know that there was
> a time during the development when I could only see the User model data on
> my page, but none from the UserProfile model. During the debug process I
> have made changes in both the files over the last couple of weeks, so now I
> have reached to the point where I can see only the UserProfile data.
>
> Just wanted to give you some insight.
>
> Regards,
> Amitesh
>
>
> On Wednesday, 6 May, 2020, 12:11:32 am IST, 'Amitesh Sahay' via Django
> users  wrote:
>
>
> Hi Chetan,
>
> The default user model already has those three fields, right? And since I
> have extended the  User as a onetoone field inside the UserProfile model,
> so shouldn't that work? I mean, that's my understanding. May be I am wrong.
> Let me know, just for the sake of clarity.
>
> Right now I don't have access to my system. I will send the code snippet
> of the forms.py, may be then you can give more inputs
>
> Thank you so much for your time though
>
> Amitesh
>
> Sent from Yahoo Mail on Android
> 
>
> On Tue, 5 May 2020 at 23:32, Chetan Ganji
>  wrote:
> Hi Amitesh,
>
> Assuming you are using model forms in django without any customisation,
> as UserProfile model does not have first_name, last_name and email field,
> reading the first_name from cleaned_data is failing.
>
> To solve it, you have to add 3 extra fields in the UserProfileForm
> i.e. first_name, last_name and email, and pop them before saving the form.
> also save these three fields on the user model.
>
> *request.user.first_name = form.cleaned_data.pop('first_name')*
> request.user.save()
>
> form.save()
>
> Cheers!
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
>
> On Tue, May 5, 2020 at 10:32 PM 'Amitesh Sahay' via Django users <
> django-users@googlegroups.com> wrote:
>
> Hello Chetan,
>
> I was doing some random test, so I put "User" there. It is not the part of
> the original code.
>
> Below is mod

Re: Two forms in one template

2020-05-06 Thread Sherif Adigun
Please join the meeting now let's quickly fix it .

https://us04web.zoom.us/j/77729655336?pwd=c1o2Q0JQOFJiYm5hTlJTYjgra0dOQT09

On Monday, May 4, 2020 at 4:37:39 PM UTC+1, Sergei Sokov wrote:
>
> I have two forms in one template, but one of them doesn't  have data to my 
> database.
> Why does it happen and how to fix it?
>
> When I fill out the Pack form and press "submit" the terminal shows that: 
> "POST" /sklad HTTP/1.1" 200 9937
> This data doesn't save to my database.
>
> When I fill out the Sklad form and press "submit" the terminal shows that: 
> "POST" /sklad HTTP/1.1" 302 0
> This data saves to my database fine.
>
> views.py
> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
> CreateView):
> model = Sklad
> template_name = 'sklad.html'
> form_class = SkladForm
> success_url = reverse_lazy('sklad')
> success_msg = 'Материал сохранён'
> def get_context_data(self, **kwargs):
> kwargs['sklad_form'] = SkladForm
> kwargs['pack_form'] = PackForm
> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
> return super().get_context_data(**kwargs) 
> def form_valid(self, form):
> self.object = form.save(commit=False)
> self.object.author = self.request.user
> self.object.save()
> return super().form_valid(form)
>
> models.py
> class Sklad(models.Model):
> author = models.ForeignKey(User, on_delete = models.CASCADE, 
> verbose_name='автор склада', null=True)
> material = models.CharField('название', max_length=200)
> unit = models.CharField('единица измерения', max_length=200)
> description = models.CharField('описание', max_length=200, null=True)
> price_buy = models.IntegerField('цена закупки', )
> price_sell = models.IntegerField('цена продажи', )
> amount = models.IntegerField('количество', default='0')
>
> def __str__(self):
> return self.material
>
> class Pack(models.Model):
> author = models.ForeignKey(User, on_delete = models.CASCADE, 
> verbose_name='автор упаковки', null=True)
> name_pack = models.CharField('название', max_length=100)
> price_pack = models.IntegerField('цена', )
>
> def __str__(self):
> return self.name_pack
>
>
> forms.py
> class SkladForm(forms.ModelForm):
> class Meta:
> model = Sklad
> fields = (
> 'material',
> 'unit',
> 'description',
> 'price_buy',
> 'price_sell',
> 'amount',
> )
>
> def __init__(self, *args, **kwargs):
> super().__init__(*args, **kwargs)
> for field in self.fields:
> self.fields[field].widget.attrs['class'] = 'form-control'
>
> class PackForm(forms.ModelForm):
> class Meta:
> model = Pack
> fields = (
> 'name_pack',
> 'price_pack',
> )
>
> def __init__(self, *args, **kwargs):
> super().__init__(*args, **kwargs)
> for field in self.fields:
> self.fields[field].widget.attrs['class'] = 'form-control'
>
>
>

-- 
You received this message because you are subscribed 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/dd44ad0a-7059-4226-9200-ebb24fcf6b1d%40googlegroups.com.


Re: I am building an open source School Management System

2020-05-06 Thread Sherif Adigun
Now updated. Please confirm it's working fine now.

-- 
You received this message because you are subscribed 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/CACP0aXgVGM2%3DpDgzeuFNVFB-LwOcpq7aDf%3Dr2J5Xir2J2qmUyA%40mail.gmail.com.


register_converter

2020-05-06 Thread אורי
Hi,

Do I have to use register_converter in any file using it? I have a project
with many urls.py files, and I want to register converters which will be
used in multiple files. How do I register them? Do I have to register them
in all the urls.py files? And where in my project should I put the
converters definitions?

Also, can I register a converter with the name "slug"? (which is also
defined by Django). I want to define "slug" as any string containing
letters a-z, A-Z, digits 0-9, "-", ".", or "_" (the 2 latest
characters will be redirected to "-"). for example the paths
"/uri_rodberg/" and "/uri.rodberg/" will be redirected to "/uri-rodberg/".
And not to use the Django-defined "slug".

I also want to define "digits" as any sequence of digits 0-9, but it's a
string - not an integer. For example an ID of a user or entity. It can
start with any numbers of leading zeros.
אורי
u...@speedy.net

-- 
You received this message because you are subscribed 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/CABD5YeHRp7rvqrBirbSObVFOsxwfDX%2BDnKoxraoq5Wyc4Fu84g%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-06 Thread Iain Stewart
That has worked!! Thank you so much!

And thank you to everyone who responded.

As a learner I am so grateful to get through to the next step with this.

Iain :)

On Wed, 6 May 2020 at 07:31, Nomeh Uchenna Gabriel 
wrote:

> delete the migrations again, then run this to reset the tracking:
>
> >>> py manage.py migrate --fake [app_Name] zero
>
> then redo the process I stated before.
> ... makemigrations [app_Name]
> ... migrate [app_Name]
>
> --
> You received this message because you are subscribed 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/06d0ec9b-9860-4a90-ba93-031217256161%40googlegroups.com
> .
>


-- 
Iain Stewart
2b Priestfield Road
EDINBURGH EH16 5HH SCOTLAND
iain.a.stew...@gmail.com

telephone: 0044 131 662 9123
mobile: 0044 7728 752824

-- 
You received this message because you are subscribed 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/CAAAU1KT5tWXeLVA%2BELVG%2B9O63oXW46ck7yzpd3W8q3MbFzNGTw%40mail.gmail.com.


[no subject]

2020-05-06 Thread fahad rasool
I want to ask that i am working on django platform on a project ,which is
basically an system that generates a diet plan for user..

The flow is that a user has to register and sign up after registration, a
form (userinfo form )is to be filled by user,on basis of which diet plan is
generated.

Now my question is when the same user login second time ,i did not want
userinfo form to be displayed again and and again,r ather i want user to
redirect to userprofile page..

Please help i have stuck here for about 3 days..

-- 
You received this message because you are subscribed 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/CACqgSmCE4gxFtUSaXYRCTfuni3iS65TNrOOGQpz8CueD38u2pQ%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sergei Sokov
my zoom
Sergey Sokov

среда, 6 мая 2020 г., 10:37:42 UTC+2 пользователь Sergei Sokov написал:
>
> I can but my english is very bad.
>
> среда, 6 мая 2020 г., 10:08:47 UTC+2 пользователь Sherif Adigun написал:
>>
>> Can you come to zoom so we fix this ones and for all
>>
>> On Wed, May 6, 2020, 8:13 AM Sergei Sokov  wrote:
>>
>>> [image: kwargs.JPG]
>>> But the form is empty.
>>>
>>> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
>>> CreateView):
>>> model = Sklad
>>> template_name = 'sklad.html'
>>> form_class = SkladForm
>>> success_url = reverse_lazy('sklad')
>>> success_msg = 'Материал сохранён'
>>> def get_context_data(self, **kwargs):
>>> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
>>> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
>>> kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
>>> context = super(SkladCreateView, self).get_context_data(**kwargs)
>>> if self.request.POST:
>>> context['pack_form'] = PackForm(self.request.POST)
>>> else:
>>> context['pack_form'] = PackForm()
>>> return super().get_context_data(**kwargs) 
>>> def form_valid(self, form):
>>> self.object = form.save(commit=False)
>>> self.object.author = self.request.user
>>> self.object.save()
>>>
>>> context = self.get_context_data()
>>> pack_form = context['pack_form']
>>> # if pack_form.is_valid():
>>> # pack_form.instance = self.object
>>> # pack_form.save()
>>> print(pack_form)
>>> return super().form_valid(form)
>>>
>>>
>>>
>>> вторник, 5 мая 2020 г., 22:17:08 UTC+2 пользователь Sherif Adigun 
>>> написал:

 Please remove 

   if pack_form.is_valid():
 pack_form.instance = self.object
 pack_form.save()


 And replace with print(pack_form)


 Then let's see what it's printing in the console

 On Tue, May 5, 2020, 8:30 PM Sergei Sokov  wrote:

> I have this error when I try save data for SkladForm, when I press 
> submit
> Request Method: POST
> Request URL: http://192.168.0.249:8000/sklad
> Django Version: 3.0.5
> Exception Type: KeyError
> Exception Value: 
>
> 'pack_form'
>
> Exception Location: /var/workspace/myp4/webprint/print/views.py in 
> form_valid, line 362
> line 362 is   pack_form = context['pack_form']
>
> And the PackForm is empty, when I call it.
>
>
> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
> CreateView):
> model = Sklad
> template_name = 'sklad.html'
> form_class = SkladForm
> success_url = reverse_lazy('sklad')
> success_msg = 'Материал сохранён'
> def get_context_data(self, **kwargs):
> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
> kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
> context = super(SkladCreateView, 
> self).get_context_data(**kwargs)
> if self.request.POST:
> context['pack_form'] = PackForm(self.request.POST)
> else:
> context['pack_form'] = PackForm()
> return super().get_context_data(**kwargs) 
>
> def form_valid(self, form):
> self.object = form.save(commit=False)
> self.object.author = self.request.user
> self.object.save()
>
> context = self.get_context_data()
> pack_form = context['pack_form']
> if pack_form.is_valid():
> pack_form.instance = self.object
> pack_form.save()
> return super().form_valid(form)
>
>
>
>
> вторник, 5 мая 2020 г., 18:08:56 UTC+2 пользователь Sherif Adigun 
> написал:
>>
>> you have two returns in get_Context_data. use only this
>>>
>>
>>
>> def get_context_data(self, **kwargs):
>> context = super(SkladCreateView, 
>> self).get_context_data(**kwargs)
>> if self.request.POST:
>> context['pack_form'] = PackForm(self.request.POST)
>> else:
>> context['pack_form'] = PackForm()
>> return super().get_context_data(**kwargs) 
>>
> -- 
> 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/I_32m8lWd-g/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to 
> django...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-

Re: Two forms in one template

2020-05-06 Thread Sergei Sokov
I can but my english is very bad.

среда, 6 мая 2020 г., 10:08:47 UTC+2 пользователь Sherif Adigun написал:
>
> Can you come to zoom so we fix this ones and for all
>
> On Wed, May 6, 2020, 8:13 AM Sergei Sokov > 
> wrote:
>
>> [image: kwargs.JPG]
>> But the form is empty.
>>
>> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
>> CreateView):
>> model = Sklad
>> template_name = 'sklad.html'
>> form_class = SkladForm
>> success_url = reverse_lazy('sklad')
>> success_msg = 'Материал сохранён'
>> def get_context_data(self, **kwargs):
>> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
>> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
>> kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
>> context = super(SkladCreateView, self).get_context_data(**kwargs)
>> if self.request.POST:
>> context['pack_form'] = PackForm(self.request.POST)
>> else:
>> context['pack_form'] = PackForm()
>> return super().get_context_data(**kwargs) 
>> def form_valid(self, form):
>> self.object = form.save(commit=False)
>> self.object.author = self.request.user
>> self.object.save()
>>
>> context = self.get_context_data()
>> pack_form = context['pack_form']
>> # if pack_form.is_valid():
>> # pack_form.instance = self.object
>> # pack_form.save()
>> print(pack_form)
>> return super().form_valid(form)
>>
>>
>>
>> вторник, 5 мая 2020 г., 22:17:08 UTC+2 пользователь Sherif Adigun написал:
>>>
>>> Please remove 
>>>
>>>   if pack_form.is_valid():
>>> pack_form.instance = self.object
>>> pack_form.save()
>>>
>>>
>>> And replace with print(pack_form)
>>>
>>>
>>> Then let's see what it's printing in the console
>>>
>>> On Tue, May 5, 2020, 8:30 PM Sergei Sokov  wrote:
>>>
 I have this error when I try save data for SkladForm, when I press 
 submit
 Request Method: POST
 Request URL: http://192.168.0.249:8000/sklad
 Django Version: 3.0.5
 Exception Type: KeyError
 Exception Value: 

 'pack_form'

 Exception Location: /var/workspace/myp4/webprint/print/views.py in 
 form_valid, line 362
 line 362 is   pack_form = context['pack_form']

 And the PackForm is empty, when I call it.


 class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
 CreateView):
 model = Sklad
 template_name = 'sklad.html'
 form_class = SkladForm
 success_url = reverse_lazy('sklad')
 success_msg = 'Материал сохранён'
 def get_context_data(self, **kwargs):
 kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
 kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
 kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
 context = super(SkladCreateView, 
 self).get_context_data(**kwargs)
 if self.request.POST:
 context['pack_form'] = PackForm(self.request.POST)
 else:
 context['pack_form'] = PackForm()
 return super().get_context_data(**kwargs) 

 def form_valid(self, form):
 self.object = form.save(commit=False)
 self.object.author = self.request.user
 self.object.save()

 context = self.get_context_data()
 pack_form = context['pack_form']
 if pack_form.is_valid():
 pack_form.instance = self.object
 pack_form.save()
 return super().form_valid(form)




 вторник, 5 мая 2020 г., 18:08:56 UTC+2 пользователь Sherif Adigun 
 написал:
>
> you have two returns in get_Context_data. use only this
>>
>
>
> def get_context_data(self, **kwargs):
> context = super(SkladCreateView, 
> self).get_context_data(**kwargs)
> if self.request.POST:
> context['pack_form'] = PackForm(self.request.POST)
> else:
> context['pack_form'] = PackForm()
> return super().get_context_data(**kwargs) 
>
 -- 
 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/I_32m8lWd-g/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 django...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/b3bcc2cc-aa55-42b1-a322-769f177c1862%40googlegroups.com
  
 
 .

>>> -- 
>> You 

Re: I am building an open source School Management System

2020-05-06 Thread Sherif Adigun
Thank you for that. I just realized I didn't commit the static/dist folder
to git.

Let me commit those files and push. Then you can update your clone

On Wed, May 6, 2020, 9:10 AM Sherif Adigun  wrote:

> From your errors, it appears the static files are not loading correctly.
>
> But they are all working right here. Did you clone in a virtual
> environment? Then run pip install -r requirements.txt
>
> On Wed, May 6, 2020, 1:09 AM Milson Munakami  wrote:
>
>> Hi Sherif,
>>
>> I tried to run your project but unfortunately unable to run it properly.
>> It is showing:
>>
>> GET http://127.0.0.1:8000/static/dist/css/adminlte.min.css
>> net::ERR_ABORTED 404 (Not Found)
>> 127.0.0.1/:268 GET http://127.0.0.1:8000/static/dist/js/jquery.formset.js
>> net::ERR_ABORTED 404 (Not Found)
>> 127.0.0.1/:277 GET http://127.0.0.1:8000/static/dist/js/adminlte.js
>> net::ERR_ABORTED 404 (Not Found)
>> 127.0.0.1/:280 GET http://127.0.0.1:8000/static/dist/js/demo.js
>> net::ERR_ABORTED 404 (Not Found)
>> 127.0.0.1/:268 GET http://127.0.0.1:8000/static/dist/js/jquery.formset.js
>> net::ERR_ABORTED 404 (Not Found)
>> 127.0.0.1/:277 GET http://127.0.0.1:8000/static/dist/js/adminlte.js
>> net::ERR_ABORTED 404 (Not Found)
>> 127.0.0.1/:280 GET http://127.0.0.1:8000/static/dist/js/demo.js
>> net::ERR_ABORTED 404 (Not Found)
>>
>> On Tue, May 5, 2020 at 3:38 PM Sherif Adigun 
>> wrote:
>>
>>> I am currently building an open source school Management System on
>>> django and it's currently available on GitHub.
>>>
>>> https://github.com/adigunsherif/Django-School-Management-System
>>>
>>> I need contributors and collaboration.
>>>
>>> Feel free to fork me on GitHub, send a message and let's build a 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/790f347d-a565-4c91-a2b0-fc273702178b%40googlegroups.com
>>> .
>>>
>>
>>
>> --
>> Thank you,
>>
>> Milson Munakami
>>
>> Mobile: 208.220.2943  <208.220.2943>
>>
>> --
>> 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/JGKrFx5sFuM/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/CAP1qhGs3tj0o0kncmUe3Wi%3Dz%3DBuMN9XpGq3AenA-NfUh3fb86Q%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/CACP0aXiRuyApHVeJzk7BKVZ_JihYw2faNYw7p1oJetAJzt6KJw%40mail.gmail.com.


How to dump results and progress of a script in a log file

2020-05-06 Thread Sherif Adigun
Django has the logging feature.

You definitely want to log success or errors in the second option while 
importing data into the database. 

See Django logging system https://docs.djangoproject.com/en/3.0/topics/logging/

-- 
You received this message because you are subscribed 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/b71bf367-b7a3-4651-b6dd-ac2cf3161e0e%40googlegroups.com.


Need to work with csv file

2020-05-06 Thread Sherif Adigun
Have you checked the python csv module? 

You may also want to read this:
https://docs.djangoproject.com/en/3.0/howto/outputting-csv/

-- 
You received this message because you are subscribed 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/7d53eba0-e564-4aee-8411-e6cbdbf69d18%40googlegroups.com.


Re: Need to work with csv file

2020-05-06 Thread Robert Rajendra
for working with csv files you can get help from CSV module of python, you
can read the documents online about it

On Wed, 6 May 2020 at 13:19, sharu kuriakose 
wrote:

> Hi guys
> Iam a student...  doing a project in django.
> In my project i need to open an image, while clicking on that image i need
> to find the color of that pixel position.
> So i need to work with csv file.
> In my views. Py file i have a function.  In that function i need to open a
> csv file which already created and data stored
>
> --
> You received this message because you are subscribed 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/3b4b013d-05c0-4bb2-8251-8e57441b47fd%40googlegroups.com
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

ITH

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.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/CABbC_KHXrsRQMvwuWWd_Vw6_WKBz1KmNs8QeYBzwnr452kK%3DRg%40mail.gmail.com.


Re: I am building an open source School Management System

2020-05-06 Thread Sherif Adigun
>From your errors, it appears the static files are not loading correctly.

But they are all working right here. Did you clone in a virtual
environment? Then run pip install -r requirements.txt

On Wed, May 6, 2020, 1:09 AM Milson Munakami  wrote:

> Hi Sherif,
>
> I tried to run your project but unfortunately unable to run it properly.
> It is showing:
>
> GET http://127.0.0.1:8000/static/dist/css/adminlte.min.css
> net::ERR_ABORTED 404 (Not Found)
> 127.0.0.1/:268 GET http://127.0.0.1:8000/static/dist/js/jquery.formset.js
> net::ERR_ABORTED 404 (Not Found)
> 127.0.0.1/:277 GET http://127.0.0.1:8000/static/dist/js/adminlte.js
> net::ERR_ABORTED 404 (Not Found)
> 127.0.0.1/:280 GET http://127.0.0.1:8000/static/dist/js/demo.js
> net::ERR_ABORTED 404 (Not Found)
> 127.0.0.1/:268 GET http://127.0.0.1:8000/static/dist/js/jquery.formset.js
> net::ERR_ABORTED 404 (Not Found)
> 127.0.0.1/:277 GET http://127.0.0.1:8000/static/dist/js/adminlte.js
> net::ERR_ABORTED 404 (Not Found)
> 127.0.0.1/:280 GET http://127.0.0.1:8000/static/dist/js/demo.js
> net::ERR_ABORTED 404 (Not Found)
>
> On Tue, May 5, 2020 at 3:38 PM Sherif Adigun 
> wrote:
>
>> I am currently building an open source school Management System on django
>> and it's currently available on GitHub.
>>
>> https://github.com/adigunsherif/Django-School-Management-System
>>
>> I need contributors and collaboration.
>>
>> Feel free to fork me on GitHub, send a message and let's build a 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/790f347d-a565-4c91-a2b0-fc273702178b%40googlegroups.com
>> .
>>
>
>
> --
> Thank you,
>
> Milson Munakami
>
> Mobile: 208.220.2943  <208.220.2943>
>
> --
> 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/JGKrFx5sFuM/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/CAP1qhGs3tj0o0kncmUe3Wi%3Dz%3DBuMN9XpGq3AenA-NfUh3fb86Q%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/CACP0aXhbBWmBshejCWMy8N--bFBuC-10neLm1CC%2BbqNFBVxOXQ%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sherif Adigun
Can you come to zoom so we fix this ones and for all

On Wed, May 6, 2020, 8:13 AM Sergei Sokov  wrote:

> [image: kwargs.JPG]
> But the form is empty.
>
> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin,
> CreateView):
> model = Sklad
> template_name = 'sklad.html'
> form_class = SkladForm
> success_url = reverse_lazy('sklad')
> success_msg = 'Материал сохранён'
> def get_context_data(self, **kwargs):
> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
> kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
> context = super(SkladCreateView, self).get_context_data(**kwargs)
> if self.request.POST:
> context['pack_form'] = PackForm(self.request.POST)
> else:
> context['pack_form'] = PackForm()
> return super().get_context_data(**kwargs)
> def form_valid(self, form):
> self.object = form.save(commit=False)
> self.object.author = self.request.user
> self.object.save()
>
> context = self.get_context_data()
> pack_form = context['pack_form']
> # if pack_form.is_valid():
> # pack_form.instance = self.object
> # pack_form.save()
> print(pack_form)
> return super().form_valid(form)
>
>
>
> вторник, 5 мая 2020 г., 22:17:08 UTC+2 пользователь Sherif Adigun написал:
>>
>> Please remove
>>
>>   if pack_form.is_valid():
>> pack_form.instance = self.object
>> pack_form.save()
>>
>>
>> And replace with print(pack_form)
>>
>>
>> Then let's see what it's printing in the console
>>
>> On Tue, May 5, 2020, 8:30 PM Sergei Sokov  wrote:
>>
>>> I have this error when I try save data for SkladForm, when I press submit
>>> Request Method: POST
>>> Request URL: http://192.168.0.249:8000/sklad
>>> Django Version: 3.0.5
>>> Exception Type: KeyError
>>> Exception Value:
>>>
>>> 'pack_form'
>>>
>>> Exception Location: /var/workspace/myp4/webprint/print/views.py in
>>> form_valid, line 362
>>> line 362 is   pack_form = context['pack_form']
>>>
>>> And the PackForm is empty, when I call it.
>>>
>>>
>>> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin,
>>> CreateView):
>>> model = Sklad
>>> template_name = 'sklad.html'
>>> form_class = SkladForm
>>> success_url = reverse_lazy('sklad')
>>> success_msg = 'Материал сохранён'
>>> def get_context_data(self, **kwargs):
>>> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
>>> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
>>> kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
>>> context = super(SkladCreateView, self).get_context_data(**kwargs)
>>> if self.request.POST:
>>> context['pack_form'] = PackForm(self.request.POST)
>>> else:
>>> context['pack_form'] = PackForm()
>>> return super().get_context_data(**kwargs)
>>>
>>> def form_valid(self, form):
>>> self.object = form.save(commit=False)
>>> self.object.author = self.request.user
>>> self.object.save()
>>>
>>> context = self.get_context_data()
>>> pack_form = context['pack_form']
>>> if pack_form.is_valid():
>>> pack_form.instance = self.object
>>> pack_form.save()
>>> return super().form_valid(form)
>>>
>>>
>>>
>>>
>>> вторник, 5 мая 2020 г., 18:08:56 UTC+2 пользователь Sherif Adigun
>>> написал:

 you have two returns in get_Context_data. use only this
>


 def get_context_data(self, **kwargs):
 context = super(SkladCreateView,
 self).get_context_data(**kwargs)
 if self.request.POST:
 context['pack_form'] = PackForm(self.request.POST)
 else:
 context['pack_form'] = PackForm()
 return super().get_context_data(**kwargs)

>>> --
>>> 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/I_32m8lWd-g/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/b3bcc2cc-aa55-42b1-a322-769f177c1862%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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/I_32m8lWd-g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dj

Need to work with csv file

2020-05-06 Thread sharu kuriakose
Hi guys  
Iam a student...  doing a project in django. 
In my project i need to open an image, while clicking on that image i need to 
find the color of that pixel position. 
So i need to work with csv file. 
In my views. Py file i have a function.  In that function i need to open a csv 
file which already created and data stored

-- 
You received this message because you are subscribed 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/3b4b013d-05c0-4bb2-8251-8e57441b47fd%40googlegroups.com.


Re: I'm new to this django help me out

2020-05-06 Thread Robert Rajendra
state your question


On Tue, 5 May 2020 at 23:02, Sherif Adigun  wrote:

> what is your question?
>
> On Tuesday, May 5, 2020 at 6:25:48 PM UTC+1, sree lekha wrote:
>>
>> --
> You received this message because you are subscribed 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/f432b7cc-a4f1-4f2a-a0af-39d918696c18%40googlegroups.com
> 
> .
>


-- 

*Robert Rajendra*

Associate Network/Server Support Engineer

ITH

P: +91 863.087.3094 <+91%2086308%2073094>

W: www.ITHands.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/CABbC_KHdUvk2_gc%3D0fQ7vXVnOeOt-6VVb2TjJKYhmPXj3rPoVg%40mail.gmail.com.


Re: Two forms in one template

2020-05-06 Thread Sergei Sokov


[image: kwargs.JPG]
But the form is empty.

class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
CreateView):
model = Sklad
template_name = 'sklad.html'
form_class = SkladForm
success_url = reverse_lazy('sklad')
success_msg = 'Материал сохранён'
def get_context_data(self, **kwargs):
kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
context = super(SkladCreateView, self).get_context_data(**kwargs)
if self.request.POST:
context['pack_form'] = PackForm(self.request.POST)
else:
context['pack_form'] = PackForm()
return super().get_context_data(**kwargs) 
def form_valid(self, form):
self.object = form.save(commit=False)
self.object.author = self.request.user
self.object.save()

context = self.get_context_data()
pack_form = context['pack_form']
# if pack_form.is_valid():
# pack_form.instance = self.object
# pack_form.save()
print(pack_form)
return super().form_valid(form)



вторник, 5 мая 2020 г., 22:17:08 UTC+2 пользователь Sherif Adigun написал:
>
> Please remove 
>
>   if pack_form.is_valid():
> pack_form.instance = self.object
> pack_form.save()
>
>
> And replace with print(pack_form)
>
>
> Then let's see what it's printing in the console
>
> On Tue, May 5, 2020, 8:30 PM Sergei Sokov > 
> wrote:
>
>> I have this error when I try save data for SkladForm, when I press submit
>> Request Method: POST
>> Request URL: http://192.168.0.249:8000/sklad
>> Django Version: 3.0.5
>> Exception Type: KeyError
>> Exception Value: 
>>
>> 'pack_form'
>>
>> Exception Location: /var/workspace/myp4/webprint/print/views.py in 
>> form_valid, line 362
>> line 362 is   pack_form = context['pack_form']
>>
>> And the PackForm is empty, when I call it.
>>
>>
>> class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
>> CreateView):
>> model = Sklad
>> template_name = 'sklad.html'
>> form_class = SkladForm
>> success_url = reverse_lazy('sklad')
>> success_msg = 'Материал сохранён'
>> def get_context_data(self, **kwargs):
>> kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
>> kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
>> kwargs['list_hole'] = Hole.objects.all().order_by('name_hole')
>> context = super(SkladCreateView, self).get_context_data(**kwargs)
>> if self.request.POST:
>> context['pack_form'] = PackForm(self.request.POST)
>> else:
>> context['pack_form'] = PackForm()
>> return super().get_context_data(**kwargs) 
>>
>> def form_valid(self, form):
>> self.object = form.save(commit=False)
>> self.object.author = self.request.user
>> self.object.save()
>>
>> context = self.get_context_data()
>> pack_form = context['pack_form']
>> if pack_form.is_valid():
>> pack_form.instance = self.object
>> pack_form.save()
>> return super().form_valid(form)
>>
>>
>>
>>
>> вторник, 5 мая 2020 г., 18:08:56 UTC+2 пользователь Sherif Adigun написал:
>>>
>>> you have two returns in get_Context_data. use only this

>>>
>>>
>>> def get_context_data(self, **kwargs):
>>> context = super(SkladCreateView, self).get_context_data(**kwargs)
>>> if self.request.POST:
>>> context['pack_form'] = PackForm(self.request.POST)
>>> else:
>>> context['pack_form'] = PackForm()
>>> return super().get_context_data(**kwargs) 
>>>
>> -- 
>> 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/I_32m8lWd-g/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b3bcc2cc-aa55-42b1-a322-769f177c1862%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/e6bd5958-e885-488c-85e8-9452589d50cf%40googlegroups.com.