Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "site flags" mechanism and convert 'schedule_published' to it #65

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@encukou
Copy link
Member

encukou commented Mar 1, 2019

For: #5

  • Add pyconcz.common.models.SiteFlag, a boolean that can be turned
    on/off at a specific time.
  • Add SiteFlag to the admin
  • Add a context processor to get all active site flags, and
    register it
  • Add migration that creates a 'schedule_published' flag (off by
    default)
  • Modify templates to use this flag, rather than overriding based
    on CURRENT_PHASE
Add "site flags" mechanism and convert 'schedule_published' to it
- Add pyconcz.common.models.SiteFlag, a boolean that can be turned
  on/off at a specific time.
- Add SiteFlag to the admin
- Add a context processor to get all active site flags, and
  register it
- Add migration that creates a 'schedule_published' flag (off by
  default)
- Modify templates to use this flag, rather than overriding based
  on CURRENT_PHASE
@encukou

This comment has been minimized.

Copy link
Member Author

encukou commented Mar 1, 2019

Jako neDjangista prosím Djangistu o review – bourám best practices? @starenka?
Funkčnost dořešíme v #5

@encukou encukou requested a review from starenka Mar 1, 2019

@frenzymadness

This comment has been minimized.

Copy link
Member

frenzymadness commented Mar 3, 2019

At first look, it looks good to me. But I am not the right person to do a review. We can also deploy it and test it.

max_length=200,
choices=[
# Human-readable titles are the same as the value
(v, v) for v in ("on", "off", "on_at", "off_at")

This comment has been minimized.

@starenka

starenka Mar 6, 2019

Contributor

ty choices bejva fajn mit jako "konstantu" na ty tride (kdyz se to meni, tak se to meni na jednom miste, pouziva se to pak z klasy, je to takovy vic jasny, co to dela), ale nevidim to jako velkej trabl....

neco ala:

VALUE_TYPE_ON = 'on', nebo se na to pouzivaj libky ala django-choices

@classmethod
def get_active_flags(cls):
now = timezone.now()
return [obj.name for obj in (

This comment has been minimized.

@starenka

starenka Mar 6, 2019

Contributor
  • tady bejva usus si poslat "jen to, co potrebujes - tedy selectnout jen fieldy, ktery chces", tedy cls.objects.filter(value_type='on').values_list('name', flat=True) viz. values_list

  • jinak by asi bylo pro "djangisty" citelnejsi pouzit Q misto tohohole chainu (a taky je mozna lepsi jeden dotaz nez tri)....

samo to de zkombinovat oboje dohromady. nicmene hele jestli to funguje, nestoural bych do toho ;)

class SiteFlagAdmin(admin.ModelAdmin):
fields = ['name', 'value_type', 'switch_time']
list_display = ['name', 'value_type', 'switch_time', 'current_value']

This comment has been minimized.

@starenka

starenka Mar 6, 2019

Contributor

pro pohodlnost mozna neco hodit do list_editable

@starenka

This comment has been minimized.

Copy link
Contributor

starenka commented Mar 6, 2019

ty komenty sou drobnosti, jestli to funguje, tak citelny je to v pohode, neresil bych to

@frenzymadness

This comment has been minimized.

Copy link
Member

frenzymadness commented Mar 6, 2019

@benabraham anything against merging this? IMHO this is much better than the current state/workflow.

@benabraham

This comment has been minimized.

Copy link
Member

benabraham commented Mar 6, 2019

We don’t need that right now (everything will be in a desired state for some time), so feel free to refactor as needed and merge after.

@frenzymadness

This comment has been minimized.

Copy link
Member

frenzymadness commented Mar 7, 2019

Dan is right. @encukou if you want to address comments, feel free to do it. But if you don't have time to do so, I'll merge it as is next weekend when we'll have some time to play with it.

@frenzymadness

This comment has been minimized.

Copy link
Member

frenzymadness commented Mar 13, 2019

Next changes on website will be:

  • keynoters
  • speakers
  • programme

@benabraham could you please consider fixing the conflict here sooner than later so we can use this features?

@encukou

This comment has been minimized.

Copy link
Member Author

encukou commented Mar 13, 2019

I am planning to address the comments, but I'll only get to it on Friday.

@encukou

This comment has been minimized.

Copy link
Member Author

encukou commented Mar 15, 2019

Possibly superseded by #85.

@benabraham

This comment has been minimized.

Copy link
Member

benabraham commented Mar 18, 2019

Definitely superseeded by #85, let's use that!

@benabraham benabraham closed this Mar 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.