Re: Advice please.

2020-08-02 Thread Chucky Mada Madamombe
Hi,

You have 2 options:

1. You can use choices
2. You can store data in a model, and then link with a foreign key.

First option is suitable for that data which wont change regularly e.g
gender..For data that changes or need to be updated regularly,  then use
second option.

On Mon, 03 Aug 2020, 02:21 Hector Berrones,  wrote:

> Hi Bros,
>
> I have very little experience using django and I would like to know how
> would be the most conveniente way  to store and manage the common data in a
> django proyect that would have several  applications  when I say common
> data I mean information about tables cities, Countries, Catalog Sections I
> mean information that usera can use select from a Select Field in for
> example.
>
> Thanks in advance for reading 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/CAFFaoU%2BvDpH%3DUxLs-uVQfbskMTuv-NXhwMvQ9%2Biua65B75MnAw%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/CAJaKOscj-%3D9t0dd2myXJ%3D-_MCw6tZrO8npYO2W483NWWLK36og%40mail.gmail.com.


Re:

2020-04-27 Thread Chucky Mada Madamombe
You can use generic class based views and an html template.

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Tue, 28 Apr 2020, 02:11 fahad rasool  wrote:

> How to retrieve data from database and display on web page ,example i want
> to display the details of the user on  a web page which he has entered in a
> form which is stored in database.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CACqgSmA0Cjjx8S_SqeGF1wBDQggGAXszKdApOD45-1CPBPXG0g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACqgSmA0Cjjx8S_SqeGF1wBDQggGAXszKdApOD45-1CPBPXG0g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

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


Re: Beginner question

2020-04-23 Thread Chucky Mada Madamombe
Hello,

You need to create views and urls and a templates. Read more on the Django
documentation.

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Thu, 23 Apr 2020, 16:46 dradam lomas 
wrote:

> Hello there! I am just starting out! I need help knowing how to get past
> this screen. I'm just typing "Hello world", right now, but I plan to make a
> website using Python.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/ed6c31cf-b23b-42bf-9075-36f5970aa480%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ed6c31cf-b23b-42bf-9075-36f5970aa480%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


Re: django doughts

2020-04-13 Thread Chucky Mada Madamombe
Hi,

In your mysite.urls, you must include the polls app urls as well. The error
is basically telling you that there is no url you are trying to request.

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Sun, 12 Apr 2020, 14:37 rama prakash y  wrote:

> Hi can u plz tell me how can solve the pollsapp development in  django
> project. I had complete my pollsapp development project in Django
> documentation like that guidance.but i have browser error .
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/c09b3231-3700-4157-9c4a-a75bc9a6e69c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c09b3231-3700-4157-9c4a-a75bc9a6e69c%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


Re: best practice: using only url.py from the main project

2020-04-12 Thread Chucky Mada Madamombe
Hi yes it's bad practice.this is why:

The best point is to be able to reuse applications in different projects.
There will be problem if you are saving all your URLs in the
“projecturl.py” file. So best practice is to create an “url.py” per
application and to include it in your main projects url.py file.

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Sun, 12 Apr 2020, 14:37 Esther Camilo  wrote:

> Most of the tutorial recomends you create a url.py inside your app (as
> polls for example). Is it a bad practice using only url.py from the main
> project folder?
> Thanks for your attention.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/0c93108f-370b-4555-8a65-e6d78f829e36%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0c93108f-370b-4555-8a65-e6d78f829e36%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


Re: Any newbies especially in Cape Town for meetups?

2020-02-17 Thread Chucky Mada Madamombe
I suggest a group for everyone in RSA is fine and not just CAPETOWN. I am
interested!

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Sun, 16 Feb 2020, 00:05 Francis Butawu  wrote:

> Hi All
>
> I'm new to Django and I'm looking for some people to organize a meetup
> with and learn from each other ideally those in Cape Town pls reach out
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/841891a5-2df4-4c2e-ab5c-6f2ee7a9b44d%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/CAJaKOscHUcQDyD29P-tAhfQxQkk%3DwFg6XiyD708YqKb5T-zaHg%40mail.gmail.com.


Re: 404 error

2020-02-12 Thread Chucky Mada Madamombe
Hi,

404 error means Django searched your urls.py file and cannot find the
requested page. Take screen shot of your urls.py and views.py and
traceback. That may help us to figure out the problem.

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Thu, 13 Feb 2020, 00:29 mahshid asadi  wrote:

