Consider this blog post model:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| z20 = ['zero','one','two','three','four', | |
| 'five','six','seven','eight','nine', | |
| 'ten','eleven','twelve','thirteen', | |
| 'fourteen','fifteen','sixteen', | |
| 'seventeen','eighteen','nineteen'] | |
| zTens = ['twenty','thirty','fourty','fifty', | |
| 'sixty','seventy','eighty','ninety'] | |
| zPlaces = ['thousand','million','billion','trillion', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "code": "OK", | |
| "results": [ | |
| { | |
| "cat_id": "11932", | |
| "name": "Video Games", | |
| "parent_cat_id": "1", | |
| "parent_name": "Home" | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function get_ip() { | |
| //Just get the headers if we can or else use the SERVER global | |
| if ( function_exists( 'apache_request_headers' ) ) { | |
| $headers = apache_request_headers(); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Product(models.Model): | |
| name = models.CharField(max_length=256, unique=True) | |
| def __unicode__(self): | |
| return self.name | |
| class Topic(models.Model): | |
| name = models.CharField(max_length=256) | |
| product = models.ForeignKey('Product', related_name='topics') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //license limit | |
| function pw_edd_sl_license_at_limit( $ret = false, $license_id = 0, $limit = 0, $download_id = 0 ) { | |
| $purchase_id = get_post_meta( $license_id, '_edd_sl_payment_id', true ); | |
| $purchase_date = new DateTime( get_post_field( 'post_date', $purchase_id ) ); | |
| $limit_date = new DateTime( '2013-01-01' ); | |
| if( $purchase_date < $limit_date ) { | |
| // licenses purchased before January 1, 2013 are unlimited |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @media (max-width: 479px) { | |
| .miss_billboard { | |
| width: auto !important; | |
| padding: 0 20px !important; | |
| text-align: center !important; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @media (max-width: 767px) { | |
| body { | |
| padding-right: 0 !important; | |
| padding-left: 0 !important; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @media only screen and (max-width: 750px) { | |
| .header-widget { | |
| width: 98% !important; | |
| padding: 1%; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Pycharm settings -> Project settings -> Console -> Django console | |
| from django.db.models.loading import get_models | |
| for m in get_models(): | |
| exec "from %s import %s" % (m.__module__, m.__name__) |