Re: Dynamic creation of pages

2023-10-26 Thread Bayo Izekor
# models.py
from django.db import models

class Title(models.Model):
name = models.CharField(max_length=100, unique=True)
# Add other fields as needed

# views.py
from django.shortcuts import render, get_object_or_404
from .models import Title

def title_page(request, title_id):
title = get_object_or_404(Title, pk=title_id)
# Retrieve and display data associated with the title
# Render a template to display the data
return render(request, 'title_page.html', {'title': title})





Home

Titles

{% for title in titles %}
{{ title.name 
}}
{% endfor %}





On Thursday, October 26, 2023 at 2:10:09 PM UTC+1 AAnnoo khan wrote:

> Give the same statement to ChatGPT and it will give you a very good 
> explanation of this problem.
> I did it before with ChatGPT 
>
> On Wed, Oct 25, 2023, 10:25 PM Raymond N  wrote:
>
>> Am working on a website using django and i want to create a dropdown list 
>> on the navigation bar such that when i add a title in the admin its added 
>> here.
>>
>> This title should also automatically be a link to a page populated with 
>> data attached to that specific title
>>
>> Does anyone know how i can do this??
>>
>> Thanks, 
>> Raymond
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAJpDcBRHUKy9V_g-n_o5cd71LKqUPAEfjJxD041%3DEqeaRPmqyA%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/4dc7a2a4-7299-43b9-9389-ae71d28ebfebn%40googlegroups.com.


Re: Let makemigrations know a data migration is required ?

2022-08-12 Thread Bayo Izekor
please explain what you want to achieve for better support

On Fri, Aug 12, 2022 at 4:57 PM Gav O'Connor  wrote:

> You can create a data migration using the `--empty` switch. See the docs:
> https://docs.djangoproject.com/en/4.1/topics/migrations/#data-migrations
>
> On Thursday, 11 August 2022 at 22:42:42 UTC+1 adnans...@gmail.com wrote:
>
>> When we create a modal or change a modal than we use these two commands
>> python manage.py makemigrations here our table are created and to insert
>> these table into database this command is necessary python manage.py
>> migrate. I hope you will understand this.
>>
>> On Fri, 12 Aug 2022, 12:56 am Stu.Axon,  wrote:
>>
>>> I've got a table that has a list of classnames (that aren't models) that
>>> are subclasses of a class.
>>>
>>> I'd like to hook into makemigrations and generate data migrations to add
>>> / remove data as required - any idea the best way I can 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/765737bd-2139-45ef-a6ed-6eb802d58f6cn%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/502a64bb-de9e-429d-878d-a59aba9741b5n%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/CAKiMBw2_q4N58KN4LHBDobCaX-otfitxCoh6eFqkpgYaxEigdg%40mail.gmail.com.