├── .gitignore ├── .travis.yml ├── LICENSE ├── Procfile ├── README.md ├── docs ├── Makefile ├── make.bat └── source │ ├── api.rst │ ├── conf.py │ ├── contributing.rst │ ├── index.rst │ └── modules │ ├── filters.rst │ ├── models.rst │ └── views.rst ├── homes ├── .travis.yaml ├── api │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── filters.py │ ├── fixtures │ │ └── groups.json │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_property.py │ │ ├── 0003_auto_20160311_0305.py │ │ ├── 0004_delete_simpleproperty.py │ │ ├── 0005_auto_20160417_1125.py │ │ ├── 0006_auto_20160418_0013.py │ │ ├── 0007_auto_20160504_0006.py │ │ ├── 0008_profile.py │ │ ├── 0009_auto_20160511_0148.py │ │ ├── 0010_auto_20160516_0438.py │ │ ├── 0011_auto_20160621_1136.py │ │ ├── 0012_auto_20160622_0700.py │ │ └── __init__.py │ ├── models.py │ ├── permissions.py │ ├── serializers.py │ ├── tests.py │ ├── util.py │ └── views.py ├── homes │ ├── __init__.py │ ├── pagination.py │ ├── settings.py │ ├── settings_local.py │ ├── settings_testing.py │ ├── static │ │ └── hello │ ├── urls.py │ └── wsgi.py └── manage.py ├── requirements-docs.txt ├── requirements.txt ├── runtime.txt └── schema └── schema.csv /.gitignore: -------------------------------------------------------------------------------- 1 | homes/homes/staticfiles 2 | venv/ 3 | *.sqlite3 4 | *.db 5 | *.swp 6 | 7 | # 8 | # Byte-compiled / optimized / DLL files 9 | __pycache__/ 10 | *.py[cod] 11 | *$py.class 12 | 13 | # C extensions 14 | *.so 15 | 16 | # Distribution / packaging 17 | .Python 18 | env/ 19 | build/ 20 | develop-eggs/ 21 | dist/ 22 | downloads/ 23 | eggs/ 24 | .eggs/ 25 | lib/ 26 | lib64/ 27 | parts/ 28 | sdist/ 29 | var/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | 34 | # PyInstaller 35 | # Usually these files are written by a python script from a template 36 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 37 | *.manifest 38 | *.spec 39 | 40 | # Installer logs 41 | pip-log.txt 42 | pip-delete-this-directory.txt 43 | 44 | # Unit test / coverage reports 45 | htmlcov/ 46 | .tox/ 47 | .coverage 48 | .coverage.* 49 | .cache 50 | nosetests.xml 51 | coverage.xml 52 | *,cover 53 | .hypothesis/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | 62 | # Sphinx documentation 63 | docs/_build/ 64 | 65 | # PyBuilder 66 | target/ 67 | 68 | #Ipython Notebook 69 | .ipynb_checkpoints 70 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - 3.4 4 | - 3.5 5 | 6 | install: 7 | - pip install -r requirements.txt 8 | - pip install coveralls 9 | script: 10 | - cd ./homes 11 | - python manage.py test --settings=homes.settings_testing 12 | - coverage run --source=api manage.py test --settings=homes.settings_testing 13 | after_success: 14 | - coveralls 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn --pythonpath homes homes.wsgi --log-file - 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # home-data-api 2 | A RESTful API written in Django for user submission and lookup of home sales data 3 | 4 | ## Status 5 | 6 | ### Master 7 | [![Build Status](https://travis-ci.org/data-skeptic/home-data-api.svg?branch=master)](https://travis-ci.org/data-skeptic/home-data-api) 8 | [![Coverage Status](https://coveralls.io/repos/github/data-skeptic/home-data-api/badge.svg?branch=master)](https://coveralls.io/github/data-skeptic/home-data-api?branch=master) 9 | [![Documentation Status](http://readthedocs.org/projects/data-skeptic-home-data-api/badge/?version=latest)](http://data-skeptic-home-data-api.readthedocs.org/en/latest/?badge=latest) 10 | 11 | ### Develop 12 | [![Build Status](https://travis-ci.org/data-skeptic/home-data-api.svg?branch=develop)](https://travis-ci.org/data-skeptic/home-data-api) 13 | [![Coverage Status](https://coveralls.io/repos/github/data-skeptic/home-data-api/badge.svg?branch=develop)](https://coveralls.io/github/data-skeptic/home-data-api?branch=develop) 14 | [![Documentation Status](http://readthedocs.org/projects/data-skeptic-home-data-api/badge/?version=develop)](http://data-skeptic-home-data-api.readthedocs.org/en/develop/?badge=develop) 15 | 16 | 17 | ## Setting up 18 | This project was built with python 3.4 19 | 20 | ```bash 21 | $ python3 -m virtualenv venv 22 | $ source ./venv/bin/activate 23 | $ pip install -r requirements.txt 24 | $ cd homes 25 | $ python manage.py migrate --settings=homes.settings_local 26 | $ python manage.py loaddata api/fixtures/groups.json --settings=homes.settings_local 27 | $ python manage.py createsuperuser --settings=homes.settings_local 28 | $ python manage.py runserver --settings=homes.settings_local 29 | ``` 30 | 31 | Then head to http://localhost:8000/api/ in your browser to get started. 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help 23 | help: 24 | @echo "Please use \`make ' where is one of" 25 | @echo " html to make standalone HTML files" 26 | @echo " dirhtml to make HTML files named index.html in directories" 27 | @echo " singlehtml to make a single large HTML file" 28 | @echo " pickle to make pickle files" 29 | @echo " json to make JSON files" 30 | @echo " htmlhelp to make HTML files and a HTML help project" 31 | @echo " qthelp to make HTML files and a qthelp project" 32 | @echo " applehelp to make an Apple Help Book" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | @echo " coverage to run coverage check of the documentation (if enabled)" 49 | 50 | .PHONY: clean 51 | clean: 52 | rm -rf $(BUILDDIR)/* 53 | 54 | .PHONY: html 55 | html: 56 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 57 | @echo 58 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 59 | 60 | .PHONY: dirhtml 61 | dirhtml: 62 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 63 | @echo 64 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 65 | 66 | .PHONY: singlehtml 67 | singlehtml: 68 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 69 | @echo 70 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 71 | 72 | .PHONY: pickle 73 | pickle: 74 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 75 | @echo 76 | @echo "Build finished; now you can process the pickle files." 77 | 78 | .PHONY: json 79 | json: 80 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 81 | @echo 82 | @echo "Build finished; now you can process the JSON files." 83 | 84 | .PHONY: htmlhelp 85 | htmlhelp: 86 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 87 | @echo 88 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 89 | ".hhp project file in $(BUILDDIR)/htmlhelp." 90 | 91 | .PHONY: qthelp 92 | qthelp: 93 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 94 | @echo 95 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 96 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 97 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DataSkepticHousingDataAPI.qhcp" 98 | @echo "To view the help file:" 99 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DataSkepticHousingDataAPI.qhc" 100 | 101 | .PHONY: applehelp 102 | applehelp: 103 | $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp 104 | @echo 105 | @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." 106 | @echo "N.B. You won't be able to view it unless you put it in" \ 107 | "~/Library/Documentation/Help or install it in your application" \ 108 | "bundle." 109 | 110 | .PHONY: devhelp 111 | devhelp: 112 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 113 | @echo 114 | @echo "Build finished." 115 | @echo "To view the help file:" 116 | @echo "# mkdir -p $$HOME/.local/share/devhelp/DataSkepticHousingDataAPI" 117 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DataSkepticHousingDataAPI" 118 | @echo "# devhelp" 119 | 120 | .PHONY: epub 121 | epub: 122 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 123 | @echo 124 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 125 | 126 | .PHONY: latex 127 | latex: 128 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 129 | @echo 130 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 131 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 132 | "(use \`make latexpdf' here to do that automatically)." 133 | 134 | .PHONY: latexpdf 135 | latexpdf: 136 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 137 | @echo "Running LaTeX files through pdflatex..." 138 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 139 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 140 | 141 | .PHONY: latexpdfja 142 | latexpdfja: 143 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 144 | @echo "Running LaTeX files through platex and dvipdfmx..." 145 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 146 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 147 | 148 | .PHONY: text 149 | text: 150 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 151 | @echo 152 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 153 | 154 | .PHONY: man 155 | man: 156 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 157 | @echo 158 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 159 | 160 | .PHONY: texinfo 161 | texinfo: 162 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 163 | @echo 164 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 165 | @echo "Run \`make' in that directory to run these through makeinfo" \ 166 | "(use \`make info' here to do that automatically)." 167 | 168 | .PHONY: info 169 | info: 170 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 171 | @echo "Running Texinfo files through makeinfo..." 172 | make -C $(BUILDDIR)/texinfo info 173 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 174 | 175 | .PHONY: gettext 176 | gettext: 177 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 178 | @echo 179 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 180 | 181 | .PHONY: changes 182 | changes: 183 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 184 | @echo 185 | @echo "The overview file is in $(BUILDDIR)/changes." 186 | 187 | .PHONY: linkcheck 188 | linkcheck: 189 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 190 | @echo 191 | @echo "Link check complete; look for any errors in the above output " \ 192 | "or in $(BUILDDIR)/linkcheck/output.txt." 193 | 194 | .PHONY: doctest 195 | doctest: 196 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 197 | @echo "Testing of doctests in the sources finished, look at the " \ 198 | "results in $(BUILDDIR)/doctest/output.txt." 199 | 200 | .PHONY: coverage 201 | coverage: 202 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage 203 | @echo "Testing of coverage in the sources finished, look at the " \ 204 | "results in $(BUILDDIR)/coverage/python.txt." 205 | 206 | .PHONY: xml 207 | xml: 208 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 209 | @echo 210 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 211 | 212 | .PHONY: pseudoxml 213 | pseudoxml: 214 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 215 | @echo 216 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 217 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source 10 | set I18NSPHINXOPTS=%SPHINXOPTS% source 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | echo. coverage to run coverage check of the documentation if enabled 41 | goto end 42 | ) 43 | 44 | if "%1" == "clean" ( 45 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 46 | del /q /s %BUILDDIR%\* 47 | goto end 48 | ) 49 | 50 | 51 | REM Check if sphinx-build is available and fallback to Python version if any 52 | %SPHINXBUILD% 1>NUL 2>NUL 53 | if errorlevel 9009 goto sphinx_python 54 | goto sphinx_ok 55 | 56 | :sphinx_python 57 | 58 | set SPHINXBUILD=python -m sphinx.__init__ 59 | %SPHINXBUILD% 2> nul 60 | if errorlevel 9009 ( 61 | echo. 62 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 63 | echo.installed, then set the SPHINXBUILD environment variable to point 64 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 65 | echo.may add the Sphinx directory to PATH. 66 | echo. 67 | echo.If you don't have Sphinx installed, grab it from 68 | echo.http://sphinx-doc.org/ 69 | exit /b 1 70 | ) 71 | 72 | :sphinx_ok 73 | 74 | 75 | if "%1" == "html" ( 76 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 77 | if errorlevel 1 exit /b 1 78 | echo. 79 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 80 | goto end 81 | ) 82 | 83 | if "%1" == "dirhtml" ( 84 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 85 | if errorlevel 1 exit /b 1 86 | echo. 87 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 88 | goto end 89 | ) 90 | 91 | if "%1" == "singlehtml" ( 92 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 93 | if errorlevel 1 exit /b 1 94 | echo. 95 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 96 | goto end 97 | ) 98 | 99 | if "%1" == "pickle" ( 100 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 101 | if errorlevel 1 exit /b 1 102 | echo. 103 | echo.Build finished; now you can process the pickle files. 104 | goto end 105 | ) 106 | 107 | if "%1" == "json" ( 108 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 109 | if errorlevel 1 exit /b 1 110 | echo. 111 | echo.Build finished; now you can process the JSON files. 112 | goto end 113 | ) 114 | 115 | if "%1" == "htmlhelp" ( 116 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 117 | if errorlevel 1 exit /b 1 118 | echo. 119 | echo.Build finished; now you can run HTML Help Workshop with the ^ 120 | .hhp project file in %BUILDDIR%/htmlhelp. 121 | goto end 122 | ) 123 | 124 | if "%1" == "qthelp" ( 125 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 129 | .qhcp project file in %BUILDDIR%/qthelp, like this: 130 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\DataSkepticHousingDataAPI.qhcp 131 | echo.To view the help file: 132 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\DataSkepticHousingDataAPI.ghc 133 | goto end 134 | ) 135 | 136 | if "%1" == "devhelp" ( 137 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 138 | if errorlevel 1 exit /b 1 139 | echo. 140 | echo.Build finished. 141 | goto end 142 | ) 143 | 144 | if "%1" == "epub" ( 145 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 146 | if errorlevel 1 exit /b 1 147 | echo. 148 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 149 | goto end 150 | ) 151 | 152 | if "%1" == "latex" ( 153 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 154 | if errorlevel 1 exit /b 1 155 | echo. 156 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 157 | goto end 158 | ) 159 | 160 | if "%1" == "latexpdf" ( 161 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 162 | cd %BUILDDIR%/latex 163 | make all-pdf 164 | cd %~dp0 165 | echo. 166 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 167 | goto end 168 | ) 169 | 170 | if "%1" == "latexpdfja" ( 171 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 172 | cd %BUILDDIR%/latex 173 | make all-pdf-ja 174 | cd %~dp0 175 | echo. 176 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 177 | goto end 178 | ) 179 | 180 | if "%1" == "text" ( 181 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 182 | if errorlevel 1 exit /b 1 183 | echo. 184 | echo.Build finished. The text files are in %BUILDDIR%/text. 185 | goto end 186 | ) 187 | 188 | if "%1" == "man" ( 189 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 190 | if errorlevel 1 exit /b 1 191 | echo. 192 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 193 | goto end 194 | ) 195 | 196 | if "%1" == "texinfo" ( 197 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 198 | if errorlevel 1 exit /b 1 199 | echo. 200 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 201 | goto end 202 | ) 203 | 204 | if "%1" == "gettext" ( 205 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 206 | if errorlevel 1 exit /b 1 207 | echo. 208 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 209 | goto end 210 | ) 211 | 212 | if "%1" == "changes" ( 213 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 214 | if errorlevel 1 exit /b 1 215 | echo. 216 | echo.The overview file is in %BUILDDIR%/changes. 217 | goto end 218 | ) 219 | 220 | if "%1" == "linkcheck" ( 221 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 222 | if errorlevel 1 exit /b 1 223 | echo. 224 | echo.Link check complete; look for any errors in the above output ^ 225 | or in %BUILDDIR%/linkcheck/output.txt. 226 | goto end 227 | ) 228 | 229 | if "%1" == "doctest" ( 230 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 231 | if errorlevel 1 exit /b 1 232 | echo. 233 | echo.Testing of doctests in the sources finished, look at the ^ 234 | results in %BUILDDIR%/doctest/output.txt. 235 | goto end 236 | ) 237 | 238 | if "%1" == "coverage" ( 239 | %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage 240 | if errorlevel 1 exit /b 1 241 | echo. 242 | echo.Testing of coverage in the sources finished, look at the ^ 243 | results in %BUILDDIR%/coverage/python.txt. 244 | goto end 245 | ) 246 | 247 | if "%1" == "xml" ( 248 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 249 | if errorlevel 1 exit /b 1 250 | echo. 251 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 252 | goto end 253 | ) 254 | 255 | if "%1" == "pseudoxml" ( 256 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 257 | if errorlevel 1 exit /b 1 258 | echo. 259 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 260 | goto end 261 | ) 262 | 263 | :end 264 | -------------------------------------------------------------------------------- /docs/source/api.rst: -------------------------------------------------------------------------------- 1 | Using at API to push data 2 | ========================= 3 | 4 | Disclaimer 5 | ^^^^^^^^^^ 6 | When finding data to push to the API you should take into consideration the laws 7 | and terms of service relating to the origin of that data. We do not condone or 8 | recommend scraping sites which forbid such practices. 9 | 10 | By pushing data to this API you agree that it was obtained lawfully and you have 11 | the needed permission to do so. 12 | 13 | Tools 14 | ^^^^^ 15 | This guide displays syntax for pushing data using the command line tool `curl`, 16 | data can also be added using the html interface found at: https://home-sales-data-api.herokuapp.com/ 17 | 18 | Endpoints 19 | ========= 20 | 21 | Admin 22 | ^^^^^ 23 | All current endpoints are public to GET requests but require a token for any 24 | POST requests. This system utilises JSON Web Tokens (JWTs) for authentication. 25 | There are three main endpoints for getting, refreshing and verifying a web token. 26 | 27 | Tokens are valid for a period of 5 minuets (300 seconds). A token can be refreshed 28 | any time in the 7 day period after it was issued or last refreshed. Once this 29 | period has passed a new token must be obtained from the `/token/auth/` endpoint. 30 | 31 | Getting a token - `/token/auth/` 32 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 | To get a new token post your username and password to the `/token/auth` endpoint. 34 | If you are hosting a copy of this API yourself you should try and ensure you use 35 | a https connection so the data is not sent in plain text.:: 36 | 37 | $ curl -X POST -H "Content-Type: application/json" \ 38 | -d '{"username":"", "password":""}' 39 | { 40 | "token": "" 41 | } 42 | 43 | You can now use this token with other requests by adding the header `Authorization: Bearer `. 44 | 45 | Refreshing a token - `/token/refresh/` 46 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 47 | Once a token has expired it can be renewed for a new token by posting to the 48 | `/token/refresh/` endpoint.:: 49 | 50 | $ curl -X POST -H "Content-Type: application/json" \ 51 | -d '{"token": ""}' 52 | { 53 | "token": "" 54 | } 55 | 56 | Verifying a token - `/token/verify/` 57 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 58 | To check if a token has expired you can post to the `/token/verify/` endpoint. 59 | If your token is still valid the server will return a `200 OK` status. If the 60 | token has expired a `400 BAD REQUEST` will be returned instead.:: 61 | 62 | $ curl -X POST -H "Content-Type: application/json" \ 63 | -d '{"token": ""}' 64 | 65 | Properties 66 | ^^^^^^^^^^ 67 | Available at: `/api/property` 68 | 69 | This endpoint reads and writes :class:`api.models.Property` objects. Data should 70 | be correctly formatted JSON. If you wish to add `Features` to a property you will 71 | need to determine the feature ID ahead of time. The HTML interface takes care of 72 | this using a populated combo box. We are investigating ways to make this process 73 | easier for those posting from scripts or the command line. 74 | 75 | First an example of getting data from the API (the JSON has been formatted for 76 | readability):: 77 | 78 | $ curl https://home-sales-data-api.herokuapp.com/api/property/ 79 | [{ 80 | "id":1, 81 | "upload_timestamp":"2016-04-01T04:50:26.234865Z", 82 | "listing_timestamp":"2016-04-01T00:30:00Z", 83 | "listing_type":"F", 84 | "price":123456.0, 85 | "bedrooms":1.0, 86 | "bathrooms":2.0, 87 | "car_spaces":1.0, 88 | "building_size":150.0, 89 | "land_size":150.0, 90 | "size_units":"M", 91 | "raw_address":"100 Main street new york", 92 | "geocoded_address":"100 Main St, Flushing, NY 11354, USA", 93 | "features":[1] 94 | }] 95 | 96 | 97 | Features 98 | ^^^^^^^^ 99 | Available at: `/api/feature` 100 | 101 | This endpoint reads and writes :class:`api.models.Feature` objects. These are 102 | simple objects you can think of like tags. Each object has two properties, a 103 | `category` and a `tag`. The `category` is typically used to group similar features 104 | by things like their location. For example `Outdoor` is a category which may 105 | contain a group of outdoor features. `tag` is the actual feature within that 106 | category for example a swimming pool may have the `category` Outdoor and the `tag` 107 | Pool. 108 | 109 | Currently these objects can be written by anyone but this may change in the future 110 | in an effort to keep the number of tags under control. Features will also be given 111 | a `value` field in a future release to allow some metric information to be paired 112 | with the feature. The exact setup of this is undetermined at this point. 113 | 114 | 115 | Reading the feature list is similar to the Property list above:: 116 | 117 | $ curl https://home-sales-data-api.herokuapp.com/api/feature/ 118 | [{ 119 | "id":1, 120 | "category":"Outdoor", 121 | "tag":"Pool" 122 | }] 123 | 124 | 125 | The `id` field returned with each object is what should be passed on the creation 126 | of :class:`api.models.Property` objects through the `Property` endpoint. 127 | 128 | Creating a new feature is performed with a `POST` request to the endpoint. *See 129 | the note above about the future of this option.*:: 130 | 131 | $ curl -X POST -H 'Content-Type: application/json' \ 132 | -H 'Authorization: Bearer ' 133 | -d '{"category":"Outdoor", "tag":"Garden"}' \ 134 | https://home-sales-data-api.herokuapp.com/api/feature/ 135 | { 136 | "id":2, 137 | "category":"Outdoor", 138 | "tag":"Garden" 139 | } 140 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Data Skeptic Housing Data API documentation build configuration file, created by 5 | # sphinx-quickstart on Thu Mar 24 14:53:24 2016. 6 | # 7 | # This file is execfile()d with the current directory set to its 8 | # containing dir. 9 | # 10 | # Note that not all possible configuration values are present in this 11 | # autogenerated file. 12 | # 13 | # All configuration values have a default; values that are commented out 14 | # serve to show the default. 15 | 16 | import sys 17 | import os 18 | 19 | # If extensions (or modules to document with autodoc) are in another directory, 20 | # add these directories to sys.path here. If the directory is relative to the 21 | # documentation root, use os.path.abspath to make it absolute, like shown here. 22 | #sys.path.insert(0, os.path.abspath('.')) 23 | sys.path.insert(0, os.path.abspath('../../homes')) 24 | 25 | from django.conf import settings 26 | import django 27 | 28 | os.environ['DJANGO_SETTINGS_MODULE'] = 'homes.settings' 29 | os.environ['DJANGO_SECRET_KEY'] = 'docskey' 30 | django.setup() 31 | 32 | # -- General configuration ------------------------------------------------ 33 | 34 | # If your documentation needs a minimal Sphinx version, state it here. 35 | #needs_sphinx = '1.0' 36 | 37 | # Add any Sphinx extension module names here, as strings. They can be 38 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 39 | # ones. 40 | extensions = [ 41 | 'sphinx.ext.autodoc', 42 | ] 43 | 44 | # Add any paths that contain templates here, relative to this directory. 45 | templates_path = ['_templates'] 46 | 47 | # The suffix(es) of source filenames. 48 | # You can specify multiple suffix as a list of string: 49 | # source_suffix = ['.rst', '.md'] 50 | source_suffix = '.rst' 51 | 52 | # The encoding of source files. 53 | #source_encoding = 'utf-8-sig' 54 | 55 | # The master toctree document. 56 | master_doc = 'index' 57 | 58 | # General information about the project. 59 | project = 'Data Skeptic Housing Data API' 60 | copyright = '2016, Data Skeptic' 61 | author = 'Elliot Smith' 62 | 63 | # The version info for the project you're documenting, acts as replacement for 64 | # |version| and |release|, also used in various other places throughout the 65 | # built documents. 66 | # 67 | # The short X.Y version. 68 | version = '0.1' 69 | # The full version, including alpha/beta/rc tags. 70 | release = '0.1.1' 71 | 72 | # The language for content autogenerated by Sphinx. Refer to documentation 73 | # for a list of supported languages. 74 | # 75 | # This is also used if you do content translation via gettext catalogs. 76 | # Usually you set "language" from the command line for these cases. 77 | language = None 78 | 79 | # There are two options for replacing |today|: either, you set today to some 80 | # non-false value, then it is used: 81 | #today = '' 82 | # Else, today_fmt is used as the format for a strftime call. 83 | #today_fmt = '%B %d, %Y' 84 | 85 | # List of patterns, relative to source directory, that match files and 86 | # directories to ignore when looking for source files. 87 | exclude_patterns = [] 88 | 89 | # The reST default role (used for this markup: `text`) to use for all 90 | # documents. 91 | #default_role = None 92 | 93 | # If true, '()' will be appended to :func: etc. cross-reference text. 94 | #add_function_parentheses = True 95 | 96 | # If true, the current module name will be prepended to all description 97 | # unit titles (such as .. function::). 98 | #add_module_names = True 99 | 100 | # If true, sectionauthor and moduleauthor directives will be shown in the 101 | # output. They are ignored by default. 102 | #show_authors = False 103 | 104 | # The name of the Pygments (syntax highlighting) style to use. 105 | pygments_style = 'sphinx' 106 | 107 | # A list of ignored prefixes for module index sorting. 108 | #modindex_common_prefix = [] 109 | 110 | # If true, keep warnings as "system message" paragraphs in the built documents. 111 | #keep_warnings = False 112 | 113 | # If true, `todo` and `todoList` produce output, else they produce nothing. 114 | todo_include_todos = False 115 | 116 | 117 | # -- Options for HTML output ---------------------------------------------- 118 | 119 | # The theme to use for HTML and HTML Help pages. See the documentation for 120 | # a list of builtin themes. 121 | html_theme = 'alabaster' 122 | 123 | # Theme options are theme-specific and customize the look and feel of a theme 124 | # further. For a list of options available for each theme, see the 125 | # documentation. 126 | #html_theme_options = {} 127 | 128 | # Add any paths that contain custom themes here, relative to this directory. 129 | #html_theme_path = [] 130 | 131 | # The name for this set of Sphinx documents. If None, it defaults to 132 | # " v documentation". 133 | #html_title = None 134 | 135 | # A shorter title for the navigation bar. Default is the same as html_title. 136 | #html_short_title = None 137 | 138 | # The name of an image file (relative to this directory) to place at the top 139 | # of the sidebar. 140 | #html_logo = None 141 | 142 | # The name of an image file (relative to this directory) to use as a favicon of 143 | # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 144 | # pixels large. 145 | #html_favicon = None 146 | 147 | # Add any paths that contain custom static files (such as style sheets) here, 148 | # relative to this directory. They are copied after the builtin static files, 149 | # so a file named "default.css" will overwrite the builtin "default.css". 150 | html_static_path = ['_static'] 151 | 152 | # Add any extra paths that contain custom files (such as robots.txt or 153 | # .htaccess) here, relative to this directory. These files are copied 154 | # directly to the root of the documentation. 155 | #html_extra_path = [] 156 | 157 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 158 | # using the given strftime format. 159 | #html_last_updated_fmt = '%b %d, %Y' 160 | 161 | # If true, SmartyPants will be used to convert quotes and dashes to 162 | # typographically correct entities. 163 | #html_use_smartypants = True 164 | 165 | # Custom sidebar templates, maps document names to template names. 166 | #html_sidebars = {} 167 | 168 | # Additional templates that should be rendered to pages, maps page names to 169 | # template names. 170 | #html_additional_pages = {} 171 | 172 | # If false, no module index is generated. 173 | #html_domain_indices = True 174 | 175 | # If false, no index is generated. 176 | #html_use_index = True 177 | 178 | # If true, the index is split into individual pages for each letter. 179 | #html_split_index = False 180 | 181 | # If true, links to the reST sources are added to the pages. 182 | #html_show_sourcelink = True 183 | 184 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 185 | #html_show_sphinx = True 186 | 187 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 188 | #html_show_copyright = True 189 | 190 | # If true, an OpenSearch description file will be output, and all pages will 191 | # contain a tag referring to it. The value of this option must be the 192 | # base URL from which the finished HTML is served. 193 | #html_use_opensearch = '' 194 | 195 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 196 | #html_file_suffix = None 197 | 198 | # Language to be used for generating the HTML full-text search index. 199 | # Sphinx supports the following languages: 200 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' 201 | # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' 202 | #html_search_language = 'en' 203 | 204 | # A dictionary with options for the search language support, empty by default. 205 | # Now only 'ja' uses this config value 206 | #html_search_options = {'type': 'default'} 207 | 208 | # The name of a javascript file (relative to the configuration directory) that 209 | # implements a search results scorer. If empty, the default will be used. 210 | #html_search_scorer = 'scorer.js' 211 | 212 | # Output file base name for HTML help builder. 213 | htmlhelp_basename = 'DataSkepticHousingDataAPIdoc' 214 | 215 | # -- Options for LaTeX output --------------------------------------------- 216 | 217 | latex_elements = { 218 | # The paper size ('letterpaper' or 'a4paper'). 219 | #'papersize': 'letterpaper', 220 | 221 | # The font size ('10pt', '11pt' or '12pt'). 222 | #'pointsize': '10pt', 223 | 224 | # Additional stuff for the LaTeX preamble. 225 | #'preamble': '', 226 | 227 | # Latex figure (float) alignment 228 | #'figure_align': 'htbp', 229 | } 230 | 231 | # Grouping the document tree into LaTeX files. List of tuples 232 | # (source start file, target name, title, 233 | # author, documentclass [howto, manual, or own class]). 234 | latex_documents = [ 235 | (master_doc, 'DataSkepticHousingDataAPI.tex', 'Data Skeptic Housing Data API Documentation', 236 | 'Elliot Smith', 'manual'), 237 | ] 238 | 239 | # The name of an image file (relative to this directory) to place at the top of 240 | # the title page. 241 | #latex_logo = None 242 | 243 | # For "manual" documents, if this is true, then toplevel headings are parts, 244 | # not chapters. 245 | #latex_use_parts = False 246 | 247 | # If true, show page references after internal links. 248 | #latex_show_pagerefs = False 249 | 250 | # If true, show URL addresses after external links. 251 | #latex_show_urls = False 252 | 253 | # Documents to append as an appendix to all manuals. 254 | #latex_appendices = [] 255 | 256 | # If false, no module index is generated. 257 | #latex_domain_indices = True 258 | 259 | 260 | # -- Options for manual page output --------------------------------------- 261 | 262 | # One entry per manual page. List of tuples 263 | # (source start file, name, description, authors, manual section). 264 | man_pages = [ 265 | (master_doc, 'dataskeptichousingdataapi', 'Data Skeptic Housing Data API Documentation', 266 | [author], 1) 267 | ] 268 | 269 | # If true, show URL addresses after external links. 270 | #man_show_urls = False 271 | 272 | 273 | # -- Options for Texinfo output ------------------------------------------- 274 | 275 | # Grouping the document tree into Texinfo files. List of tuples 276 | # (source start file, target name, title, author, 277 | # dir menu entry, description, category) 278 | texinfo_documents = [ 279 | (master_doc, 'DataSkepticHousingDataAPI', 'Data Skeptic Housing Data API Documentation', 280 | author, 'DataSkepticHousingDataAPI', 'One line description of project.', 281 | 'Miscellaneous'), 282 | ] 283 | 284 | # Documents to append as an appendix to all manuals. 285 | #texinfo_appendices = [] 286 | 287 | # If false, no module index is generated. 288 | #texinfo_domain_indices = True 289 | 290 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 291 | #texinfo_show_urls = 'footnote' 292 | 293 | # If true, do not generate a @detailmenu in the "Top" node's menu. 294 | #texinfo_no_detailmenu = False 295 | -------------------------------------------------------------------------------- /docs/source/contributing.rst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-skeptic/home-data-api/a16d9f268dd2e10d978f1ee628e7bc86fb569a3d/docs/source/contributing.rst -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Data Skeptic Housing API Documentation. 2 | ======================================= 3 | 4 | Contents: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | api 10 | contributing 11 | 12 | modules/models 13 | modules/views 14 | modules/filters 15 | 16 | 17 | 18 | Indices and tables 19 | ================== 20 | 21 | * :ref:`genindex` 22 | * :ref:`modindex` 23 | * :ref:`search` 24 | 25 | -------------------------------------------------------------------------------- /docs/source/modules/filters.rst: -------------------------------------------------------------------------------- 1 | Filters 2 | ======= 3 | The following documentation is automatically generated from the source and its 4 | comments. 5 | 6 | .. automodule:: api.filters 7 | :members: 8 | -------------------------------------------------------------------------------- /docs/source/modules/models.rst: -------------------------------------------------------------------------------- 1 | Models 2 | ====== 3 | The following documentation is automatically generated from the source and its 4 | comments. 5 | 6 | .. automodule:: api.models 7 | :members: 8 | -------------------------------------------------------------------------------- /docs/source/modules/views.rst: -------------------------------------------------------------------------------- 1 | Views 2 | ===== 3 | The following documentation is automatically generated from the source and its 4 | comments. 5 | 6 | .. automodule:: api.views 7 | :members: 8 | -------------------------------------------------------------------------------- /homes/.travis.yaml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - 3.4 4 | - 3.5 5 | 6 | install: 7 | - pip install -r requirements.txt 8 | - pip install coveralls 9 | script: 10 | - cd ./homes 11 | - python manage.py test 12 | - coverage run --source=api manage.py test 13 | after_success: 14 | - coveralls 15 | -------------------------------------------------------------------------------- /homes/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-skeptic/home-data-api/a16d9f268dd2e10d978f1ee628e7bc86fb569a3d/homes/api/__init__.py -------------------------------------------------------------------------------- /homes/api/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from api.models import (Property, Feature, Flag, Resolution, Profile) 3 | 4 | admin.site.register(Property) 5 | admin.site.register(Feature) 6 | admin.site.register(Flag) 7 | admin.site.register(Resolution) 8 | admin.site.register(Profile) 9 | -------------------------------------------------------------------------------- /homes/api/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ApiConfig(AppConfig): 5 | name = 'api' 6 | -------------------------------------------------------------------------------- /homes/api/filters.py: -------------------------------------------------------------------------------- 1 | import django_filters 2 | import math 3 | from api.models import Property, Feature 4 | from rest_framework import filters 5 | from ast import literal_eval as make_tuple 6 | from django.db.models import F 7 | 8 | class PropertyFilter(filters.FilterSet): 9 | """Filters used for the Property model. 10 | 11 | Filters are added to a request as query parameters. For example the follwoing 12 | request will filter based on the minimum hosue price. 13 | 14 | `/api/property?min_price=100000` 15 | 16 | while not an explicit attribute of this class the `features` property can 17 | also be filtered on by suppluing a list of the feature ids. For example: 18 | 19 | `/api/property?features=1` 20 | 21 | 22 | Attributes: 23 | min_price: Supplying this filter returns only properties with a price 24 | greater than or equal to the supplied value. 25 | 26 | max_price: Supplying this filter returns only properties with a price 27 | less than or equal to the supplied value. 28 | 29 | min_bedrooms: Supplying this filter returns only properties which have 30 | a number of bedrooms greater than or equal to the supplied value. 31 | 32 | max_bedrooms: Supplying this filter returns only properties which have 33 | a number of bedrooms less than or equal to the supplied value. 34 | 35 | min_bathrooms: Supplying this filter returns only properties which have 36 | a number of bathrooms greater than or equal to the supplied value. 37 | 38 | max_bathrooms: Supplying this filter returns only properties which have 39 | a number of bathrooms less than or equal to the supplied value. 40 | 41 | min_car_spaces: Supplying this filter returns only properties which have 42 | a number of car spaces greater than or equal to the supplied value. 43 | 44 | max_car_spaces: Supplying this filter returns only properties which have 45 | a number of car_spaces less than or equal to the supplied value. 46 | 47 | address_contains: Supplying this filter will return only properties which 48 | contain the supplied text in their geocded address. 49 | 50 | """ 51 | 52 | min_price = django_filters.NumberFilter(name="price", lookup_type="gte") 53 | max_price = django_filters.NumberFilter(name="price", lookup_type="lte") 54 | 55 | min_bedrooms = django_filters.NumberFilter(name="bedrooms", lookup_type="gte") 56 | max_bedrooms = django_filters.NumberFilter(name="bedrooms", lookup_type="lte") 57 | 58 | min_bathrooms = django_filters.NumberFilter(name="bathrooms", lookup_type="gte") 59 | max_bathrooms = django_filters.NumberFilter(name="bathrooms", lookup_type="lte") 60 | 61 | min_car_spaces = django_filters.NumberFilter(name="car_spaces", lookup_type="gte") 62 | max_car_spaces = django_filters.NumberFilter(name="car_spaces", lookup_type="lte") 63 | 64 | close_to = django_filters.MethodFilter(action='filter_approx_distance') 65 | 66 | class Meta: 67 | model = Property 68 | fields = ["min_price", "max_price", "min_bedrooms", "max_bedrooms", 69 | "min_bathrooms", "max_bathrooms", "min_car_spaces", "max_car_spaces", 70 | "features", "close_to"] 71 | 72 | 73 | def filter_approx_distance(self, queryset, value): 74 | """ Filters all results who's address object has a lat long approximatly value[0] from value[1] 75 | """ 76 | # Assume value is in the form (distance, lat, long) 77 | try: 78 | vals = make_tuple(value) 79 | except: 80 | # if something bad happened just fallabck to not working for now 81 | return queryset 82 | 83 | # remove queryset objects tha have no address 84 | queryset = queryset.filter(address_object__isnull=False) 85 | 86 | pi = 3.1415 87 | f_lat = pi*(vals[1] - F('address_object__latitude'))/180.0 88 | f_long = pi*(vals[2] - F('address_object__longitude'))/180.0 89 | m_lat = 0.5*pi*(vals[1] + F('address_object__latitude'))/180.0 90 | cosprox = 1 - (m_lat**2)/2.0 # approximate cosine 91 | 92 | approx_dist = (6371**2)*(f_lat**2 + (cosprox*f_long)**2) 93 | 94 | queryset = queryset.annotate(dist=(approx_dist - vals[0]**2)).annotate(flat=f_lat) 95 | queryset = queryset.filter(dist__lte=0) 96 | 97 | return queryset 98 | -------------------------------------------------------------------------------- /homes/api/fixtures/groups.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "auth.group", 4 | "pk": 1, 5 | "fields": { 6 | "name": "flagging", 7 | "permissions": [ 8 | [ 9 | "add_flag", 10 | "api", 11 | "flag" 12 | ], 13 | [ 14 | "change_flag", 15 | "api", 16 | "flag" 17 | ], 18 | [ 19 | "delete_flag", 20 | "api", 21 | "flag" 22 | ] 23 | ] 24 | } 25 | }, 26 | { 27 | "model": "auth.group", 28 | "pk": 2, 29 | "fields": { 30 | "name": "pushing", 31 | "permissions": [ 32 | [ 33 | "add_feature", 34 | "api", 35 | "feature" 36 | ], 37 | [ 38 | "add_property", 39 | "api", 40 | "property" 41 | ], 42 | [ 43 | "add_address", 44 | "api", 45 | "address" 46 | ] 47 | ] 48 | } 49 | } 50 | ] 51 | 52 | -------------------------------------------------------------------------------- /homes/api/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.1 on 2016-03-09 04:36 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='SimpleProperty', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('address', models.CharField(max_length=512)), 21 | ('bedrooms', models.FloatField()), 22 | ('bathrooms', models.FloatField()), 23 | ('price', models.FloatField()), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /homes/api/migrations/0002_property.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-03-10 10:07 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Property', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('upload_timestamp', models.DateTimeField(auto_now=True)), 20 | ('listing_timestamp', models.DateTimeField()), 21 | ('listing_type', models.CharField(choices=[('F', 'For Sale'), ('S', 'Sold')], max_length=1)), 22 | ('price', models.FloatField()), 23 | ('bedrooms', models.FloatField(blank=True, null=True)), 24 | ('bathrooms', models.FloatField(blank=True, null=True)), 25 | ('car_spaces', models.FloatField(blank=True, null=True)), 26 | ('building_size', models.FloatField(blank=True, null=True)), 27 | ('land_size', models.FloatField(blank=True, null=True)), 28 | ('size_units', models.CharField(choices=[('M', 'metric'), ('I', 'imperial')], max_length=1)), 29 | ('raw_address', models.CharField(max_length=512)), 30 | ('geocoded_address', models.CharField(max_length=512)), 31 | ], 32 | ), 33 | ] 34 | -------------------------------------------------------------------------------- /homes/api/migrations/0003_auto_20160311_0305.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-03-11 03:05 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0002_property'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Feature', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('category', models.CharField(max_length=100)), 20 | ('tag', models.CharField(max_length=100)), 21 | ], 22 | ), 23 | migrations.AddField( 24 | model_name='property', 25 | name='features', 26 | field=models.ManyToManyField(blank=True, to='api.Feature'), 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /homes/api/migrations/0004_delete_simpleproperty.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-04-01 03:32 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0003_auto_20160311_0305'), 12 | ] 13 | 14 | operations = [ 15 | migrations.DeleteModel( 16 | name='SimpleProperty', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /homes/api/migrations/0005_auto_20160417_1125.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-04-17 11:25 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('api', '0004_delete_simpleproperty'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Flag', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('flag_type', models.CharField(choices=[('E', 'exact duplicate'), ('S', 'merge candidate')], max_length=1)), 23 | ('is_open', models.BooleanField(default=True)), 24 | ('date_submitted', models.DateTimeField(auto_now=True)), 25 | ], 26 | ), 27 | migrations.CreateModel( 28 | name='Resolution', 29 | fields=[ 30 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 31 | ('date_resolved', models.DateTimeField(auto_now=True)), 32 | ('note', models.CharField(blank=True, max_length=512, null=True)), 33 | ], 34 | ), 35 | migrations.AddField( 36 | model_name='property', 37 | name='submitter', 38 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 39 | ), 40 | migrations.AddField( 41 | model_name='property', 42 | name='valid', 43 | field=models.BooleanField(default=False), 44 | ), 45 | migrations.AddField( 46 | model_name='resolution', 47 | name='final_object', 48 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Property'), 49 | ), 50 | migrations.AddField( 51 | model_name='resolution', 52 | name='flag', 53 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Flag'), 54 | ), 55 | migrations.AddField( 56 | model_name='resolution', 57 | name='resolver', 58 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 59 | ), 60 | migrations.AddField( 61 | model_name='flag', 62 | name='first_object', 63 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='first', to='api.Property'), 64 | ), 65 | migrations.AddField( 66 | model_name='flag', 67 | name='second_object', 68 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='second', to='api.Property'), 69 | ), 70 | migrations.AddField( 71 | model_name='flag', 72 | name='submitter', 73 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 74 | ), 75 | ] 76 | -------------------------------------------------------------------------------- /homes/api/migrations/0006_auto_20160418_0013.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-04-18 00:13 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0005_auto_20160417_1125'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='property', 17 | name='valid', 18 | field=models.BooleanField(default=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /homes/api/migrations/0007_auto_20160504_0006.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-05-04 00:06 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0006_auto_20160418_0013'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='property', 17 | name='listing_type', 18 | field=models.CharField(choices=[('F', 'For Sale'), ('S', 'Sold'), ('A', 'Appraised')], max_length=1), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /homes/api/migrations/0008_profile.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-05-10 10:44 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('api', '0007_auto_20160504_0006'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Profile', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('confirmed', models.BooleanField(default=False)), 23 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /homes/api/migrations/0009_auto_20160511_0148.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-05-11 01:48 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0008_profile'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='property', 17 | name='geocoded_address', 18 | field=models.CharField(blank=True, max_length=512, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /homes/api/migrations/0010_auto_20160516_0438.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-05-16 04:38 3 | from __future__ import unicode_literals 4 | 5 | import datetime 6 | from django.db import migrations, models 7 | from django.utils.timezone import utc 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | ('api', '0009_auto_20160511_0148'), 14 | ] 15 | 16 | operations = [ 17 | migrations.AddField( 18 | model_name='profile', 19 | name='confirmation_code', 20 | field=models.CharField(default='', max_length=512), 21 | preserve_default=False, 22 | ), 23 | migrations.AddField( 24 | model_name='profile', 25 | name='confirmation_date', 26 | field=models.DateTimeField(auto_now=True, default=datetime.datetime(2016, 5, 16, 4, 38, 59, 334254, tzinfo=utc)), 27 | preserve_default=False, 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /homes/api/migrations/0011_auto_20160621_1136.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-06-21 11:36 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('api', '0010_auto_20160516_0438'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Address', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('raw', models.CharField(max_length=2048)), 21 | ('subpremise', models.IntegerField(blank=True, null=True)), 22 | ('street_number', models.IntegerField()), 23 | ('route', models.CharField(max_length=512)), 24 | ('locality', models.CharField(max_length=512)), 25 | ('area_level_2', models.CharField(max_length=512)), 26 | ('area_level_1', models.CharField(max_length=512)), 27 | ('country', models.CharField(max_length=128)), 28 | ('postal_code', models.CharField(max_length=50)), 29 | ('formatted_address', models.CharField(max_length=1000)), 30 | ('latitude', models.FloatField()), 31 | ('longitude', models.FloatField()), 32 | ], 33 | ), 34 | migrations.RemoveField( 35 | model_name='property', 36 | name='geocoded_address', 37 | ), 38 | migrations.AddField( 39 | model_name='property', 40 | name='address_object', 41 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Address'), 42 | ), 43 | ] 44 | -------------------------------------------------------------------------------- /homes/api/migrations/0012_auto_20160622_0700.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.4 on 2016-06-22 07:00 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('api', '0011_auto_20160621_1136'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='address', 17 | name='formatted_address', 18 | field=models.TextField(), 19 | ), 20 | migrations.AlterField( 21 | model_name='address', 22 | name='raw', 23 | field=models.TextField(), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /homes/api/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-skeptic/home-data-api/a16d9f268dd2e10d978f1ee628e7bc86fb569a3d/homes/api/migrations/__init__.py -------------------------------------------------------------------------------- /homes/api/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from geopy.geocoders import GoogleV3 3 | from django.conf import settings 4 | from django.db.models.signals import post_save 5 | from django.dispatch import receiver 6 | from django.utils import timezone 7 | from api.util import send_signup_email 8 | import datetime 9 | import random 10 | import string 11 | import requests 12 | 13 | FOR_SALE = 'F' 14 | SOLD = 'S' 15 | APPRAISED = 'A' 16 | LISTING_OPTIONS = ((FOR_SALE, 'For Sale'), (SOLD, 'Sold'), (APPRAISED, 'Appraised')) 17 | 18 | METRIC = 'M' 19 | IMPERIAL = 'I' 20 | UNITS_OPTIONS = ((METRIC, 'metric'), (IMPERIAL, 'imperial')) 21 | 22 | FLAG_EXACT = 'E' 23 | FLAG_SIMILAR = 'S' 24 | FLAG_OPTIONS = ((FLAG_EXACT, 'exact duplicate'), (FLAG_SIMILAR, 'merge candidate')) 25 | 26 | class Profile(models.Model): 27 | """ Profile object to store extended data about the user. 28 | """ 29 | user = models.OneToOneField(settings.AUTH_USER_MODEL, 30 | on_delete=models.CASCADE) 31 | confirmed = models.BooleanField(default=False) 32 | 33 | confirmation_code = models.CharField(max_length=512) 34 | confirmation_date = models.DateTimeField(auto_now=True) 35 | 36 | def update_code(self): 37 | """Generate a new email confirmation code. 38 | """ 39 | self.confirmation_code = ''.join([random.choice(string.ascii_uppercase) 40 | for _ in range(254)]) 41 | self.confirmation_date = timezone.now() 42 | self.save() 43 | 44 | def get_confirmation_link(self): 45 | """Generate a url for confirming the account. 46 | 47 | This generates the relative uri and should be appended to the hostname. 48 | """ 49 | return "/confirm/" + str(self.pk) + "/" + self.confirmation_code + "/" 50 | 51 | def can_confirm(self): 52 | """Can the user be confirmed? 53 | 54 | return true if the user is unconfirmed and the code is still valid 55 | """ 56 | return (not self.confirmed) and (timezone.now() < self.confirmation_date + datetime.timedelta(days=2)) 57 | 58 | 59 | @receiver(post_save, sender=settings.AUTH_USER_MODEL) 60 | def create_profile(sender, instance, **kwargs): 61 | new_account = False 62 | if kwargs['created']: 63 | profile = Profile.objects.create(user=instance) 64 | new_account = True 65 | else: 66 | profile = Profile.objects.filter(user=instance) 67 | if len(profile) == 0: 68 | profile = Profile.objects.create(user=instance) 69 | new_account = True 70 | 71 | if new_account: 72 | profile.update_code() 73 | link_text = settings.HOSTNAME + profile.get_confirmation_link() 74 | if not settings.TESTING: 75 | send_signup_email(instance.email, link_text) 76 | 77 | 78 | class Address(models.Model): 79 | raw = models.TextField() 80 | subpremise = models.IntegerField(null=True, blank=True) 81 | street_number = models.IntegerField() 82 | route = models.CharField(max_length=512) 83 | locality = models.CharField(max_length=512) 84 | area_level_2 = models.CharField(max_length=512) 85 | area_level_1 = models.CharField(max_length=512) 86 | country = models.CharField(max_length=128) 87 | postal_code = models.CharField(max_length=50) 88 | formatted_address = models.TextField() 89 | latitude = models.FloatField() 90 | longitude = models.FloatField() 91 | 92 | 93 | def from_google_json(self, json): 94 | json = json['results'][0] 95 | for part in json['address_components']: 96 | if 'subpremise' in part['types']: 97 | self.subpremise = part['long_name'] 98 | continue 99 | if 'street_number' in part['types']: 100 | self.street_number = part['long_name'] 101 | continue 102 | if 'route' in part['types']: 103 | self.route = part['long_name'] 104 | continue 105 | if 'locality' in part['types']: 106 | self.locality = part['long_name'] 107 | continue 108 | if 'administrative_area_level_2' in part['types']: 109 | self.area_level_2 = part['long_name'] 110 | continue 111 | if 'administrative_area_level_1' in part['types']: 112 | self.area_level_1 = part['long_name'] 113 | continue 114 | if 'country' in part['types']: 115 | self.country = part['long_name'] 116 | continue 117 | if 'postal_code' in part['types']: 118 | self.postal_code = part['long_name'] 119 | continue 120 | 121 | self.formatted_address = json['formatted_address'] 122 | 123 | self.latitude = json['geometry']['location']['lat'] 124 | self.longitude = json['geometry']['location']['lng'] 125 | 126 | 127 | class Property(models.Model): 128 | """ A Property object representing a snapshot of a property at a point in 129 | time. 130 | 131 | A given physical residence may be represented multiple times if one of its 132 | properties changes. For example if a property is sold a second time at a new 133 | price. 134 | 135 | A property also contains a number of :class:`.Feature` objects which allow 136 | the presence of optional things like a pool or a skylight which would 137 | otherwise crowd the number of fields in the mdoel. 138 | """ 139 | upload_timestamp = models.DateTimeField(auto_now=True) 140 | 141 | listing_timestamp = models.DateTimeField() 142 | listing_type = models.CharField(max_length=1, choices=LISTING_OPTIONS) 143 | 144 | price = models.FloatField() 145 | 146 | bedrooms = models.FloatField(blank=True, null=True) 147 | bathrooms = models.FloatField(blank=True, null=True) 148 | car_spaces = models.FloatField(blank=True, null=True) 149 | 150 | building_size = models.FloatField(blank=True, null=True) 151 | land_size = models.FloatField(blank=True, null=True) 152 | size_units = models.CharField(max_length=1, choices=UNITS_OPTIONS) 153 | 154 | raw_address = models.CharField(max_length=512) 155 | address_object = models.ForeignKey(Address, blank=True, null=True) 156 | 157 | features = models.ManyToManyField('Feature', blank=True) 158 | 159 | # Blank and Null for backwards compatibility 160 | submitter = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True) 161 | 162 | # So we can keep ones that get flagged as a reference 163 | valid = models.BooleanField(default=True) 164 | 165 | def save(self, *args, **kwargs): 166 | """Save the model after geocoding the supplied address. 167 | 168 | Here the address is geocoded using the Google geocoding service. 169 | This is limited to 2500 requests per day. There is no current system 170 | to account for this so models over 2500 will not geocode. 171 | """ 172 | if not settings.TESTING: 173 | response = requests.get( 174 | 'https://maps.googleapis.com/maps/api/geocode/json', 175 | params={'address': self.raw_address, 176 | 'key': settings.G_APPS_KEY}) 177 | if response.status_code == 200: 178 | address = Address() 179 | address.raw = response.text 180 | address.from_google_json(response.json()) 181 | address.save() 182 | self.address_object = address 183 | super(Property, self).save(*args, **kwargs) 184 | 185 | 186 | class Feature(models.Model): 187 | """ A boolean feature of a Property 188 | 189 | For things which a property may or may not have (eg a garden). 190 | """ 191 | category = models.CharField(max_length=100) 192 | tag = models.CharField(max_length=100) 193 | 194 | def __str__(self): 195 | return str(self.category) + ":" + str(self.tag) 196 | 197 | 198 | class Flag(models.Model): 199 | """ A flagged duplication of two properties which are similar. 200 | 201 | These flags are then resolved by a user with resolution rights. This 202 | may be a human or a bot. 203 | """ 204 | first_object = models.ForeignKey(Property, blank=True, 205 | null=True, related_name="first") 206 | second_object = models.ForeignKey(Property, blank=True, 207 | null=True, related_name="second") 208 | flag_type = models.CharField(max_length=1, choices=FLAG_OPTIONS) 209 | is_open = models.BooleanField(default=True) 210 | submitter = models.ForeignKey(settings.AUTH_USER_MODEL) 211 | date_submitted = models.DateTimeField(auto_now=True) 212 | 213 | def is_valid(self): 214 | """If a flag is still open it needs to point to two objects. 215 | 216 | Once it has been closed one or both of those objects may have 217 | been removed. 218 | """ 219 | if self.is_open: 220 | return (self.first_object is not None) and (self.second_object is not None) 221 | return True 222 | 223 | 224 | class Resolution(models.Model): 225 | """ Documented resolutions to duplications in data. 226 | """ 227 | flag = models.ForeignKey(Flag) 228 | resolver = models.ForeignKey(settings.AUTH_USER_MODEL) 229 | date_resolved = models.DateTimeField(auto_now=True) 230 | note = models.CharField(max_length=512, blank=True, null=True) 231 | final_object = models.ForeignKey(Property) 232 | 233 | -------------------------------------------------------------------------------- /homes/api/permissions.py: -------------------------------------------------------------------------------- 1 | from rest_framework import permissions 2 | 3 | class SignUpPermission(permissions.BasePermission): 4 | """ Only allows POST methods from non authenticated users. 5 | """ 6 | message = "Endpoint only allows a POST form a non authenticated user." 7 | 8 | def has_permission(self, request, view): 9 | if not request.user.is_authenticated(): 10 | return True 11 | return False 12 | 13 | def has_object_permission(self, request, view, obj): 14 | if not request.user.is_authenticated(): 15 | return True 16 | return False 17 | 18 | 19 | class UserConfirmedPermission(permissions.BasePermission): 20 | """ Only allows users to take action if they have confirmed their account. 21 | """ 22 | message = "Account not confirmed." 23 | 24 | def has_permission(self, request, view): 25 | if request.method in permissions.SAFE_METHODS: 26 | return True 27 | 28 | if request.user.is_authenticated(): 29 | return request.user.profile.confirmed or request.user.is_superuser 30 | else: 31 | return False 32 | 33 | def has_object_permission(self, request, view, obj): 34 | if request.method in permissions.SAFE_METHODS: 35 | return True 36 | 37 | if request.user.is_authenticated(): 38 | return request.user.profile.confirmed or request.user.is_superuser 39 | else: 40 | return False 41 | -------------------------------------------------------------------------------- /homes/api/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | from api.models import Address, Property, Feature, Flag, Resolution 3 | from django.contrib.auth import get_user_model 4 | from django.conf import settings 5 | 6 | class UserSerializer(serializers.ModelSerializer): 7 | """Used for sign up of users. 8 | """ 9 | password = serializers.CharField( 10 | style={'input_type': 'password'}, 11 | write_only=True 12 | ) 13 | 14 | email = serializers.EmailField() 15 | 16 | class Meta: 17 | model = get_user_model() 18 | fields = ('username', 'password', 'first_name', 'last_name', 'email') 19 | write_only_fields = ('password') 20 | 21 | def create(self, validated_data): 22 | """Create a user and set the password correctly. 23 | """ 24 | password = validated_data.pop('password') 25 | user = get_user_model()(**validated_data) 26 | user.set_password(password) 27 | user.save() 28 | return user 29 | 30 | 31 | class AddressSerializer(serializers.ModelSerializer): 32 | class Meta: 33 | model = Address 34 | fields = '__all__' 35 | 36 | 37 | class PropertySerializer(serializers.ModelSerializer): 38 | submitter = serializers.PrimaryKeyRelatedField(read_only=True, 39 | default=serializers.CurrentUserDefault()) 40 | address_object = AddressSerializer(read_only=True) 41 | class Meta: 42 | model = Property 43 | fields = '__all__' 44 | 45 | 46 | class FeatureSerializer(serializers.ModelSerializer): 47 | class Meta: 48 | model = Feature 49 | fields = '__all__' 50 | 51 | 52 | class FlagSerializer(serializers.ModelSerializer): 53 | submitter = serializers.PrimaryKeyRelatedField(read_only=True, 54 | default=serializers.CurrentUserDefault()) 55 | class Meta: 56 | model = Flag 57 | fields = '__all__' 58 | 59 | 60 | class ResolutionSerializer(serializers.ModelSerializer): 61 | resolver = serializers.PrimaryKeyRelatedField(read_only=True, 62 | default=serializers.CurrentUserDefault()) 63 | class Meta: 64 | model = Resolution 65 | fields = '__all__' 66 | -------------------------------------------------------------------------------- /homes/api/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | from django.core.urlresolvers import reverse 3 | from rest_framework import status 4 | from rest_framework.test import APITestCase 5 | from api.models import * 6 | from django.contrib.auth import get_user_model 7 | from django.contrib.auth.models import Group 8 | from django.utils import timezone 9 | 10 | 11 | 12 | class AnonTests(APITestCase): 13 | """Tests the various endpoints as an anonymous user. 14 | """ 15 | 16 | fixtures = ['groups.json'] 17 | 18 | def setUp(self): 19 | # Create a sample property to check reading permissions 20 | user = get_user_model().objects.create_user( 21 | username="test", 22 | password="test", 23 | email="test@test.com") 24 | 25 | user.profile.confirmed = True 26 | user.profile.save() 27 | 28 | prop = Property.objects.create( 29 | listing_timestamp=timezone.now(), 30 | listing_type=FOR_SALE, 31 | price=1000, 32 | size_units=METRIC, 33 | raw_address="123 Fake St") 34 | 35 | Feature.objects.create( 36 | category="Test", 37 | tag="Test") 38 | 39 | flag = Flag.objects.create( 40 | flag_type=FLAG_EXACT, 41 | submitter=user) 42 | 43 | Resolution.objects.create( 44 | flag=flag, 45 | resolver=user, 46 | final_object=prop) 47 | 48 | def test_read_property(self): 49 | """Anonymous users should be able to see properties. 50 | """ 51 | url = reverse('property-list') 52 | response = self.client.get(url) 53 | 54 | self.assertEqual(response.status_code, status.HTTP_200_OK) 55 | self.assertEqual(len(response.data['results']), 1) 56 | 57 | def test_write_property(self): 58 | """Anonymous users should not be able to POST new properties. 59 | """ 60 | url = reverse('property-list') 61 | data = { 62 | 'listing_type': FOR_SALE, 63 | 'price': 1234, 64 | 'raw_address': '125 Fake St', 65 | } 66 | 67 | response = self.client.post(url, data, format='json') 68 | 69 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 70 | self.assertEqual(Property.objects.count(), 1) 71 | 72 | def test_edit_property(self): 73 | """Anonymous users should not be able to PUT new properties. 74 | """ 75 | url = reverse('property-detail', kwargs={'pk':1}) 76 | data = { 77 | 'listing_type': FOR_SALE, 78 | 'price': 1234, 79 | 'raw_address': '125 Fake St', 80 | 'size_units': METRIC 81 | } 82 | 83 | response = self.client.put(url, data, format='json') 84 | 85 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 86 | self.assertEqual(Property.objects.filter(price=1000).count(), 1) 87 | self.assertEqual(Property.objects.filter(price=1234).count(), 0) 88 | 89 | def test_delete_property(self): 90 | """Anonymous users should not be able to DELETE existing properties. 91 | """ 92 | url = reverse('property-detail', kwargs={'pk':1}) 93 | 94 | response = self.client.delete(url) 95 | 96 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 97 | self.assertEqual(Property.objects.count(), 1) 98 | 99 | def test_read_feature(self): 100 | """Anonymous users should be able to GET current features. 101 | """ 102 | url = reverse('feature-list') 103 | response = self.client.get(url) 104 | 105 | self.assertEqual(response.status_code, status.HTTP_200_OK) 106 | self.assertEqual(len(response.data['results']), 1) 107 | 108 | def test_write_feature(self): 109 | """Anonymous users should not be able to POST new features. 110 | """ 111 | url = reverse('feature-list') 112 | data = { 113 | 'category': 'anything', 114 | 'tag': 'anything' 115 | } 116 | 117 | response = self.client.post(url, data, format='json') 118 | 119 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 120 | self.assertEqual(Feature.objects.count(), 1) 121 | 122 | def test_edit_feature(self): 123 | """Anonymous users should not be able to PUT new features. 124 | """ 125 | url = reverse('feature-detail', kwargs={'pk':1}) 126 | data = { 127 | 'category': 'anything', 128 | 'tag': 'anything' 129 | } 130 | 131 | response = self.client.put(url, data, format='json') 132 | 133 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 134 | self.assertEqual(Feature.objects.count(), 1) 135 | 136 | def test_delete_feature(self): 137 | """Anonymous users should not be able to DELETE exising features. 138 | """ 139 | url = reverse('feature-detail', kwargs={'pk':1}) 140 | 141 | response = self.client.delete(url) 142 | 143 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 144 | self.assertEqual(Feature.objects.count(), 1) 145 | 146 | def test_read_flag(self): 147 | """Anonymous users should be able to GET current flags. 148 | """ 149 | url = reverse('flag-list') 150 | response = self.client.get(url) 151 | 152 | self.assertEqual(response.status_code, status.HTTP_200_OK) 153 | self.assertEqual(len(response.data['results']), 1) 154 | 155 | def test_write_flag(self): 156 | """Anonymous users should not be able to POST new flags. 157 | """ 158 | url = reverse('flag-list') 159 | data = { 160 | 'content': 'not checked, forbidden', 161 | } 162 | 163 | response = self.client.post(url, data, format='json') 164 | 165 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 166 | self.assertEqual(Flag.objects.count(), 1) 167 | 168 | def test_edit_flag(self): 169 | """Anonymous users should not be able to PUT new flags. 170 | """ 171 | url = reverse('flag-detail', kwargs={'pk':1}) 172 | data = { 173 | 'content': 'not checked, forbidden', 174 | } 175 | 176 | response = self.client.put(url, data, format='json') 177 | 178 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 179 | self.assertEqual(Flag.objects.count(), 1) 180 | 181 | def test_delete_flag(self): 182 | """Anonymous users should not be able to DELETE exising flags. 183 | """ 184 | url = reverse('flag-detail', kwargs={'pk':1}) 185 | 186 | response = self.client.delete(url) 187 | 188 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 189 | self.assertEqual(Flag.objects.count(), 1) 190 | 191 | def test_read_resolution(self): 192 | """Anonymous users should be able to GET current resolutions. 193 | """ 194 | url = reverse('resolution-list') 195 | response = self.client.get(url) 196 | 197 | self.assertEqual(response.status_code, status.HTTP_200_OK) 198 | self.assertEqual(len(response.data['results']), 1) 199 | 200 | def test_write_resolution(self): 201 | """Anonymous users should not be able to POST new resolutions. 202 | """ 203 | url = reverse('resolution-list') 204 | data = { 205 | 'content': 'not checked, forbidden', 206 | } 207 | 208 | response = self.client.post(url, data, format='json') 209 | 210 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 211 | self.assertEqual(Resolution.objects.count(), 1) 212 | 213 | def test_edit_resolution(self): 214 | """Anonymous users should not be able to PUT new resolutions. 215 | """ 216 | url = reverse('resolution-detail', kwargs={'pk':1}) 217 | data = { 218 | 'content': 'not checked, forbidden', 219 | } 220 | 221 | response = self.client.put(url, data, format='json') 222 | 223 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 224 | self.assertEqual(Resolution.objects.count(), 1) 225 | 226 | def test_delete_resolution(self): 227 | """Anonymous users should not be able to DELETE exising resolutions. 228 | """ 229 | url = reverse('resolution-detail', kwargs={'pk':1}) 230 | 231 | response = self.client.delete(url) 232 | 233 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 234 | self.assertEqual(Resolution.objects.count(), 1) 235 | 236 | 237 | class PushGroupTests(APITestCase): 238 | """Tests the various endpoints as an user in the push group. 239 | """ 240 | 241 | fixtures = ['groups.json'] 242 | 243 | def setUp(self): 244 | # Create a sample property to check reading permissions 245 | user = get_user_model().objects.create_user( 246 | username="test", 247 | password="test", 248 | email="test@test.com") 249 | 250 | push_group = Group.objects.get(name="pushing") 251 | user.groups.add(push_group) 252 | user.save() 253 | 254 | user.profile.confirmed = True 255 | user.profile.save() 256 | 257 | # Bust the permissions cache 258 | user = get_user_model().objects.get(pk=user.pk) 259 | 260 | prop = Property.objects.create( 261 | listing_timestamp=timezone.now(), 262 | listing_type=FOR_SALE, 263 | price=1000, 264 | size_units=METRIC, 265 | raw_address="123 Fake St") 266 | 267 | Feature.objects.create( 268 | category="Test", 269 | tag="Test") 270 | 271 | flag = Flag.objects.create( 272 | flag_type=FLAG_EXACT, 273 | submitter=user) 274 | 275 | Resolution.objects.create( 276 | flag=flag, 277 | resolver=user, 278 | final_object=prop) 279 | 280 | self.client.force_authenticate(user=user) 281 | 282 | def test_read_property(self): 283 | """Push Group users should be able to see properties. 284 | """ 285 | url = reverse('property-list') 286 | response = self.client.get(url) 287 | 288 | self.assertEqual(response.status_code, status.HTTP_200_OK) 289 | self.assertEqual(len(response.data['results']), 1) 290 | 291 | def test_write_property(self): 292 | """Push Group users should be able to POST new properties. 293 | """ 294 | url = reverse('property-list') 295 | data = { 296 | 'listing_type': FOR_SALE, 297 | 'price': 1234, 298 | 'raw_address': '125 Fake St', 299 | 'size_units': METRIC, 300 | 'listing_timestamp': timezone.now() 301 | } 302 | 303 | response = self.client.post(url, data, format='json') 304 | 305 | self.assertEqual(response.status_code, status.HTTP_201_CREATED) 306 | self.assertEqual(Property.objects.count(), 2) 307 | 308 | def test_edit_property(self): 309 | """Push Group users should not be able to PUT new properties. 310 | """ 311 | url = reverse('property-detail', kwargs={'pk':1}) 312 | data = { 313 | 'listing_type': FOR_SALE, 314 | 'price': 1235, 315 | 'raw_address': '125 Fake St', 316 | 'size_units': METRIC, 317 | 'listing_timestamp': timezone.now() 318 | } 319 | 320 | response = self.client.put(url, data, format='json') 321 | 322 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 323 | self.assertEqual(Property.objects.count(), 1) 324 | self.assertEqual(Property.objects.filter(price=1000).count(), 1) 325 | self.assertEqual(Property.objects.filter(price=1235).count(), 0) 326 | 327 | def test_delete_property(self): 328 | """Push Group users should not be able to DELETE existing properties. 329 | """ 330 | url = reverse('property-detail', kwargs={'pk':1}) 331 | 332 | response = self.client.delete(url) 333 | 334 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 335 | self.assertEqual(Property.objects.count(), 1) 336 | 337 | def test_read_feature(self): 338 | """Push Group users should be able to GET current features. 339 | """ 340 | url = reverse('feature-list') 341 | response = self.client.get(url) 342 | 343 | self.assertEqual(response.status_code, status.HTTP_200_OK) 344 | self.assertEqual(len(response.data['results']), 1) 345 | 346 | def test_write_feature(self): 347 | """Push Group users should be able to POST new features. 348 | """ 349 | url = reverse('feature-list') 350 | data = { 351 | 'category': 'anything', 352 | 'tag': 'anything' 353 | } 354 | 355 | response = self.client.post(url, data, format='json') 356 | 357 | self.assertEqual(response.status_code, status.HTTP_201_CREATED) 358 | self.assertEqual(Feature.objects.count(), 2) 359 | 360 | def test_edit_feature(self): 361 | """Push Group users should not be able to PUT new features. 362 | """ 363 | url = reverse('feature-detail', kwargs={'pk':1}) 364 | data = { 365 | 'category': 'anything', 366 | 'tag': 'anything' 367 | } 368 | 369 | response = self.client.put(url, data, format='json') 370 | 371 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 372 | self.assertEqual(Feature.objects.count(), 1) 373 | 374 | def test_delete_feature(self): 375 | """Push Group users should not be able to DELETE exising features. 376 | """ 377 | url = reverse('feature-detail', kwargs={'pk':1}) 378 | 379 | response = self.client.put(url) 380 | 381 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 382 | self.assertEqual(Feature.objects.count(), 1) 383 | 384 | def test_read_flag(self): 385 | """Push Group users should be able to GET current flags. 386 | """ 387 | url = reverse('flag-list') 388 | response = self.client.get(url) 389 | 390 | self.assertEqual(response.status_code, status.HTTP_200_OK) 391 | self.assertEqual(len(response.data['results']), 1) 392 | 393 | def test_write_flag(self): 394 | """Push Group users should not be able to POST new flags. 395 | """ 396 | url = reverse('flag-list') 397 | data = { 398 | 'content': 'not checked, forbidden', 399 | } 400 | 401 | response = self.client.post(url, data, format='json') 402 | 403 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 404 | self.assertEqual(Flag.objects.count(), 1) 405 | 406 | def test_edit_flag(self): 407 | """Push Group users should not be able to PUT new flags. 408 | """ 409 | url = reverse('flag-detail', kwargs={'pk':1}) 410 | data = { 411 | 'content': 'not checked, forbidden', 412 | } 413 | 414 | response = self.client.put(url, data, format='json') 415 | 416 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 417 | self.assertEqual(Flag.objects.count(), 1) 418 | 419 | def test_delete_flag(self): 420 | """Push Group users should not be able to DELETE exising flags. 421 | """ 422 | url = reverse('flag-detail', kwargs={'pk':1}) 423 | 424 | response = self.client.delete(url) 425 | 426 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 427 | self.assertEqual(Flag.objects.count(), 1) 428 | 429 | def test_read_resolution(self): 430 | """Push Group users should be able to GET current resolutions. 431 | """ 432 | url = reverse('resolution-list') 433 | response = self.client.get(url) 434 | 435 | self.assertEqual(response.status_code, status.HTTP_200_OK) 436 | self.assertEqual(len(response.data['results']), 1) 437 | 438 | def test_write_resolution(self): 439 | """Push Group users should not be able to POST new resolutions. 440 | """ 441 | url = reverse('resolution-list') 442 | data = { 443 | 'content': 'not checked, forbidden', 444 | } 445 | 446 | response = self.client.post(url, data, format='json') 447 | 448 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 449 | self.assertEqual(Resolution.objects.count(), 1) 450 | 451 | def test_edit_resolution(self): 452 | """Push Group users should not be able to PUT new resolutions. 453 | """ 454 | url = reverse('resolution-detail', kwargs={'pk': 1}) 455 | data = { 456 | 'content': 'not checked, forbidden', 457 | } 458 | 459 | response = self.client.put(url, data, format='json') 460 | 461 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 462 | self.assertEqual(Resolution.objects.count(), 1) 463 | 464 | def test_delete_resolution(self): 465 | """Push Group users should not be able to DELETE exising resolutions. 466 | """ 467 | url = reverse('resolution-detail', kwargs={'pk': 1}) 468 | 469 | response = self.client.delete(url) 470 | 471 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 472 | self.assertEqual(Resolution.objects.count(), 1) 473 | 474 | 475 | class FlaggingGroupTests(APITestCase): 476 | """Tests the various endpoints as an user in the flagging group. 477 | """ 478 | 479 | fixtures = ['groups.json'] 480 | 481 | def setUp(self): 482 | # Create a sample property to check reading permissions 483 | user = get_user_model().objects.create_user( 484 | username="test", 485 | password="test", 486 | email="test@test.com") 487 | 488 | user.profile.confirmed = True 489 | user.profile.save() 490 | 491 | # Bust the permissions cache 492 | flagging_group = Group.objects.get(name="flagging") 493 | user.groups.add(flagging_group) 494 | user.save() 495 | 496 | # Bust the permissions cache 497 | user = get_user_model().objects.get(pk=user.pk) 498 | 499 | prop = Property.objects.create( 500 | listing_timestamp=timezone.now(), 501 | listing_type=FOR_SALE, 502 | price=1000, 503 | size_units=METRIC, 504 | raw_address="123 Fake St") 505 | 506 | self.prop = prop 507 | self.user = user 508 | 509 | Feature.objects.create( 510 | category="Test", 511 | tag="Test") 512 | 513 | flag = Flag.objects.create( 514 | flag_type=FLAG_EXACT, 515 | submitter=user) 516 | 517 | Resolution.objects.create( 518 | flag=flag, 519 | resolver=user, 520 | final_object=prop) 521 | 522 | self.client.force_authenticate(user=user) 523 | 524 | def test_read_property(self): 525 | """Flagging Group users should be able to see properties. 526 | """ 527 | url = reverse('property-list') 528 | response = self.client.get(url) 529 | 530 | self.assertEqual(response.status_code, status.HTTP_200_OK) 531 | self.assertEqual(len(response.data['results']), 1) 532 | 533 | def test_write_property(self): 534 | """Flagging Group users should not be able to POST new properties. 535 | """ 536 | url = reverse('property-list') 537 | data = { 538 | 'listing_type': FOR_SALE, 539 | 'price': 1234, 540 | 'raw_address': '125 Fake St', 541 | 'size_units': METRIC, 542 | 'listing_timestamp': timezone.now() 543 | } 544 | 545 | response = self.client.post(url, data, format='json') 546 | 547 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 548 | self.assertEqual(Property.objects.count(), 1) 549 | 550 | def test_edit_property(self): 551 | """Flagging Group users should not be able to PUT new properties. 552 | """ 553 | url = reverse('property-detail', kwargs={'pk':1}) 554 | data = { 555 | 'listing_type': FOR_SALE, 556 | 'price': 1235, 557 | 'raw_address': '125 Fake St', 558 | 'size_units': METRIC, 559 | 'listing_timestamp': timezone.now() 560 | } 561 | 562 | response = self.client.put(url, data, format='json') 563 | 564 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 565 | self.assertEqual(Property.objects.count(), 1) 566 | self.assertEqual(Property.objects.filter(price=1000).count(), 1) 567 | self.assertEqual(Property.objects.filter(price=1235).count(), 0) 568 | 569 | def test_delete_property(self): 570 | """Flagging Group users should not be able to DELETE existing properties. 571 | """ 572 | url = reverse('property-detail', kwargs={'pk':1}) 573 | 574 | response = self.client.delete(url) 575 | 576 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 577 | self.assertEqual(Property.objects.count(), 1) 578 | 579 | def test_read_feature(self): 580 | """Flagging Group users should be able to GET current features. 581 | """ 582 | url = reverse('feature-list') 583 | response = self.client.get(url) 584 | 585 | self.assertEqual(response.status_code, status.HTTP_200_OK) 586 | self.assertEqual(len(response.data['results']), 1) 587 | 588 | def test_write_feature(self): 589 | """Flagging Group users should not be able to POST new features. 590 | """ 591 | url = reverse('feature-list') 592 | data = { 593 | 'category': 'anything', 594 | 'tag': 'anything' 595 | } 596 | 597 | response = self.client.post(url, data, format='json') 598 | 599 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 600 | self.assertEqual(Feature.objects.count(), 1) 601 | 602 | def test_edit_feature(self): 603 | """Flagging Group users should not be able to PUT new features. 604 | """ 605 | url = reverse('feature-detail', kwargs={'pk':1}) 606 | data = { 607 | 'category': 'anything', 608 | 'tag': 'anything' 609 | } 610 | 611 | response = self.client.put(url, data, format='json') 612 | 613 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 614 | self.assertEqual(Feature.objects.count(), 1) 615 | 616 | def test_delete_feature(self): 617 | """Flagging Group users should not be able to DELETE exising features. 618 | """ 619 | url = reverse('feature-detail', kwargs={'pk':1}) 620 | 621 | response = self.client.put(url) 622 | 623 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 624 | self.assertEqual(Feature.objects.count(), 1) 625 | 626 | def test_read_flag(self): 627 | """Flagging Group users should be able to GET current flags. 628 | """ 629 | url = reverse('flag-list') 630 | response = self.client.get(url) 631 | 632 | self.assertEqual(response.status_code, status.HTTP_200_OK) 633 | self.assertEqual(len(response.data['results']), 1) 634 | 635 | def test_write_flag(self): 636 | """Flagging Group users should be able to POST new flags. 637 | """ 638 | url = reverse('flag-list') 639 | data = { 640 | 'first_object': self.prop.pk, 641 | 'second_object': self.prop.pk, 642 | 'flag_type': FLAG_EXACT, 643 | } 644 | 645 | response = self.client.post(url, data, format='json') 646 | 647 | self.assertEqual(response.status_code, status.HTTP_201_CREATED) 648 | self.assertEqual(Flag.objects.count(), 2) 649 | 650 | def test_write_flag_someone_else(self): 651 | """Flagging Group users should not be able to POST new flags as others. 652 | 653 | Note that in this case the object is still created, the submitter field 654 | is just ignored in the post data. 655 | """ 656 | user2 = get_user_model().objects.create(username="u2", 657 | email="bono@u2.com", password="iambono") 658 | 659 | url = reverse('flag-list') 660 | data = { 661 | 'first_object': self.prop.pk, 662 | 'second_object': self.prop.pk, 663 | 'submitter': user2.pk, 664 | 'flag_type': FLAG_EXACT, 665 | } 666 | 667 | response = self.client.post(url, data, format='json') 668 | 669 | self.assertEqual(response.status_code, status.HTTP_201_CREATED) 670 | self.assertEqual(response.data['submitter'], self.user.pk) 671 | 672 | def test_edit_flag(self): 673 | """Flagging Group users should be able to PUT new flags. 674 | """ 675 | url = reverse('flag-detail', kwargs={'pk':1}) 676 | data = { 677 | 'first_object': self.prop.pk, 678 | 'second_object': self.prop.pk, 679 | 'submitter': self.user.pk, 680 | 'flag_type': FLAG_EXACT, 681 | } 682 | 683 | response = self.client.put(url, data, format='json') 684 | 685 | self.assertEqual(response.status_code, status.HTTP_200_OK) 686 | self.assertEqual(Flag.objects.count(), 1) 687 | 688 | def test_delete_flag(self): 689 | """Flagging Group users should be able to DELETE exising flags. 690 | """ 691 | url = reverse('flag-detail', kwargs={'pk':1}) 692 | 693 | response = self.client.delete(url) 694 | 695 | self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) 696 | self.assertEqual(Flag.objects.count(), 0) 697 | 698 | def test_read_resolution(self): 699 | """Flagging Group users should be able to GET current resolutions. 700 | """ 701 | url = reverse('resolution-list') 702 | response = self.client.get(url) 703 | 704 | self.assertEqual(response.status_code, status.HTTP_200_OK) 705 | self.assertEqual(len(response.data['results']), 1) 706 | 707 | def test_write_resolution(self): 708 | """Flagging Group users should not be able to POST new resolutions. 709 | """ 710 | url = reverse('resolution-list') 711 | data = { 712 | 'content': 'not checked, forbidden', 713 | } 714 | 715 | response = self.client.post(url, data, format='json') 716 | 717 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 718 | self.assertEqual(Resolution.objects.count(), 1) 719 | 720 | def test_edit_resolution(self): 721 | """Flagging Group users should not be able to PUT new resolutions. 722 | """ 723 | url = reverse('resolution-detail', kwargs={'pk': 1}) 724 | data = { 725 | 'content': 'not checked, forbidden', 726 | } 727 | 728 | response = self.client.put(url, data, format='json') 729 | 730 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 731 | self.assertEqual(Resolution.objects.count(), 1) 732 | 733 | def test_delete_resolution(self): 734 | """Flagging Group users should not be able to DELETE exising resolutions. 735 | """ 736 | url = reverse('resolution-detail', kwargs={'pk': 1}) 737 | 738 | response = self.client.delete(url) 739 | 740 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) 741 | self.assertEqual(Resolution.objects.count(), 1) 742 | -------------------------------------------------------------------------------- /homes/api/util.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | import requests 3 | 4 | 5 | def send_signup_email(email, link_text): 6 | domain = settings.MAILGUN_DOMAIN 7 | result = requests.post( 8 | "https://api.mailgun.net/v3/" + domain + "/messages", 9 | auth=("api", settings.MAILGUN_API_KEY), 10 | data={"from": "OpenHouse API <" + settings.MAILGUN_API_FROM + ">", 11 | "to": [email], 12 | "subject": "OpenHouse API Account Confirmation", 13 | "text": "Click to Verify your account: " + link_text}) 14 | 15 | print(result.text) 16 | 17 | -------------------------------------------------------------------------------- /homes/api/views.py: -------------------------------------------------------------------------------- 1 | from api.serializers import (PropertySerializer, FeatureSerializer, 2 | FlagSerializer, ResolutionSerializer, 3 | UserSerializer, AddressSerializer) 4 | from api.filters import PropertyFilter 5 | from api.models import (Property, Feature, Flag, Resolution, Profile, Address) 6 | from api.permissions import SignUpPermission 7 | 8 | from django.contrib.auth import get_user_model 9 | from django.contrib.auth.models import Group 10 | from rest_framework import viewsets, filters, mixins, status 11 | from rest_framework.decorators import api_view, permission_classes 12 | from rest_framework.response import Response 13 | from rest_framework.permissions import AllowAny 14 | 15 | class UserViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet): 16 | """Allows a user to sign up by pushing data to this endpoint. 17 | 18 | This will also fail for an authenticated user. 19 | 20 | Data to push is username, password, first_name, last_name, email 21 | """ 22 | queryset = get_user_model().objects.all() 23 | serializer_class = UserSerializer 24 | permission_classes = (SignUpPermission,) 25 | 26 | 27 | class AddressViewSet(viewsets.ModelViewSet): 28 | queryset = Address.objects.all() 29 | serializer_class = AddressSerializer 30 | 31 | 32 | class PropertyViewSet(viewsets.ModelViewSet): 33 | """Allows the read and write of Property objects. 34 | """ 35 | queryset = Property.objects.all() 36 | serializer_class = PropertySerializer 37 | filter_backends = (filters.DjangoFilterBackend,) 38 | filter_class = PropertyFilter 39 | 40 | 41 | class FeatureViewSet(viewsets.ModelViewSet): 42 | """Allows the read and write of Feature objects. 43 | """ 44 | queryset = Feature.objects.all() 45 | serializer_class = FeatureSerializer 46 | 47 | 48 | class FlagViewSet(viewsets.ModelViewSet): 49 | """Allows the read and write of new flag objects. 50 | """ 51 | queryset = Flag.objects.all() 52 | serializer_class = FlagSerializer 53 | 54 | 55 | class ResolutionViewSet(viewsets.ModelViewSet): 56 | """Allows the read and write of resolution objects. 57 | """ 58 | queryset = Resolution.objects.all() 59 | serializer_class = ResolutionSerializer 60 | 61 | 62 | @api_view(['GET']) 63 | @permission_classes((AllowAny,)) 64 | def confirm_code(request, id, code): 65 | """Provides an endpoint to confirm a users account. 66 | 67 | Users cannot do anything but GET until accounts are confirmed. 68 | """ 69 | profile = Profile.objects.filter(id=id, confirmation_code=code) 70 | 71 | if len(profile) == 0: 72 | return Response({"message":"Inocrrect User or Confirmation Code"}, 73 | status=status.HTTP_400_BAD_REQUEST) 74 | 75 | profile = profile[0] 76 | 77 | if profile.can_confirm(): 78 | profile.confirmed = True 79 | profile.save() 80 | g = Group.objects.get(name='pushing') 81 | g.user_set.add(profile.user) 82 | return Response({"message":"OK"}) 83 | else: 84 | return Response({"message":"Confirmation Code Expired or Account already Active"}, 85 | status=status.HTTP_400_BAD_REQUEST) 86 | 87 | 88 | -------------------------------------------------------------------------------- /homes/homes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-skeptic/home-data-api/a16d9f268dd2e10d978f1ee628e7bc86fb569a3d/homes/homes/__init__.py -------------------------------------------------------------------------------- /homes/homes/pagination.py: -------------------------------------------------------------------------------- 1 | from rest_framework.pagination import LimitOffsetPagination 2 | 3 | class DefaultPagination(LimitOffsetPagination): 4 | default_limit = 50 5 | default_limit = 500 6 | -------------------------------------------------------------------------------- /homes/homes/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for homes project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.9.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.9/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.9/ref/settings/ 11 | """ 12 | 13 | import os 14 | import datetime 15 | import dj_database_url 16 | 17 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 18 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 19 | PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) 20 | 21 | 22 | # Quick-start development settings - unsuitable for production 23 | # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ 24 | 25 | # SECURITY WARNING: keep the secret key used in production secret! 26 | SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'INVALID') 27 | 28 | HOSTNAME = os.environ.get('HOSTNAME', 'localhost:8000') 29 | 30 | G_APPS_KEY = os.environ.get('G_APPS_KEY', '') 31 | 32 | # SECURITY WARNING: don't run with debug turned on in production! 33 | DEBUG = False 34 | TESTING = False 35 | 36 | if os.environ.get('DJANGO_DEBUG'): 37 | DEBUG = True 38 | 39 | ALLOWED_HOSTS = ['*'] 40 | 41 | MAILGUN_API_KEY = os.environ.get('MAILGUN_API_KEY', '') 42 | MAILGUN_DOMAIN = os.environ.get('MAILGUN_DOMAIN', '') 43 | MAILGUN_API_FROM = os.environ.get('MAILGUN_API_FROM', 'data-skeptic@mg.justrun.io') 44 | 45 | # Application definition 46 | 47 | INSTALLED_APPS = [ 48 | 'django.contrib.admin', 49 | 'django.contrib.auth', 50 | 'django.contrib.contenttypes', 51 | 'django.contrib.sessions', 52 | 'django.contrib.messages', 53 | 'django.contrib.staticfiles', 54 | 'corsheaders', 55 | 'api', 56 | 'rest_framework' 57 | ] 58 | 59 | MIDDLEWARE_CLASSES = [ 60 | 'django.middleware.security.SecurityMiddleware', 61 | 'django.contrib.sessions.middleware.SessionMiddleware', 62 | 'corsheaders.middleware.CorsMiddleware', 63 | 'django.middleware.common.CommonMiddleware', 64 | 'django.middleware.csrf.CsrfViewMiddleware', 65 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 66 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 67 | 'django.contrib.messages.middleware.MessageMiddleware', 68 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 69 | ] 70 | 71 | ROOT_URLCONF = 'homes.urls' 72 | 73 | TEMPLATES = [ 74 | { 75 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 76 | 'DIRS': [], 77 | 'APP_DIRS': True, 78 | 'OPTIONS': { 79 | 'context_processors': [ 80 | 'django.template.context_processors.debug', 81 | 'django.template.context_processors.request', 82 | 'django.contrib.auth.context_processors.auth', 83 | 'django.contrib.messages.context_processors.messages', 84 | ], 85 | }, 86 | }, 87 | ] 88 | 89 | WSGI_APPLICATION = 'homes.wsgi.application' 90 | 91 | CORS_ORIGIN_ALLOW_ALL = True 92 | 93 | # Database 94 | # https://docs.djangoproject.com/en/1.9/ref/settings/#databases 95 | 96 | DATABASES = { 97 | 'default': { 98 | 'ENGINE': 'django.db.backends.sqlite3', 99 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 100 | } 101 | } 102 | 103 | DATABASES['default'] = dj_database_url.config() 104 | 105 | REST_FRAMEWORK = { 106 | 'DEFAULT_PERMISSION_CLASSES': ( 107 | 'rest_framework.permissions.IsAuthenticatedOrReadOnly', 108 | 'api.permissions.UserConfirmedPermission', 109 | 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' 110 | ), 111 | 'DEFAULT_AUTHENTICATION_CLASSES': ( 112 | 'rest_framework.authentication.SessionAuthentication', 113 | 'rest_framework.authentication.BasicAuthentication', 114 | 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 115 | ), 116 | 'DEFAULT_PAGINATION_CLASS': 'homes.pagination.DefaultPagination' 117 | } 118 | 119 | JWT_AUTH = { 120 | 'JWT_ENCODE_HANDLER': 121 | 'rest_framework_jwt.utils.jwt_encode_handler', 122 | 123 | 'JWT_DECODE_HANDLER': 124 | 'rest_framework_jwt.utils.jwt_decode_handler', 125 | 126 | 'JWT_PAYLOAD_HANDLER': 127 | 'rest_framework_jwt.utils.jwt_payload_handler', 128 | 129 | 'JWT_PAYLOAD_GET_USER_ID_HANDLER': 130 | 'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler', 131 | 132 | 'JWT_RESPONSE_PAYLOAD_HANDLER': 133 | 'rest_framework_jwt.utils.jwt_response_payload_handler', 134 | 135 | 'JWT_SECRET_KEY': SECRET_KEY, 136 | 'JWT_ALGORITHM': 'HS256', 137 | 'JWT_VERIFY': True, 138 | 'JWT_VERIFY_EXPIRATION': True, 139 | 'JWT_LEEWAY': 0, 140 | 'JWT_EXPIRATION_DELTA': datetime.timedelta(days=2), 141 | 'JWT_AUDIENCE': None, 142 | 'JWT_ISSUER': None, 143 | 144 | 'JWT_ALLOW_REFRESH': False, 145 | 'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7), 146 | 147 | 'JWT_AUTH_HEADER_PREFIX': 'Bearer', 148 | } 149 | 150 | 151 | 152 | # Password validation 153 | # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators 154 | 155 | AUTH_PASSWORD_VALIDATORS = [ 156 | { 157 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 158 | }, 159 | { 160 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 161 | }, 162 | { 163 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 164 | }, 165 | { 166 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 167 | }, 168 | ] 169 | 170 | 171 | # Internationalization 172 | # https://docs.djangoproject.com/en/1.9/topics/i18n/ 173 | 174 | LANGUAGE_CODE = 'en-us' 175 | 176 | TIME_ZONE = 'UTC' 177 | 178 | USE_I18N = True 179 | 180 | USE_L10N = True 181 | 182 | USE_TZ = True 183 | 184 | # Static files (CSS, JavaScript, Images) 185 | # https://docs.djangoproject.com/en/1.9/howto/static-files/ 186 | 187 | STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') 188 | STATIC_URL = '/static/' 189 | 190 | # Extra places for collectstatic to find static files. 191 | STATICFILES_DIRS = ( 192 | os.path.join(PROJECT_ROOT, 'static'), 193 | ) 194 | 195 | STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' 196 | 197 | -------------------------------------------------------------------------------- /homes/homes/settings_local.py: -------------------------------------------------------------------------------- 1 | from homes.settings import * 2 | 3 | SECRET_KEY = '!0n!j@xhrmmspj0)l5^^d8utem*y*k-5*4jbb1x9p&wz6_h+ju' 4 | 5 | JWT_AUTH['JWT_SECRET_KEY'] = SECRET_KEY 6 | 7 | os.environ['HTTPS'] = "" 8 | 9 | DEBUG = True 10 | 11 | SESSION_COOKIE_SECURE = False 12 | CSRF_COOKIE_SECURE = False 13 | SESSION_COOKIE_HTTPONLY = False 14 | SECURE_PROXY_SSL_HEADER = () #('HTTP_X_FORWARDED_PROTOCOL', 'https') 15 | 16 | DATABASES = { 17 | 'default': { 18 | 'NAME': 'tests.db', 19 | 'ENGINE': 'django.db.backends.sqlite3' 20 | } 21 | } 22 | 23 | LOGGING = { 24 | 'version': 1, 25 | 'disable_existing_loggers': False, 26 | 'handlers': { 27 | 'console': { 28 | 'class': 'logging.StreamHandler', 29 | }, 30 | }, 31 | 'loggers': { 32 | 'api.models': { 33 | 'handlers': ['console'], 34 | 'level': 'INFO', 35 | }, 36 | }, 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /homes/homes/settings_testing.py: -------------------------------------------------------------------------------- 1 | from homes.settings_local import * 2 | 3 | TESTING = True 4 | -------------------------------------------------------------------------------- /homes/homes/static/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/data-skeptic/home-data-api/a16d9f268dd2e10d978f1ee628e7bc86fb569a3d/homes/homes/static/hello -------------------------------------------------------------------------------- /homes/homes/urls.py: -------------------------------------------------------------------------------- 1 | """homes URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from api.views import (PropertyViewSet, FeatureViewSet, FlagViewSet, 19 | ResolutionViewSet, UserViewSet, confirm_code, 20 | AddressViewSet) 21 | from rest_framework import routers 22 | from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token, verify_jwt_token 23 | 24 | 25 | router = routers.DefaultRouter() 26 | router.register(r'property', PropertyViewSet) 27 | router.register(r'feature', FeatureViewSet) 28 | router.register(r'flag', FlagViewSet) 29 | router.register(r'resolution', ResolutionViewSet) 30 | router.register(r'signup', UserViewSet) 31 | router.register(r'address', AddressViewSet) 32 | 33 | urlpatterns = [ 34 | url(r'^admin/', admin.site.urls), 35 | url(r'^api/', include(router.urls)), 36 | url(r'^token/auth/', obtain_jwt_token), 37 | url(r'^token/refresh/', refresh_jwt_token), 38 | url(r'^token/verify/', verify_jwt_token), 39 | url(r'^confirm/(?P[0-9]+)/(?P[A-Z]+)/', confirm_code) 40 | ] 41 | -------------------------------------------------------------------------------- /homes/homes/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for homes project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | from whitenoise.django import DjangoWhiteNoise 14 | 15 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "homes.settings") 16 | 17 | application = get_wsgi_application() 18 | application = DjangoWhiteNoise(application) 19 | -------------------------------------------------------------------------------- /homes/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "homes.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /requirements-docs.txt: -------------------------------------------------------------------------------- 1 | alabaster==0.7.7 2 | Babel==2.2.0 3 | docutils==0.12 4 | Jinja2==2.8 5 | MarkupSafe==0.23 6 | psycopg2==2.6.1 7 | Pygments==2.1.3 8 | pytz==2016.2 9 | six==1.10.0 10 | snowballstemmer==1.2.1 11 | Sphinx==1.3.6 12 | sphinx-rtd-theme==0.1.9 13 | wheel==0.24.0 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | alabaster==0.7.7 2 | Babel==2.2.0 3 | dj-database-url==0.4.0 4 | Django==1.9.4 5 | django-cors-headers==1.1.0 6 | django-filter==0.12.0 7 | djangorestframework==3.3.2 8 | djangorestframework-filters==0.7.0 9 | djangorestframework-jwt==1.8.0 10 | docutils==0.12 11 | geopy==1.11.0 12 | gunicorn==19.4.5 13 | Jinja2==2.8 14 | MarkupSafe==0.23 15 | prompt-toolkit==1.0.0 16 | psycopg2==2.6.1 17 | Pygments==2.1.3 18 | PyJWT==1.4.0 19 | pytz==2016.2 20 | requests==2.10.0 21 | six==1.10.0 22 | snowballstemmer==1.2.1 23 | Sphinx==1.3.6 24 | sphinx-rtd-theme==0.1.9 25 | wcwidth==0.1.6 26 | whitenoise==3.0 27 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.5.1 2 | -------------------------------------------------------------------------------- /schema/schema.csv: -------------------------------------------------------------------------------- 1 | Listing Number,12345 2 | Agent Days On Market,66 3 | Co-listing Member,John Doe 4 | Co-selling Member,Jane Doe 5 | Cumulative DOM,66 6 | Listing Member,Mr. Smith 7 | Listing Office,Smith Realty 8 | Property Type,Residential 9 | Selling Member,Jane Doe 10 | Selling Office,Smith Realty 11 | # Bedrooms,3 12 | 3rd Party,N 13 | Acreage Range,0 - 0.5 14 | Acres,0.25 15 | Approximate Age,1 - 3 Years 16 | Area,M5 17 | Assn Fee,Required 18 | Assn Fee $,292 19 | Assn Fee Terms,Quarterly 20 | Back on Market Date, 21 | Baths - 1/2,1 22 | Baths - Full,2 23 | Bonus,N 24 | Builder,Bob The Builder 25 | Buyer Name,Tom Brown 26 | Cancel Date, 27 | City,Utopia 28 | Compensation,3%-$150 29 | Concessions,5000 30 | Concessions Notes,Seller Paid Closing 31 | Contingency Notes,Upon Buyer's Home Sale 32 | Contingent,Y 33 | Dir, 34 | Directions,"From Main Street, turn north on First Street, left in 5 blocks on Pecan, house third on right." 35 | Dual/Var,N 36 | Elementary School,John Smith Elementary 37 | Expiration Date, 38 | High School,Great Man High School 39 | Interest Rate, 40 | Legal Desc,Lot 33 of Village 41 | Lender,Community Bank 42 | Limited Service,N 43 | List Price/SqFt,228.72 44 | List Type,Excl Right 45 | Listing Date,2016-01-04 46 | Listing Price,645000 47 | Loan Term,30 Year 48 | Lot #,33 49 | Lot Dimensions,50x100 50 | Middle School,Next Step Middle School 51 | Mineral Rights,Conveyed/Reserved/Partial 52 | Model Name, 53 | Occupied By,Owner/Vacant/Tenant 54 | Original List Price,645000 55 | Parish-County,Midland 56 | Pool,N 57 | Projected Closing Date,42491 58 | Realtor Remarks,Lockbox on house. Call to schedule showing. 59 | Remarks,Really flowery writing here 60 | REO,Y/N 61 | Seller Name, 62 | Seller Phone, 63 | Sold Date, 64 | Sold Price, 65 | Sold Price/SqFt, 66 | Sold Terms, 67 | SqFt - Carport, 68 | SqFt - Covered Porch,513 69 | SqFt - Garage,792 70 | SqFt - Living,2820 71 | SqFt - Lower,1990 72 | SqFt - Source,Owner 73 | SqFt - Storage,41 74 | SqFt - Total, 75 | SqFt - Upper,830 76 | St Suffix,Street 77 | State,LA 78 | Status,A 79 | Status Change Date,2016-01-04 80 | Stories,2 81 | Street Name,Pecan 82 | Street Number,105 83 | Sub-Type, 84 | Subdivision,Village 85 | Tax Assessment Number,3102012 86 | Temp Off Market Date, 87 | Terms of Bonus,"$3,000 Bonus to Selling Agency with reasonable offer." 88 | Total Baths,2.1 89 | Type,DS 90 | Type of Sale, 91 | Under Contract Date, 92 | Unit #, 93 | Use CSS,Y 94 | Warranty, 95 | Year Built, 96 | Zip Code,5010 97 | Zone, 98 | Amenities: Acreage,Y/N 99 | Amenities: Club House,Y/N 100 | Amenities: Community Pool,Y/N 101 | Amenities: Elevator,Y/N 102 | Amenities: Gated Community,Y/N 103 | Amenities: Golf Course,Y/N 104 | Amenities: Health Club,Y/N 105 | Amenities: Library,Y/N 106 | Amenities: Medical Facility,Y/N 107 | Amenities: Other,Y/N 108 | Amenities: Park,Y/N 109 | Amenities: Playground,Y/N 110 | Amenities: Public Trans,Y/N 111 | Amenities: Shopping/Mall,Y/N 112 | Amenities: Tennis Court,Y/N 113 | Appliances: Compactor,Y/N 114 | Appliances: Cooktop - Electric,Y/N 115 | Appliances: Cooktop - Gas,Y/N 116 | Appliances: Dishwasher,Y/N 117 | Appliances: Disposal,Y/N 118 | Appliances: Dryer,Y/N 119 | Appliances: Freezer,Y/N 120 | Appliances: Ice Machine,Y/N 121 | Appliances: Indoor Grill,Y/N 122 | Appliances: Microwave,Y/N 123 | Appliances: None,Y/N 124 | Appliances: Other,Y/N 125 | Appliances: Range/Oven,Y/N 126 | Appliances: Refrigerator,Y/N 127 | Appliances: Wall Oven,Y/N 128 | Appliances: Washer,Y/N 129 | Appliances: Water Softener,Y/N 130 | Approximate Age: 11 - 15 Years,Y/N 131 | Approximate Age: 16 - 20 Years,Y/N 132 | Approximate Age: 21 - 30 Years,Y/N 133 | Approximate Age: 31 - 40 Years,Y/N 134 | Approximate Age: 41 - 50 Years,Y/N 135 | Approximate Age: 51 - 75 Years,Y/N 136 | Approximate Age: 76+ Years,Y/N 137 | Construction: Block,Y/N 138 | Construction: Brick,Y/N 139 | Construction: Concrete,Y/N 140 | Construction: Frame,Y/N 141 | Construction: Log,Y/N 142 | Construction: Metal,Y/N 143 | Construction: Other,Y/N 144 | Cooling: 2 or More Units,Y/N 145 | Cooling: Central Air,Y/N 146 | Cooling: Heat Pump,Y/N 147 | Cooling: None,Y/N 148 | Cooling: Other,Y/N 149 | Cooling: Wall Units,Y/N 150 | Cooling: Window Units,Y/N 151 | Cooling: Zoned,Y/N 152 | Countertops: Butcher Block,Y/N 153 | Countertops: Concrete,Y/N 154 | Countertops: Copper,Y/N 155 | Countertops: Cultured Marble,Y/N 156 | Countertops: Formica,Y/N 157 | Countertops: Granite,Y/N 158 | Countertops: Granite Tile,Y/N 159 | Countertops: Marble,Y/N 160 | Countertops: Other,Y/N 161 | Countertops: Quartz,Y/N 162 | Countertops: Solid Surface,Y/N 163 | Countertops: Stainless Steel,Y/N 164 | Countertops: Tile,Y/N 165 | Equipment: Attic Fan,Y/N 166 | Equipment: Cable Available,Y/N 167 | Equipment: Cable Ready,Y/N 168 | Equipment: Ceiling Fans,Y/N 169 | Equipment: Cent Vacuum,Y/N 170 | Equipment: Garage Door Opener,Y/N 171 | Equipment: Garden Tub,Y/N 172 | Equipment: Hot Tub,Y/N 173 | Equipment: Humidifier,Y/N 174 | Equipment: Intercom,Y/N 175 | Equipment: Other,Y/N 176 | Equipment: Sauna/Steam,Y/N 177 | Equipment: Sec Sys Leased,Y/N 178 | Equipment: Sec Sys Owned,Y/N 179 | Equipment: Sec Sys Pre-Wired Only,Y/N 180 | Equipment: Security System,Y/N 181 | Equipment: Separate Shower,Y/N 182 | Equipment: Smoke Detector,Y/N 183 | Equipment: Water Filter,Y/N 184 | Equipment: Whirlpool,Y/N 185 | Exterior: Balcony,Y/N 186 | Exterior: Barn,Y/N 187 | Exterior: Cabana,Y/N 188 | Exterior: Deck,Y/N 189 | Exterior: Gas/Propane Grill,Y/N 190 | Exterior: Gazebo,Y/N 191 | Exterior: Hot Tub,Y/N 192 | Exterior: Kennel,Y/N 193 | Exterior: Landscaped,Y/N 194 | Exterior: Other,Y/N 195 | Exterior: Outside Kitchen,Y/N 196 | Exterior: Outside Light,Y/N 197 | Exterior: Porch,Y/N 198 | Exterior: Rear Yard Access,Y/N 199 | Exterior: Sprinkler System,Y/N 200 | Exterior: Storage Shed/Building,Y/N 201 | Exterior: Storm Doors,Y/N 202 | Exterior: Storm Windows,Y/N 203 | Exterior: Workshop,Y/N 204 | Fencing: Barb Wire,Y/N 205 | Fencing: Brick,Y/N 206 | Fencing: Chain Link,Y/N 207 | Fencing: Full,Y/N 208 | Fencing: None,Y/N 209 | Fencing: Other,Y/N 210 | Fencing: Partial,Y/N 211 | Fencing: Privacy,Y/N 212 | Fencing: Rail,Y/N 213 | Fencing: Vinyl,Y/N 214 | Fencing: Wood,Y/N 215 | Financing: Assumable,Y/N 216 | Financing: Bond for Deed,Y/N 217 | Financing: Cash,Y/N 218 | Financing: Conventional,Y/N 219 | Financing: FHA,Y/N 220 | Financing: Lease Purchase,Y/N 221 | Financing: None,Y/N 222 | Financing: Owner Finance,Y/N 223 | Financing: Private Banking,Y/N 224 | Financing: Rural Development,Y/N 225 | Financing: See Remarks,Y/N 226 | Financing: Trade/Exchange,Y/N 227 | Financing: VA,Y/N 228 | Fireplace: 1 Fireplace,Y/N 229 | Fireplace: 2 Fireplaces,Y/N 230 | Fireplace: 3+ Fireplaces,Y/N 231 | Fireplace: Double Sided,Y/N 232 | Fireplace: Gas Logs,Y/N 233 | Fireplace: Masonry,Y/N 234 | Fireplace: Other,Y/N 235 | Fireplace: Pre-Fab,Y/N 236 | Fireplace: Ventless,Y/N 237 | Fireplace: Wood Burning,Y/N 238 | Flooring: Brick,Y/N 239 | Flooring: Carpet,Y/N 240 | Flooring: Concrete,Y/N 241 | Flooring: Laminate,Y/N 242 | Flooring: Marble,Y/N 243 | Flooring: Other,Y/N 244 | Flooring: Pavers,Y/N 245 | Flooring: Slate,Y/N 246 | Flooring: Stained/Scored Concrete,Y/N 247 | Flooring: Tile,Y/N 248 | Flooring: Vinyl Sheet,Y/N 249 | Flooring: Vinyl Tile,Y/N 250 | Flooring: Wood,Y/N 251 | Flooring: Wood Laminate,Y/N 252 | Foundation: Other,Y/N 253 | Foundation: Piers,Y/N 254 | Foundation: Piling/Stilt,Y/N 255 | Foundation: Post Tension,Y/N 256 | Foundation: Slab,Y/N 257 | Heating: 2 or More Units,Y/N 258 | Heating: Central Heat,Y/N 259 | Heating: Electric,Y/N 260 | Heating: Gas,Y/N 261 | Heating: Heat Pump,Y/N 262 | Heating: Other,Y/N 263 | Heating: Space Heater,Y/N 264 | Heating: Wall Units,Y/N 265 | Heating: Zoned,Y/N 266 | HOA Includes: Accounting,Y/N 267 | HOA Includes: Advertising,Y/N 268 | HOA Includes: Cable TV,Y/N 269 | HOA Includes: Electricity,Y/N 270 | HOA Includes: Gas,Y/N 271 | HOA Includes: Ground Keeping,Y/N 272 | HOA Includes: Insurance,Y/N 273 | HOA Includes: Legal,Y/N 274 | HOA Includes: Licenses/Permit,Y/N 275 | HOA Includes: Management,Y/N 276 | HOA Includes: Other - See Remarks,Y/N 277 | HOA Includes: Other Utilities,Y/N 278 | HOA Includes: Pest Control,Y/N 279 | HOA Includes: Pool,Y/N 280 | HOA Includes: Recreation Facilities,Y/N 281 | HOA Includes: Repairs/Maintenance,Y/N 282 | HOA Includes: Services,Y/N 283 | HOA Includes: Sewer,Y/N 284 | HOA Includes: Supplies,Y/N 285 | HOA Includes: Taxes,Y/N 286 | HOA Includes: Telephone,Y/N 287 | HOA Includes: Trash Disposal,Y/N 288 | HOA Includes: Water,Y/N 289 | Interior: 9+ Ft Ceiling,Y/N 290 | Interior: All Window Treatments,Y/N 291 | Interior: Attic Access,Y/N 292 | Interior: Beamed Ceiling,Y/N 293 | Interior: Bookcase,Y/N 294 | Interior: Built-Ins,Y/N 295 | Interior: Computer Nook,Y/N 296 | Interior: Crown Molding,Y/N 297 | Interior: Electric Dryer Con,Y/N 298 | Interior: Electric Stove Con,Y/N 299 | Interior: Electric Washer Con,Y/N 300 | Interior: Gas Dryer Con,Y/N 301 | Interior: Gas Stove Con,Y/N 302 | Interior: Handicap Acc,Y/N 303 | Interior: Icemaker Con,Y/N 304 | Interior: Master Bath,Y/N 305 | Interior: Multi-Head Shower,Y/N 306 | Interior: Other,Y/N 307 | Interior: Separate Shower,Y/N 308 | Interior: Skylight,Y/N 309 | Interior: Some Window Treatments,Y/N 310 | Interior: Special Bath,Y/N 311 | Interior: Varied Ceiling Heights,Y/N 312 | Interior: Vaulted Ceilings,Y/N 313 | Interior: Walk-in Closet,Y/N 314 | Interior: Wet Bar,Y/N 315 | Lot: Additional Land Available,Y/N 316 | Lot: Commons,Y/N 317 | Lot: Corner,Y/N 318 | Lot: Cul-De-Sac,Y/N 319 | Lot: Dead-End,Y/N 320 | Lot: Easements,Y/N 321 | Lot: Flood Plain,Y/N 322 | Lot: Golf Course Frontage,Y/N 323 | Lot: Level,Y/N 324 | Lot: No Outlet Street,Y/N 325 | Lot: Other,Y/N 326 | Lot: Sloping,Y/N 327 | Lot: Views,Y/N 328 | Lot: Water Frontage,Y/N 329 | Lot: Wooded,Y/N 330 | Lot: Zero Lot Line,Y/N 331 | Lst Agt/Ofc will NOT: LA/LO will NOT Accept and Present Offers,Y/N 332 | Lst Agt/Ofc will NOT: LA/LO will NOT Advise the seller on PA?s,Y/N 333 | Lst Agt/Ofc will NOT: LA/LO will NOT Arrange Appointments,Y/N 334 | Lst Agt/Ofc will NOT: LA/LO will NOT Assist seller in counteroffers,Y/N 335 | Lst Agt/Ofc will NOT: LA/LO will NOT Negotiate for the seller,Y/N 336 | Miscellaneous: Fixer-Upper,Y/N 337 | Miscellaneous: Guest House,Y/N 338 | Miscellaneous: Horse Property,Y/N 339 | Miscellaneous: Other - See Remarks,Y/N 340 | Parking: 1 Car Carport,Y/N 341 | Parking: 1 Car Garage,Y/N 342 | Parking: 2 Car Carport,Y/N 343 | Parking: 2 Car Garage,Y/N 344 | Parking: 3 Car Carport,Y/N 345 | Parking: 3 Car Garage,Y/N 346 | Parking: 4+ Car Carport,Y/N 347 | Parking: 4+ Car Garage,Y/N 348 | Parking: Assigned,Y/N 349 | Parking: Carport Rear,Y/N 350 | Parking: Garage Rear,Y/N 351 | Parking: No Parking,Y/N 352 | Parking: Open Parking,Y/N 353 | Parking: RV/Boat Port,Y/N 354 | Patio: Covered,Y/N 355 | Patio: Enclosed,Y/N 356 | Patio: Open,Y/N 357 | Patio: Screened,Y/N 358 | Pool: Above Ground,Y/N 359 | Pool: Community/Subdv,Y/N 360 | Pool: Fiberglass,Y/N 361 | Pool: Gunite,Y/N 362 | Pool: Inground,Y/N 363 | Pool: Lined,Y/N 364 | Reserved Item: Ceiling Fans,Y/N 365 | Reserved Item: Drapes,Y/N 366 | Reserved Item: Hot Tub/Spa,Y/N 367 | Reserved Item: Light Fixtures,Y/N 368 | Reserved Item: Microwave,Y/N 369 | Reserved Item: Mini-Blinds,Y/N 370 | Reserved Item: Mirrors,Y/N 371 | Reserved Item: Other - See Remarks,Y/N 372 | Reserved Item: Pool - Above Ground,Y/N 373 | Reserved Item: Pool Equipment,Y/N 374 | Reserved Item: Refrigerator,Y/N 375 | Reserved Item: Rods,Y/N 376 | Reserved Item: Satellite Dish,Y/N 377 | Reserved Item: Water Softener,Y/N 378 | Reserved Item: Window Unit,Y/N 379 | Roof: Asbestos,Y/N 380 | Roof: Built-Up,Y/N 381 | Roof: Comp Shingle,Y/N 382 | Roof: Metal,Y/N 383 | Roof: Other,Y/N 384 | Roof: Slate,Y/N 385 | Roof: Tile,Y/N 386 | Rooms: Bedroom - Additional,Y/N 387 | Rooms: Bedroom - Additional Level,Y/N 388 | Rooms: Bonus,Y/N 389 | Rooms: Bonus Level,Y/N 390 | Rooms: Breakfast,Y/N 391 | Rooms: Breakfast Level,Y/N 392 | Rooms: Breezeway,Y/N 393 | Rooms: Breezeway Level,Y/N 394 | Rooms: Carport,Y/N 395 | Rooms: Carport Level,Y/N 396 | Rooms: Darkroom,Y/N 397 | Rooms: Darkroom Level,Y/N 398 | Rooms: Den,Y/N 399 | Rooms: Den Level,Y/N 400 | Rooms: Dining Area,Y/N 401 | Rooms: Dining Area Level,Y/N 402 | Rooms: Dining Room,Y/N 403 | Rooms: Dining Room Level,Y/N 404 | Rooms: Dining/Kitchen,Y/N 405 | Rooms: Dining/Kitchen Level,Y/N 406 | Rooms: Dining/Living,Y/N 407 | Rooms: Dining/Living Level,Y/N 408 | Rooms: Eat-in-Kitchen,Y/N 409 | Rooms: Eat-in-Kitchen Level,Y/N 410 | Rooms: Exercise,Y/N 411 | Rooms: Exercise Level,Y/N 412 | Rooms: Family,Y/N 413 | Rooms: Family Level,Y/N 414 | Rooms: Florida,Y/N 415 | Rooms: Florida Room Level,Y/N 416 | Rooms: Formal Dining,Y/N 417 | Rooms: Formal Dining Level,Y/N 418 | Rooms: Foyer,Y/N 419 | Rooms: Foyer Level,Y/N 420 | Rooms: Full Bath,Y/N 421 | Rooms: Full Bath Level,Y/N 422 | Rooms: Garage,Y/N 423 | Rooms: Garage Level,Y/N 424 | Rooms: Great Room,Y/N 425 | Rooms: Great Room Level,Y/N 426 | Rooms: Greenhouse,Y/N 427 | Rooms: Greenhouse Level,Y/N 428 | Rooms: Half Bath,Y/N 429 | Rooms: Half Bath Level,Y/N 430 | Rooms: Hobby Room,Y/N 431 | Rooms: Hobby Room Level,Y/N 432 | Rooms: Keeping,Y/N 433 | Rooms: Keeping Level,Y/N 434 | Rooms: Kitchen,Y/N 435 | Rooms: Kitchen Level,Y/N 436 | Rooms: Laundry,Y/N 437 | Rooms: Laundry Level,Y/N 438 | Rooms: Living Room,Y/N 439 | Rooms: Living Room,Y/N 440 | Rooms: Master Bath,Y/N 441 | Rooms: Master Bath Level,Y/N 442 | Rooms: Master Bedroom,Y/N 443 | Rooms: Master Bedroom Level,Y/N 444 | Rooms: Mudroom,Y/N 445 | Rooms: Mudroom Level,Y/N 446 | Rooms: Nursery,Y/N 447 | Rooms: Nursery Level,Y/N 448 | Rooms: Office,Y/N 449 | Rooms: Office Level,Y/N 450 | Rooms: Other,Y/N 451 | Rooms: Other Level,Y/N 452 | Rooms: Pantry,Y/N 453 | Rooms: Pantry Level,Y/N 454 | Rooms: Playroom,Y/N 455 | Rooms: Playroom Level,Y/N 456 | Rooms: Rec-Game Room,Y/N 457 | Rooms: Rec-Game Room Level,Y/N 458 | Rooms: Retail Space,Y/N 459 | Rooms: Retail Space Level,Y/N 460 | Rooms: Separate Apartment,Y/N 461 | Rooms: Separate Apartment Level,Y/N 462 | Rooms: Sitting Room,Y/N 463 | Rooms: Sitting Room Level,Y/N 464 | Rooms: Storage,Y/N 465 | Rooms: Storage Level,Y/N 466 | Rooms: Sunroom,Y/N 467 | Rooms: Sunroom Level,Y/N 468 | Rooms: Utility Room,Y/N 469 | Rooms: Utility Room Level,Y/N 470 | Rooms: Workshop,Y/N 471 | Rooms: Workshop Level,Y/N 472 | Showing: 24 Hour Notice,Y/N 473 | Showing: Accompany,Y/N 474 | Showing: Appoint Required,Y/N 475 | Showing: Call Listing Office,Y/N 476 | Showing: CSS,Y/N 477 | Showing: Key in Office,Y/N 478 | Showing: LA Present,Y/N 479 | Showing: Leave Card,Y/N 480 | Showing: Lockbox,Y/N 481 | Showing: No Lockbox,Y/N 482 | Showing: Security System,Y/N 483 | Showing: Show Anytime,Y/N 484 | Showing: Sign in Required,Y/N 485 | Showing: Sign on Property,Y/N 486 | Siding: Aluminum,Y/N 487 | Siding: Asbestos Siding,Y/N 488 | Siding: Block,Y/N 489 | Siding: Brick,Y/N 490 | Siding: Hardiplank,Y/N 491 | Siding: Other,Y/N 492 | Siding: Stucco,Y/N 493 | Siding: Synthetic Stucco,Y/N 494 | Siding: Vinyl Siding,Y/N 495 | Siding: Wood,Y/N 496 | Style: Acadian,Y/N 497 | Style: Art Deco,Y/N 498 | Style: Colonial,Y/N 499 | Style: Contemporary,Y/N 500 | Style: Cottage,Y/N 501 | Style: Dome,Y/N 502 | Style: French,Y/N 503 | Style: Garden/Patio,Y/N 504 | Style: Log Cabin,Y/N 505 | Style: Mediterranean,Y/N 506 | Style: Modular,Y/N 507 | Style: New Orleans,Y/N 508 | Style: Other,Y/N 509 | Style: Ranch,Y/N 510 | Style: Shotgun,Y/N 511 | Style: Split Level,Y/N 512 | Style: Townhouse,Y/N 513 | Style: Traditional,Y/N 514 | Style: Tudor,Y/N 515 | Style: Victorian,Y/N 516 | Utilities: Elec: Beauregard Electric,Y/N 517 | Utilities: Elec: City,Y/N 518 | Utilities: Elec: CLECO,Y/N 519 | Utilities: Elec: Deep East,Y/N 520 | Utilities: Elec: DEMCO,Y/N 521 | Utilities: Elec: Entergy,Y/N 522 | Utilities: Elec: Generator,Y/N 523 | Utilities: Elec: Jeff-Davis Co-op,Y/N 524 | Utilities: Elec: Pt Coupee EMC,Y/N 525 | Utilities: Elec: SLECA,Y/N 526 | Utilities: Elec: SLEMCO,Y/N 527 | Utilities: Gas: Atmos,Y/N 528 | Utilities: Gas: Carencro Gas,Y/N 529 | Utilities: Gas: Centerpoint,Y/N 530 | Utilities: Gas: DEMCO,Y/N 531 | Utilities: Gas: Entergy,Y/N 532 | Utilities: Gas: Entex,Y/N 533 | Utilities: Gas: Private/Propane,Y/N 534 | Utilities: Gas: Pt Coupee EMC,Y/N 535 | Utilities: Gas: Reliant,Y/N 536 | Utilities: Gas: St Amant Gas,Y/N 537 | Utilities: Gas: TransLa,Y/N 538 | Water/Sewer: Comm Sewer,Y/N 539 | Water/Sewer: Comm Water,Y/N 540 | Water/Sewer: Indiv Water/Well,Y/N 541 | Water/Sewer: Mechan Sewer,Y/N 542 | Water/Sewer: Other,Y/N 543 | Water/Sewer: Public Sewer,Y/N 544 | Water/Sewer: Public Water,Y/N 545 | Water/Sewer: Retaining Pond,Y/N 546 | Water/Sewer: Septic,Y/N 547 | Water/Sewer: Waste Water Utility,Y/N 548 | Waterfront: Access,Y/N 549 | Waterfront: Bayou/River,Y/N 550 | Waterfront: Beach,Y/N 551 | Waterfront: Dock/Mooring,Y/N 552 | Waterfront: Frontage,Y/N 553 | Waterfront: Lake/Pond,Y/N 554 | Waterfront: Other,Y/N 555 | Waterfront: View,Y/N 556 | Waterfront: Walk To,Y/N 557 | --------------------------------------------------------------------------------