> Hi everyone. Im a beginner. i use this sites tutorial and still i cant fix
> the 404 error,please someone 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/d7ce0e72-20a3-40eb-9f9c-a910389b09f0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d7ce0e72-20a3-40eb-9f9c-a910389b09f0%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


Re: Error with filter queryset

2020-02-09 Thread Chucky Mada Madamombe
Thanks Farai!

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Sun, 9 Feb 2020, 18:14 Farai M  wrote:

> The status is a foreign ID u can use choices if the status is not
> dynamically changed by the users . Otherwise you will need to pass the
> selected status from fronted or hardcode it.
>
> On Sun, Feb 9, 2020, 2:58 PM Chuck G. Madamombe 
> wrote:
>
>> Hello,
>>
>> I want to filter data in the database to retrieve only those tasks with
>> status='In progress'. I have used the filter queryset, but am getting an
>> error. Please help.
>>
>> *Here is my view (Filter tasks by their status):*
>>
>> def tasks_in_progress(request):
>> tasks = Task.objects.filter(Status='In progress')
>> context = {'tasks': tasks}
>> #return render(request,"todoapp/show_task.html",{'tasks':tasks})
>> return render(request,"todoapp/tasks_in_progress.html", context)
>>
>>
>>
>> *The model.py*
>>
>> class Task(models.Model):
>> #Task_Title = models.ForeignKey(ToDoList, on_delete=models.CASCADE)
>> Task_Title = models.CharField(max_length=500)
>> Task_Description = models.CharField(max_length=500)
>> Priority = models.ForeignKey(Task_Priority, on_delete=models.CASCADE)
>> Date_Created = models.DateTimeField(auto_now_add=True)
>> Completion_Date = models.DateTimeField()
>> Assigned_To = models.ForeignKey(User, blank=True, null=True, 
>> on_delete=models.SET_NULL)
>> Status = models.ForeignKey(Task_Status, on_delete=models.CASCADE)
>>
>> def __str__(self):
>> return self.Task_Description
>>
>> *The error am getting is:*
>>
>> ValueError at /todoapp/tasks_in_progress
>>
>> Field 'id' expected a number but got 'In progress'.
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/todoapp/tasks_in_progress
>> Django Version: 3.0.2
>> Exception Type: ValueError
>> Exception Value:
>>
>> Field 'id' expected a number but got 'In progress'.
>>
>> Exception Location: C:\Users\Chuck
>> Madamombe\Desktop\djangoPROJECTS\lib\site-packages\django\db\models\fields\__init__.py
>> in get_prep_value, line 1772
>> Python Executable: C:\Users\Chuck
>> Madamombe\Desktop\djangoPROJECTS\Scripts\python.exe
>> Python Version: 3.7.1
>> Python Path:
>>
>> ['C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS',
>>  'C:\\Users\\Chuck 
>> Madamombe\\Desktop\\djangoPROJECTS\\Scripts\\python37.zip',
>>  'C:\\Users\\Chuck '
>>  'Madamombe\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
>>  'C:\\Users\\Chuck '
>>  'Madamombe\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
>>  'C:\\Users\\Chuck Madamombe\\AppData\\Local\\Programs\\Python\\Python37-32',
>>  'C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS',
>>  'C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS\\lib\\site-packages',
>>  'C:\\Users\\Chuck '
>>  
>> 'Madamombe\\Desktop\\djangoPROJECTS\\lib\\site-packages\\setuptools-39.1.0-py3.7.egg']
>>
>> Server time: Sun, 9 Feb 2020 10:22:05 +0200
>>
>>
>> But if I just retrieve all the records in the database, without
>> filtering, its working without an error
>>
>>
>>
>> *My View to retrieve all the records in the database, without filtering.*
>>
>> def show_task(request):
>> tasks = Task.objects.all()
>> context = {'tasks': tasks}
>> #return render(request,"todoapp/show_task.html",{'tasks':tasks})
>> return render(request,"todoapp/show_task.html", context)
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/a13041e8-1c37-4722-bf64-4faa75dd56ff%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/a13041e8-1c37-4722-bf64-4faa75dd56ff%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on t

Re: Error with filter queryset

2020-02-09 Thread Chucky Mada Madamombe
Antje,

Thanks very much for your help!

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Sun, 9 Feb 2020, 15:25 Antje Kazimiers  wrote:

