AaLondon / aalondon

aalondon
5 stars 3 forks source link

Events are empty by default- Need a dummy event (Low Priority) #156

Open RajaKrovvidi opened 3 years ago

RajaKrovvidi commented 3 years ago

An option to load dummy events if events are empty!

chriswedgwood commented 3 years ago

Have a read of this 👍 https://docs.djangoproject.com/en/2.2/howto/initial-data/

RajaKrovvidi commented 3 years ago

Thanks Chris, will read and work on the ticket this weekend.

On Mon, Aug 3, 2020 at 8:43 PM Chris Wedgwood notifications@github.com wrote:

Have a read of this 👍 https://docs.djangoproject.com/en/2.2/howto/initial-data/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AaLondon/aalondon/issues/156#issuecomment-668207388, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRXSVAD3OTNAODIKIHTR5TR64HPPANCNFSM4PSAZX3A .

RajaKrovvidi commented 3 years ago

Hi Chris, added the below to a new file called events.json in event/fixtures. [ { "model": "event.RecurringEventParent", "pk": 1, "fields": { "title" : "London North InterGroup", "slug":"parent", "post_date":"2020-08-09", "recurring_start_date": "2020-08-15", "recurring_end_date":"2020-10-15", "start_time" : "07:00:00", "end_time":"08:30:00", "recurring_index" : 0, "recurring_month" : 0, "address": "Flat 5, 196", "postcode": "EC2V 6HH", "type": 1 }
} ]

I then exec'd python manage.py loaddata events
follwed by python manage.py runserver 0.0.0.0:8000 my events are still empty in my local portal.

chriswedgwood commented 3 years ago

Did you create the file with dumpdata?

Check your changes into a branch and I can have a look tonight 👀

On Mon, 10 Aug 2020 at 01:27, RajaKrovvidi notifications@github.com wrote:

Hi Chris, added the below to a new file called events.json in event/fixtures.

[

{

"model": "event.RecurringEventParent",

"pk": 1,

"fields": {

"title" : "London North InterGroup",

"slug":"parent",

"post_date":"2020-08-09",

"recurring_start_date": "2020-08-15",

"recurring_end_date":"2020-10-15",

"start_time" : "07:00:00",

"end_time":"08:30:00",

"recurring_index" : 0,

"recurring_month" : 0,

"address": "Flat 5, 196",

"postcode": "EC2V 6HH",

"type": 1

}

}

]

I then exec'd

python manage.py loaddata events

follwed by

python manage.py runserver 0.0.0.0:8000

my events are still empty in my local portal.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/AaLondon/aalondon/issues/156#issuecomment-671120582, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJW5M2Y6XXNIYY55F5NCLLR745IBANCNFSM4PSAZX3A .

tintinnabulate commented 3 years ago

An option to load dummy events if events are empty!

What's the rationale behind this issue? I'm coming in cold - just want to understand it. Perhaps I can help!

chriswedgwood commented 3 years ago

Raja is creating some fixtures to have some events data when a developer builds the project

On Mon, 10 Aug 2020 at 17:38, tintinnabulate notifications@github.com wrote:

An option to load dummy events if events are empty!

What's the rationale behind this issue? I'm coming in cold - just want to understand it. Perhaps I can help!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/AaLondon/aalondon/issues/156#issuecomment-671461658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJW5M3VLWDWDHTJ336NM63SAAO6TANCNFSM4PSAZX3A .

tintinnabulate commented 3 years ago

Oh nice. Should be handy for devs working on events :)

chriswedgwood commented 3 years ago

Hi @RajaKrovvidi I have had a look at your approach and I can see where there is an issue Instead of using dumpdata/loaddata and fixtures I think we will need to create events programmatically. The reason for this is that you need to create wagtail page objects which are a little different from django models so fixtures dont work best. If you look in the cms_admin management command I have created a service page using wagtail programmatically. Also I created a suite of tests testing the event model in events/models.py. Also check this link for inspiration : https://www.codista.com/en/blog/create-wagtail-pages-programmatically/