> Hi Chuck,
>
> Status in your example is not a text field, but a Foreign Key, that means
> a reference to a record in another table Task_Status, you see that here:
>
> Status = models.ForeignKey(Task_Status, on_delete=models.CASCADE)
>
>
> You need to filter on the attribute within Task_Status, which has the
> value 'In progress', probably the 'name' attribute:
>
> tasks = Task.objects.filter(Status__name='In progress')
>
>
> The error says it expects an id, which is the primary key of the
> Task_Status record the Task record is referring to.
>
>
> Hope that helps,
> Antje
>
> On 2/9/20 3:31 AM, Chuck G. Madamombe wrote:
>
> Hello,
>
> I want to filter data in the database to retrieve only those tasks with
> status='In progress'. I have used the filter queryset, but am getting an
> error. Please help.
>
> *Here is my view (Filter tasks by their status):*
>
> def tasks_in_progress(request):
> tasks = Task.objects.filter(Status='In progress')
> context = {'tasks': tasks}
> #return render(request,"todoapp/show_task.html",{'tasks':tasks})
> return render(request,"todoapp/tasks_in_progress.html", context)
>
>
> *The model.py*
>
> class Task(models.Model):
> #Task_Title = models.ForeignKey(ToDoList, on_delete=models.CASCADE)
> Task_Title = models.CharField(max_length=500)
> Task_Description = models.CharField(max_length=500)
> Priority = models.ForeignKey(Task_Priority, on_delete=models.CASCADE)
> Date_Created = models.DateTimeField(auto_now_add=True)
> Completion_Date = models.DateTimeField()
> Assigned_To = models.ForeignKey(User, blank=True, null=True, 
> on_delete=models.SET_NULL)
> Status = models.ForeignKey(Task_Status, on_delete=models.CASCADE)
>
> def __str__(self):
> return self.Task_Description
>
> *The error am getting is:*
>
> ValueError at /todoapp/tasks_in_progress
>
> Field 'id' expected a number but got 'In progress'.
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/todoapp/tasks_in_progress
> Django Version: 3.0.2
> Exception Type: ValueError
> Exception Value:
>
> Field 'id' expected a number but got 'In progress'.
>
> Exception Location: C:\Users\Chuck
> Madamombe\Desktop\djangoPROJECTS\lib\site-packages\django\db\models\fields\__init__.py
> in get_prep_value, line 1772
> Python Executable: C:\Users\Chuck
> Madamombe\Desktop\djangoPROJECTS\Scripts\python.exe
> Python Version: 3.7.1
> Python Path:
>
> ['C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS',
>  'C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS\\Scripts\\python37.zip',
>  'C:\\Users\\Chuck '
>  'Madamombe\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
>  'C:\\Users\\Chuck '
>  'Madamombe\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
>  'C:\\Users\\Chuck Madamombe\\AppData\\Local\\Programs\\Python\\Python37-32',
>  'C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS',
>  'C:\\Users\\Chuck Madamombe\\Desktop\\djangoPROJECTS\\lib\\site-packages',
>  'C:\\Users\\Chuck '
>  
> 'Madamombe\\Desktop\\djangoPROJECTS\\lib\\site-packages\\setuptools-39.1.0-py3.7.egg']
>
> Server time: Sun, 9 Feb 2020 10:22:05 +0200
>
>
> But if I just retrieve all the records in the database, without filtering,
> its working without an error
>
>
>
> *My View to retrieve all the records in the database, without filtering.*
>
> def show_task(request):
> tasks = Task.objects.all()
> context = {'tasks': tasks}
> #return render(request,"todoapp/show_task.html",{'tasks':tasks})
> return render(request,"todoapp/show_task.html", context)
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/a13041e8-1c37-4722-bf64-4faa75dd56ff%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a13041e8-1c37-4722-bf64-4faa75dd56ff%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+

Re: Python Django Training

2020-02-02 Thread Chucky Mada Madamombe
Interested!

Regards

Chuck G. Madamombe
NAM: +264 81 842 1284
RSA: +27 78 208 7034
Twitter: @chuckygari
Skype: chuckygari
Facebook: Chucky Mada Madamombe
LinkedIn: Chucknorris Garikayi Madamombe

On Sun, 2 Feb 2020, 19:51 brett Fodor  wrote:

> Add 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/6950bbaa-eccd-49d7-ae35-b98284a37e62%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/CAJaKOseuZMCco5pSHPzW7a-SyY-8vgaXbxQzS-4JbOPuqOm6MA%40mail.gmail.com.